/* =====================================================================
   Screaming Workspace — Layout de la aplicación (topbar + sidebar + contenido)
   ===================================================================== */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
    grid-template-areas:
        "sidebar topbar"
        "sidebar main";
    height: 100vh;
    overflow: hidden;
}

/* ---------- Topbar ---------- */
.topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    gap: var(--space-4);
}
.topbar-left { display: flex; align-items: center; gap: var(--space-3); min-width: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: var(--space-2); }
.topbar-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-toggle { display: none; }

/* ---------- Sidebar ---------- */
.sidebar {
    grid-area: sidebar;
    /* Ancla de posicionamiento para el menú del usuario (#userChip → .dropdown-menu
       en auth.js), que se agrega como hijo de .sidebar con position:absolute. Sin
       esto, el menú se posicionaba respecto del viewport en vez de la sidebar y
       terminaba abriéndose para abajo/fuera de lugar en vez de justo arriba del
       botón de perfil. */
    position: relative;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform var(--transition-base);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 20px;
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-color);
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}
.sidebar-brand .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--color-primary); }

/* Aviso de "Evento activo" (lo configura un Administrador en Administración → General) */
.active-event-banner {
    display: flex; align-items: center; gap: 8px;
    margin: var(--space-3) var(--space-3) 0;
    padding: 8px 10px;
    background: var(--color-success-light);
    border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 600;
    color: var(--color-success);
    overflow: hidden;
}
.active-event-banner.hidden { display: none; }
.active-event-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    background: var(--color-success);
    animation: active-event-pulse 2s ease-in-out infinite;
}
.active-event-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes active-event-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.sidebar-section { padding: var(--space-4) var(--space-3) var(--space-2); }
.sidebar-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted);
    padding: 0 var(--space-2);
    margin-bottom: 6px;
}
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13.5px; font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-link:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.sidebar-link.active { background: var(--color-primary-light); color: var(--color-primary); }

.sidebar-boards-list { flex: 1; overflow-y: auto; }
.sidebar-board-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-board-item .board-color-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.sidebar-board-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-board-item.active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 700; }

.sidebar-footer {
    padding: var(--space-3);
    border-top: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.user-chip { display: flex; align-items: center; gap: 8px; min-width: 0; cursor: pointer; padding: 4px; border-radius: var(--radius-sm); }
.user-chip:hover { background: var(--bg-hover); }
.user-chip-info { min-width: 0; }
.user-chip-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-role { font-size: 11px; color: var(--text-muted); }

/* ---------- Main content ---------- */
.main-content {
    grid-area: main;
    overflow: auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.page { padding: var(--space-6); max-width: 1400px; width: 100%; margin: 0 auto; }
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: var(--space-6);
    gap: var(--space-4);
    flex-wrap: wrap;
}
.page-header h1 { font-size: 22px; }
.page-header p { color: var(--text-secondary); margin-top: 4px; }

.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: var(--space-4);
}
.board-card {
    border-radius: var(--radius-md);
    padding: var(--space-4);
    height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.board-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.board-card h3 { font-size: 15px; }
.board-card .board-card-meta { font-size: 11.5px; opacity: .9; display: flex; gap: 12px; }
.board-card-new {
    border: 2px dashed var(--border-color-strong);
    background: transparent;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 700; font-size: 13.5px;
}
.board-card-new:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }

/* ---------- Toolbar (board view) ---------- */
.board-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    gap: var(--space-3);
    flex-wrap: wrap;
}
.board-toolbar-left { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; min-width: 0; }
.board-toolbar-right { display: flex; align-items: center; gap: var(--space-2); }
.board-title-input {
    font-size: 16px; font-weight: 700;
    border: none; background: transparent; padding: 4px 6px; border-radius: var(--radius-sm);
    max-width: 260px;
}
.board-title-input:hover, .board-title-input:focus { background: var(--bg-hover); outline: none; }

.member-avatars { display: flex; align-items: center; }
