:root {
    --color-gold: #D9CA7E;
    --color-yellow: #F3DC5A;
    --color-black: #160404;
    --color-red: #D92323;
    --color-white: #ffffff;

    /* Nueva Paleta Light */
    --bg-main: #F4F6F8;
    --bg-card: #FFFFFF;
    --text-main: #160404;
    --text-muted: #666666;

    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(22, 4, 4, 0.05);

    /* Nuevas Fuentes Estilizadas */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    flex-direction: column;
    /* Changed for better flow */
}

/* Sidebar (Now Navbar on Desktop) */
.sidebar {
    width: 100%;
    height: 80px;
    position: sticky;
    /* Change to sticky */
    top: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.8);
    /* Semi-transparent */
    backdrop-filter: blur(10px);
    /* Glassmorphism hook */
    -webkit-backdrop-filter: blur(10px);
    /* Safari support */
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    border-right: none;
    padding: 0 40px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    /* Softer shadow */
    transition: all 0.3s ease;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.logo {
    margin-bottom: 0;
    margin-right: 30px;
    /* Fixed margin */
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
    /* Don't shrink logo */
}

.nav-item {
    padding: 10px 15px;
    margin-bottom: 0;
    border: none;
    flex-shrink: 0;
    white-space: nowrap;
    cursor: pointer;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-item:hover {
    background: rgba(22, 4, 4, 0.07);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--color-black);
    color: var(--color-white);
}

.nav-item.active i {
    color: var(--color-gold);
}

.nav-item i {
    margin-right: 8px;
    font-size: 1.1rem;
}

/* Navbar scrolled state */
.sidebar.scrolled {
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Hide desktop toggle */
.menu-toggle.desktop-toggle {
    display: none !important;
}

/* Main Content */
.main-content {
    margin-left: 0;
    margin-top: 0;
    /* No margin top needed with sticky, content flows naturally */
    padding: 40px;
    width: 100%;
    flex: 1;
    /* Allow content to grow */
}

/* Sections for Scroll Snap / Full Height feel */
section,
.section-container {
    min-height: 100vh;
    /* Full viewport height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically */
    padding: 60px 0;
    opacity: 0;
    /* Hidden initially for reveal effect */
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

section.visible,
.section-container.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Header - Sticky Glassmorphism */
header {
    position: sticky;
    top: 80px; /* justo debajo del navbar */
    z-index: 100;
    background: rgba(244, 246, 248, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 40px;
    margin: -40px -40px 40px -40px; /* escapa el padding del padre */
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Content area transition on section change */
#contentArea {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

h1 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--color-black);
    letter-spacing: -0.5px;
}

.user-profile i {
    color: var(--color-black) !important;
    transition: color 0.3s ease;
}

.user-profile i:hover {
    color: var(--color-gold) !important;
}

/* Cards & Modules */
/* Card Transitions for Reveal */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.03);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
    /* Reveal specific styles */
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.card.visible {
    opacity: 1;
    transform: translateY(0);
}

.card:hover {
    /* Only apply hover lift if already visible */
    transform: translateY(-5px);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

h2 {
    font-family: var(--font-heading);
    color: var(--color-black);
    margin-bottom: 15px;
}

p {
    line-height: 1.6;
    color: var(--text-muted);
}

/* Form Elements */
input,
select,
textarea {
    width: 100%;
    padding: 14px 18px;
    background: #FAFAFA;
    border: 1px solid #E0E0E0;
    border-radius: 10px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    /* Prevents zoom on iOS */
    margin-bottom: 15px;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    /* Removes default styling on iOS */
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-gold);
    background: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(217, 202, 126, 0.2);
}

button {
    background: var(--color-black);
    color: var(--color-white);
    padding: 14px 30px;
    border: none;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

button:hover {
    transform: translateY(-2px);
    background: var(--color-red);
    box-shadow: 0 5px 15px rgba(217, 35, 35, 0.3);
}

/* Accent Elements */
.highlight {
    color: var(--color-gold);
}

/* Overlay (Backdrop) independent of sidebar element for better control */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    /* Below sidebar (1000) but above content */
    opacity: 0;
    visibility: hidden;
    /* Prevent interaction when hidden */
    transition: opacity 0.3s ease, visibility 0.3s;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-toggle {
    /* Base styles for FAB */
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 30px;
    right: 30px;
    top: auto;
    left: auto;
    width: 60px;
    height: 60px;
    z-index: 1001;
    background: var(--color-black);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    color: var(--color-white);
    font-size: 1.5rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.menu-toggle:hover {
    box-shadow: 0 8px 25px rgba(217, 35, 35, 0.4);
    transform: translateY(-2px);
}

.menu-toggle:active {
    transform: scale(0.9);
}

/* Specific visibilities */
.menu-toggle.desktop-toggle {
    display: flex;
}

#menuToggle {
    display: none;
}

/* Responsiveness */
@media (max-width: 768px) {
    .menu-toggle.desktop-toggle {
        display: none;
    }

    #menuToggle {
        display: flex;
        /* Show mobile toggle on mobile */
    }

    body {
        font-size: 14px;
    }

    .sidebar {
        /* Revert to Sidebar styles for Mobile */
        width: 85%;
        height: 100%;
        max-width: 320px;
        position: fixed;
        right: 0;
        left: auto;
        top: 0;
        flex-direction: column;
        justify-content: flex-start;
        /* Start from top */
        padding: 25px 20px;
        transform: translateX(100%);
        box-shadow: none;
        background: rgba(255, 255, 255, 0.98);
        border-right: none;
        border-bottom: none;
        border-left: 1px solid rgba(0, 0, 0, 0.05);
        align-items: stretch;
        gap: 15px;
        overflow-y: auto;
    }

    .logo {
        margin-right: 0;
        margin-bottom: 2rem;
        font-size: 1.5rem;
        justify-content: center;
    }

    .nav-item {
        padding: 14px 18px;
        margin-right: 0;
        margin-bottom: 8px;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .main-content {
        margin-top: 0;
        /* Reset top margin on mobile */
    }

    header {
        top: 0; /* en móvil no hay navbar persistente arriba */
        padding: 15px 20px;
        margin: -80px -20px 30px -20px; /* compensa el padding del padre en móvil */
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: -10px 0 50px rgba(0, 0, 0, 0.1);
    }

    /* Overlay effect when sidebar is active */
    .sidebar.active::before {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 80px 20px 20px 20px;
        /* Top padding for fixed header/toggle space */
    }

    .card {
        padding: 20px;
        /* Reduces padding to save space */
        border-radius: 15px;
    }

    h1 {
        font-size: 2rem;
        /* Smaller headings */
        margin-left: 40px;
        /* Space for toggler */
    }

    h2 {
        font-size: 1.5rem;
    }

    /* Floating Menu Button (FAB) */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 30px;
        right: 30px;
        top: auto;
        left: auto;
        width: 60px;
        height: 60px;
        z-index: 1001;
        background: var(--color-black);
        border-radius: 50%;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
        cursor: pointer;
        color: var(--color-white);
        font-size: 1.5rem;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .menu-toggle:active {
        transform: scale(0.9);
    }

    .menu-toggle:hover {
        box-shadow: 0 8px 25px rgba(217, 35, 35, 0.4);
        transform: translateY(-2px);
    }

    .menu-toggle i {
        transition: transform 0.3s ease;
    }

    /* Rotate icon when sidebar is active (handled by class in JS if desired, but nice touch) */
    .sidebar.active~.menu-toggle i {
        transform: rotate(90deg);
    }

    /* Better touch targets for nav */
    .nav-item {
        padding: 16px 20px;
        margin-bottom: 8px;
        border: 1px solid rgba(0, 0, 0, 0.05);
        /* Subtle border for better separation */
    }

    h1 {
        font-size: 2rem;
        margin-left: 0;
        /* Removing margin as button is now bottom-right */
        text-align: center;
        width: 100%;
    }
}

/* Landscape Mobile Fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }
}