/**
 * [RAIZ]/public/assets/css/app.css
 *
 * Estilos generales del layout autenticado (app shell):
 *  - Barra lateral contraíble
 *  - Cabecera superior
 *  - Zona de contenido
 *  - Paleta basada en variables CSS (colores de club se sobreescriben desde PHP)
 */

:root {
    /* Colores base (se pueden sobreescribir desde PHP usando <style> inline) */
    --brand-primary: #4f46e5;
    --brand-secondary: #06b6d4;

    --body-bg: #f3f4f6;

    --sidebar-bg: #020617;
    --sidebar-bg-hover: #111827;
    --sidebar-border: rgba(148, 163, 184, 0.25);
    --sidebar-text: #e5e7eb;
    --sidebar-text-muted: #9ca3af;

    --topbar-bg: #ffffff;
    --topbar-border: rgba(209, 213, 219, 0.8);
}

body.app-body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--body-bg);
}

/* Shell principal */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--body-bg);
}

/* Barra lateral */

.app-sidebar {
    width: 260px;
    background: radial-gradient(circle at top left, #0b1220 0, var(--sidebar-bg) 40%);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem;
    border-right: 1px solid var(--sidebar-border);
    transition: width 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    z-index: 1020;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.5rem 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.logo-circle {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    color: #f9fafb;
    flex-shrink: 0;
    overflow: hidden; /* NUEVO: recorta la imagen dentro del círculo */
}

.logo-circle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--sidebar-text-muted);
}

/* Navegación lateral */

.sidebar-nav {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.6rem;
    border-radius: 999px;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--sidebar-text-muted);
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

/* Forzamos el color frente a las reglas de Bootstrap */
.app-sidebar .sidebar-link {
    color: var(--sidebar-text-muted) !important;
}

.app-sidebar .sidebar-link:hover,
.app-sidebar .sidebar-link.is-active {
    color: #f9fafb !important;
}

.sidebar-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    color: var(--sidebar-text-muted);
}

.sidebar-link:hover {
    background: var(--sidebar-bg-hover);
    transform: translateX(2px);
}

.sidebar-link.is-active {
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
    box-shadow: 0 0.4rem 1rem rgba(15, 23, 42, 0.5);
}

.sidebar-link.is-active .sidebar-badge {
    background: rgba(15, 23, 42, 0.2);
    color: #e5e7eb;
}

.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 0.6rem 0.25rem;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
}

.sidebar-footer-text {
    color: var(--sidebar-text-muted);
}

/* Colapso de barra lateral (modo compacto) */

body.sidebar-collapsed .app-sidebar {
    width: 78px;
}

body.sidebar-collapsed .brand-text {
    display: none;
}

body.sidebar-collapsed .sidebar-text,
body.sidebar-collapsed .sidebar-badge {
    display: none;
}

/* Shell principal cuando barra lateral está colapsada en pantallas medianas/grandes */
@media (min-width: 768px) {
    body.sidebar-collapsed .app-sidebar {
        box-shadow: 0 0 0 transparent;
    }
}

/* Comportamiento móvil: la barra lateral se superpone */

@media (max-width: 767.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 0 0.75rem 2rem rgba(15, 23, 42, 0.75);
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app-shell {
        padding-left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 1010;
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Zona principal (topbar + contenido) */

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    height: 56px;
    background: var(--topbar-bg);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1010;
    border-bottom: 1px solid var(--topbar-border);
}

.app-page-title {
    font-weight: 600;
}

.app-content {
    padding: 1.5rem;
}

/* Avatar circular */

.avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    color: #f9fafb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Tarjetas de dashboard */

.app-card {
    border-radius: 1rem;
}

/* Pequeños ajustes responsivos */

@media (max-width: 575.98px) {
    .app-content {
        padding: 1rem;
    }
}
