:root {
    /* Paleta de colores oficial */
    --color-white: #ffffff;
    --color-orange: #f4a81c;
    --color-green: #8fc73e;
    --color-blue: #1b5b97;
    --color-pink: #d91a72;
    --color-purple: #7d268a;
    
    --color-bg-sidebar: #f8fafc;
    --color-bg-content: #ffffff;
    --color-text-main: #2d3748;
    --color-text-muted: #718096;
    --color-border: #e2e8f0;
    
    --sidebar-width: 280px;
    --border-radius: 12px;
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    color: var(--color-text-main);
    background-color: var(--color-bg-content);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, .logo-title {
    font-family: 'Outfit', sans-serif;
    color: var(--color-blue);
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-bg-sidebar);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.logo {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.logo svg {
    transition: transform var(--transition), box-shadow var(--transition);
}

.logo:hover svg {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 16px -2px rgba(0,0,0,0.08);
}

.logo-title {
    font-size: 1.25rem;
    font-weight: 800;
}

.logo-subtitle {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-text-main);
}

.sidebar-badge {
    display: inline-block;
    background-color: var(--color-purple);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    margin-top: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
}

.tab-list {
    list-style: none;
}

.nav-divider {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: bold;
    padding: 1rem 1.5rem 0.5rem;
    letter-spacing: 0.05em;
}

.tab-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.tab-btn .icon {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.tab-btn:hover {
    background-color: rgba(0,0,0,0.03);
}

.tab-btn.active {
    background-color: rgba(27, 91, 151, 0.05); /* Ligeramente azul */
    border-left-color: var(--accent-color, var(--color-blue));
    color: var(--accent-color, var(--color-blue));
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.whatsapp-link {
    display: block;
    margin-top: 0.5rem;
    color: var(--color-blue);
    text-decoration: none;
    font-weight: 600;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 3rem 4rem;
    max-width: 1000px;
}

/* TABS VISIBILITY */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

.tab-content.active.full-bleed-tab {
    display: flex;
}

/* FULL BLEED TABS CONTROLLER (using modern CSS :has selector) */
.main-content:has(.full-bleed-tab.active) {
    max-width: none;
    padding: 0;
}

/* FULL BLEED TAB (GENIALLY IFRAME) */
.tab-content.full-bleed-tab {
    max-width: none;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    flex-direction: column;
}

.tab-content.full-bleed-tab .iframe-container {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 1;
}

.tab-content.full-bleed-tab iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* CONTENT STYLES */
.content-header {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.content-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.lead-text {
    font-size: 1.25rem;
    color: var(--color-text-muted);
}

.info-card {
    background-color: var(--color-bg-sidebar);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    border-left: 4px solid var(--color-green);
}

.info-card.border-blue { border-left-color: var(--color-blue); }

.info-card h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.grid-2-cols, .grid-3-cols {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.grid-2-cols { grid-template-columns: 1fr 1fr; }
.grid-3-cols { grid-template-columns: repeat(3, 1fr); }

.module-card, .video-card {
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    transition: transform var(--transition), box-shadow var(--transition);
}

.module-card:hover, .video-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.module-card h3 { margin-bottom: 0.75rem; }
.module-card p { color: var(--color-text-muted); margin-bottom: 1.5rem; }

.action-btn {
    background-color: var(--color-blue);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color var(--transition);
}
.action-btn:hover { background-color: var(--color-text-main); }

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
    border-left: 2px solid var(--color-border);
}
.timeline-event {
    position: relative;
    margin-bottom: 2.5rem;
}
.timeline-event::before {
    content: '';
    position: absolute;
    left: -2.45rem;
    top: 0.25rem;
    width: 1rem;
    height: 1rem;
    background: var(--color-orange);
    border-radius: 50%;
    border: 3px solid white;
}
.event-date {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--color-orange);
    margin-bottom: 0.5rem;
}
.badge {
    display: inline-block;
    background: var(--color-bg-sidebar);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-top: 1rem;
    border: 1px solid var(--color-border);
}

/* Utils */
.placeholder-box {
    padding: 3rem;
    text-align: center;
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius);
    color: var(--color-text-muted);
}

.video-thumbnail {
    height: 120px;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
}
.bg-gradient-pink { background: linear-gradient(135deg, var(--color-pink), #ff4d94); }
.bg-gradient-blue { background: linear-gradient(135deg, var(--color-blue), #4299e1); }
.bg-gradient-orange { background: linear-gradient(135deg, var(--color-orange), #ed8936); }

.resource-list {
    list-style: none;
}
.resource-list li {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
}
.resource-list li span { margin-right: 0.5rem; }

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}
.tool-category h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-purple);
}
.tool-category ul { padding-left: 1.25rem; }
.tool-category li { margin-bottom: 0.5rem; }

.anniversary-banner {
    background: linear-gradient(135deg, var(--color-blue), var(--color-purple));
    color: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 2rem;
}
.anniversary-banner h2 { color: white; font-size: 2rem; margin-bottom: 1rem; }

.archive-list {
    list-style: none;
}
.archive-list li {
    margin-bottom: 0.5rem;
}
.archive-list a {
    color: var(--color-blue);
    text-decoration: none;
    font-weight: 600;
}
.archive-list a:hover { text-decoration: underline; }

/* =========================================
   RESPONSIVE — Hamburger + Off-canvas sidebar
   ========================================= */

/* --- Hamburger button (hidden on desktop) --- */
.hamburger {
    display: none;
    position: fixed;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 300;
    background: var(--color-blue);
    border: none;
    border-radius: 10px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(27,91,151,0.3);
    transition: background var(--transition);
}
.hamburger:hover { background: var(--color-purple); }
.hamburger span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
/* animated X when open */
.hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* --- Overlay backdrop --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}
.sidebar-overlay.visible { display: block; }

/* =====================
   TABLET  (≤ 1024px)
   ===================== */
@media (max-width: 1024px) {
    .main-content {
        padding: 2.5rem 2.5rem;
    }
    .content-header h1 { font-size: 2rem; }
    .lead-text { font-size: 1.1rem; }
}

/* =====================
   MOBILE  (≤ 768px)
   ===================== */
@media (max-width: 768px) {

    /* Show hamburger */
    .hamburger { display: flex; }

    /* Off-canvas sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(80vw, 300px);
        z-index: 200;
        transform: translateX(-105%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid var(--color-border);
        overflow-y: auto;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0,0,0,0.15);
    }

    /* Push content away from top so it clears the hamburger */
    .main-content {
        margin-left: 0;
        padding: 4.5rem 1.25rem 5rem; /* bottom pad for bottom-nav */
        max-width: 100%;
    }

    /* Full-bleed (Genially) tab */
    .main-content:has(.full-bleed-tab.active) { padding: 0; }
    .tab-content.full-bleed-tab {
        padding: 0;
        height: calc(100dvh - 56px); /* leave room for bottom nav */
        min-height: 400px;
    }

    /* Typography scale-down */
    .content-header { margin-bottom: 1.75rem; padding-bottom: 1rem; }
    .content-header h1 { font-size: 1.6rem !important; }
    .lead-text { font-size: 1rem; }

    /* Grids stack */
    .grid-2-cols,
    .grid-3-cols { grid-template-columns: 1fr; }

    /* Cards */
    .info-card,
    .placeholder-box { padding: 1.25rem; }

    /* Timeline */
    .timeline { padding-left: 1.25rem; }

    /* anniversary banner */
    .anniversary-banner { padding: 1.75rem 1.25rem; }
    .anniversary-banner h2 { font-size: 1.4rem; }
}

/* =========================================
   BOTTOM NAVIGATION BAR  (mobile only)
   ========================================= */
.bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        background: #fff;
        border-top: 1px solid var(--color-border);
        box-shadow: 0 -4px 20px rgba(0,0,0,0.07);
        height: 56px;
        align-items: stretch;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .bottom-nav::-webkit-scrollbar { display: none; }

    .bottom-nav-btn {
        flex: 1 0 auto;
        min-width: 56px;
        background: none;
        border: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        font-size: 0.6rem;
        font-family: inherit;
        font-weight: 700;
        color: var(--color-text-muted);
        cursor: pointer;
        padding: 4px 4px 2px;
        border-top: 3px solid transparent;
        transition: color var(--transition), border-color var(--transition);
        white-space: nowrap;
    }
    .bottom-nav-btn .bn-icon { font-size: 1.25rem; line-height: 1; }
    .bottom-nav-btn.active {
        color: var(--color-blue);
        border-top-color: var(--color-blue);
    }
}

/* Animación de carga para Markdown */
.loading-placeholder {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    font-style: italic;
    padding: 1rem 0;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}
