/* ================================================================
   Patrón visual Suite LeanCP v1 (CSS compartido)
   Aprobado 23 abr 2026 sobre Avance. Aplica a TODAS las apps Suite.
   Referencia: .claude/rules/patron-visual-suite.md
   ================================================================ */

/* === RAIL LATERAL 48px =========================================== */
.side-rail {
    position: fixed;
    left: 0; top: 56px; bottom: 0;
    width: 48px;
    background: var(--surface, #141414);
    border-right: 1px solid var(--border, #232323);
    display: flex; flex-direction: column; align-items: center;
    padding: 10px 0;
    gap: 2px;
    z-index: 40;
    font-family: 'Inter', sans-serif;
}
.side-rail .rail-item {
    width: 36px; height: 36px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--text-muted, #808080);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background 0.15s, color 0.15s;
}
.side-rail .rail-item:hover { background: var(--surface2, #1a1a1a); color: var(--text, #f5f5f5); }
.side-rail .rail-item.active { background: rgba(201, 162, 39, 0.14); color: var(--oro, #C9A227); }
.side-rail .rail-item.active::before {
    content: ''; position: absolute;
    left: -10px; top: 20%; bottom: 20%;
    width: 2px;
    background: var(--oro, #C9A227);
    border-radius: 1px;
}
.side-rail .rail-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 46px; top: 50%; transform: translateY(-50%);
    background: var(--surface3, #202020);
    color: var(--text, #f5f5f5);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.76rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    border: 1px solid var(--border, #232323);
    z-index: 99;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}
.side-rail .rail-item:hover[data-tooltip]::after { opacity: 1; }
.side-rail .rail-divider {
    width: 24px; height: 1px;
    background: var(--border, #232323);
    margin: 6px 0;
}
.side-rail .rail-bottom {
    margin-top: auto;
    display: flex; flex-direction: column; gap: 2px;
}

/* === SHIFT CONTENT RIGHT WHEN RAIL ACTIVE ========================= */
.with-rail { padding-left: 48px; }
.with-rail .tab-nav { display: none; }

/* Hide any duplicated 9-dots or brand inside the app header
   (topbar universal ya los tiene, suite-topbar.js es la fuente única) */
.with-rail .app-switcher-btn,
.with-rail .header-brand,
.with-rail .switcher-btn { display: none !important; }

/* === HEADER CONTROLS STANDARD (dark) ============================= */
/* Estos estilos complementan — no reemplazan — los del header de cada app. */
.suite-theme-toggle {
    background: var(--surface2, #1a1a1a);
    border: 1px solid var(--border, #232323);
    color: var(--text-muted, #808080);
    cursor: pointer;
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    font-size: 1rem;
    flex-shrink: 0;
}
.suite-theme-toggle:hover {
    border-color: var(--oro, #C9A227);
    color: var(--oro, #C9A227);
    background: var(--surface3, #202020);
}
.suite-cloud-sync {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(201, 162, 39, 0.15);
    border: 1px solid var(--oro, #C9A227);
    color: var(--oro, #C9A227);
    padding: 4px 10px;
    border-radius: 20px;
    display: none;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.suite-cloud-sync .spin { animation: suiteSpin 1s linear infinite; }
@keyframes suiteSpin { 100% { transform: rotate(360deg); } }
.suite-header-clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--oro, #C9A227);
    background: var(--surface2, #1a1a1a);
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--border, #232323);
    display: flex; align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.suite-clock-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--green, #4ade80);
    animation: suitePulse 2s infinite;
    flex-shrink: 0;
}
@keyframes suitePulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.suite-header-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted, #808080);
    background: var(--surface2, #1a1a1a);
    padding: 5px 10px;
    border-radius: 6px;
    flex-shrink: 0;
}

/* === OVERFLOW MENU "Acciones ▾" ================================== */
.header-overflow {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}
.header-overflow-btn {
    background: var(--surface2, #1a1a1a);
    border: 1px solid var(--border, #232323);
    color: var(--text, #f5f5f5);
    padding: 7px 14px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.header-overflow-btn:hover {
    border-color: var(--oro, #C9A227);
    color: var(--oro, #C9A227);
}
.header-overflow-menu {
    position: absolute;
    right: 0; top: calc(100% + 4px);
    background: var(--surface, #141414);
    border: 1px solid var(--border, #232323);
    border-radius: 8px;
    min-width: 220px;
    padding: 4px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    display: none;
}
.header-overflow.open .header-overflow-menu { display: block; }
.header-overflow-menu button,
.header-overflow-menu a {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text, #f5f5f5);
    font-size: 0.82rem;
    cursor: pointer;
    border-radius: 5px;
    font-family: inherit;
    text-decoration: none;
    box-sizing: border-box;
}
.header-overflow-menu button:hover,
.header-overflow-menu a:hover {
    background: var(--surface2, #1a1a1a);
    color: var(--oro, #C9A227);
}
.header-overflow-menu .sep {
    height: 1px;
    background: var(--border, #232323);
    margin: 4px 0;
}

/* === LIGHT THEME (activado con body.light-theme) ================== */
/* Override de variables comunes para darle función al botón 🌓       */
body.light-theme {
    --bg: #F5F5F5 !important;
    --bg2: #FFFFFF !important;
    --bg-secondary: #FFFFFF !important;
    --surface: #FFFFFF !important;
    --surface2: #F0F0F0 !important;
    --surface3: #E5E5E5 !important;
    --panel: #FFFFFF !important;
    --panel2: #F5F5F5 !important;
    --panel3: #EEEEEE !important;
    --border: #D0D0D0 !important;
    --border-hover: #B0B0B0 !important;
    --border-strong: #B0B0B0 !important;
    --line: #E0E0E0 !important;
    --line-soft: #EEEEEE !important;
    --line-strong: #C0C0C0 !important;
    --text: #1A1A1A !important;
    --text-primary: #1A1A1A !important;
    --text-secondary: #555555 !important;
    --text-muted: #6A6A6A !important;
    --text-dim: #999999 !important;
    --muted: #6A6A6A !important;
    --dim: #999999 !important;
    --oro-dim: rgba(201, 162, 39, 0.20) !important;
    --oro-soft: rgba(201, 162, 39, 0.12) !important;
    color-scheme: light;
}
body.light-theme input,
body.light-theme select,
body.light-theme textarea,
body.light-theme button {
    color-scheme: light;
}
/* Suavizar el topbar universal (fondo oscuro) cuando estamos en light */
body.light-theme > header[class*="lean-topbar"],
body.light-theme > div[class*="lean-topbar"] {
    background: #141414 !important;
    color: #F5F5F5 !important;
}

/* === MOBILE FALLBACK ============================================= */
@media (max-width: 700px) {
    .side-rail { display: none; }
    .with-rail { padding-left: 0; }
    .with-rail .tab-nav { display: flex; }
    .with-rail .app-switcher-btn,
    .with-rail .header-brand { display: flex !important; }
}
