/* ... (Estilos anteriores sin cambios, excepto el header) ... */
/* --- Importación de Fuentes Locales --- */
@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/statics/SpaceGrotesk-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/statics/SpaceGrotesk-Regular.ttf') format('truetype');
    font-weight: 400; /* Regular */
    font-style: normal;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/statics/SpaceGrotesk-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/statics/SpaceGrotesk-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/statics/SpaceGrotesk-Bold.ttf') format('truetype');
    font-weight: 700; /* Bold */
    font-style: normal;
}

:root {
    --bg-color: #1A1A1A;
    --text-color-primary: #FFFFFF;
    --text-color-secondary: #B3B3B3; 
    --accent-green: #00CC66; 
    --accent-magenta: #F4008A; 
    --surface-color: #2C2C2C; 
    --overlay-surface-color: #0E0E0E; 
    --quote-box-bg: #0E0E0E; 
    --border-color: #444444; 
    --font-family: 'Space Grotesk', sans-serif;
    --overlay-bg: rgba(0, 0, 0, 0.85);
    --skeleton-bg: #2a2a2a; 
    --skeleton-highlight: #383838;
    
    --global-top-offset: 20px; 

    --header-height-desktop: 70px; 
    --header-height-mobile-logo-area: 55px; 
    --header-height-mobile-icons: 50px; 
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color-primary);
    margin: 0; 
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--global-top-offset)); 
    line-height: 1.6;
    overflow-x: hidden; 
    font-variant-numeric: slashed-zero; 
}

/* --- HEADER --- */
/* Estilos base (móvil) */
header {
    display: flex;
    flex-direction: column; 
    align-items: center; 
    padding: 5px 20px 0; 
    background-color: var(--bg-color);
    position: fixed;
    top: var(--global-top-offset); 
    left: 0;
    right: 0; 
    box-sizing: border-box;
    z-index: 100;
}
.header-left-placeholder { display: none; } 

.logo-container {
    display: flex;
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    width: 100%;
    min-height: var(--header-height-mobile-logo-area); 
    text-align: center; 
}

.logo-container img#logo {
    height: 26px; 
    display: block;
}

.header-subtitle { 
    font-size: 0.65em;
    font-weight: 400;
    color: var(--text-color-secondary);
    margin: 3px 0 0 0; /* Ajustado margen */
    line-height: 1.2; /* Ajustado para que no ocupe mucha altura */
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: block; 
}

.mobile-icons-container {
    display: flex; 
    justify-content: center;
    width: 100%;
    padding-bottom: 10px; 
    min-height: var(--header-height-mobile-icons); 
    align-items: center;
}

.header-nav { 
    display: flex;
    align-items: center; 
}

.header-nav .icon-btn {
    background: var(--accent-green); 
    border: none;
    cursor: pointer;
    padding: 0; 
    border-radius: 50%;
    margin: 0 8px; 
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px; 
    height: 38px;
    transition: background-color 0.3s ease;
}

.header-nav .icon-btn img {
    height: 18px; 
    width: 18px;
    filter: brightness(0); 
}
.header-nav .icon-btn:hover {
    background-color: var(--accent-magenta); 
}
.header-nav .icon-btn:hover img {
    filter: brightness(0) invert(1); 
}


/* --- MAIN CONTENT --- */
main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    padding-top: calc(var(--global-top-offset) + var(--header-height-mobile-logo-area) + var(--header-height-mobile-icons) + 5px); 
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 30px; 
    text-align: center;
    box-sizing: border-box;
    width: 100%;
}

#mainContentArea { 
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%; 
    max-width: 800px; 
    box-sizing: border-box; 
}


.thematic-name-outside {
    font-size: 0.85em; 
    font-weight: 600; 
    color: var(--accent-green); 
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px; 
    text-align: center; 
}

.quote-display-area {
    background-color: var(--quote-box-bg); 
    padding: 30px 25px; 
    border-radius: 0 20px 20px 20px; 
    margin-bottom: 30px; 
    width: 100%; 
    box-shadow: inset 0 -8px 24.4px -10px rgba(0,0,0,1); 
    position: relative;
    text-align: left;
    box-sizing: border-box; 
}

img.decorative-quote-mark-svg { 
    width: 80px; 
    height: auto;
    position: absolute;
    top: -15px; 
    left: -10px; 
    opacity: 0.6; 
    z-index: 0;
    user-select: none;
}

.quote-content {
    position: relative;
    z-index: 1;
    min-height: 80px; 
}

.quote-text {
    font-size: 1.7em; 
    font-weight: 500; 
    margin-bottom: 15px; 
    line-height: 1.4;
}

.quote-explanation-content {
    margin-bottom: 25px; 
    position: relative; 
    z-index: 1;
}
.quote-explanation-text {
    font-size: 0.9em;
    font-weight: 300; 
    color: var(--text-color-secondary);
    line-height: 1.5;
    font-style: italic;
    margin: 0;
}


.author-text { 
    font-size: 1.05em; 
    font-weight: 600; 
    color: var(--text-color-primary);
    cursor: pointer;
    display: inline-flex; 
    align-items: center; 
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
    margin-top: 10px; 
    text-decoration: none; 
    border-bottom: 1px solid transparent; 
}
.author-text:hover {
    color: var(--accent-magenta);
    border-bottom-color: var(--accent-magenta); 
}

.author-text .author-info-icon { 
    height: 0.9em; 
    width: auto;
    margin-left: 6px; 
    filter: brightness(0) invert(1); 
    transition: transform 0.3s ease;
    vertical-align: middle; 
}
.author-text:hover .author-info-icon {
    transform: scale(1.1); 
}

.share-button { 
    background-color: var(--accent-green);
    color: var(--bg-color); 
    border: none;
    padding: 12px 30px; 
    font-size: 1em; 
    font-weight: 700; 
    border-radius: 50px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.3s ease, color 0.3s ease;
    text-decoration: none;
}
.share-button img {
    height: 1.2em;
    filter: brightness(0); 
}
.share-button:hover {
    background-color: var(--accent-magenta);
    color: var(--text-color-primary); 
}
.share-button:hover img {
    filter: brightness(0) invert(1); 
}

.loading-message, .error-message {
    font-size: 1.1em; 
    font-weight: 500;
    margin-top: 20px;
    padding: 10px;
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
    box-sizing: border-box;
}
.loading-message { color: var(--text-color-secondary); }
.error-message { color: #FFFFFF; background-color: #c53030; }

/* --- SKELETON LOADER --- */
.skeleton-loader {
    display: flex; 
    flex-direction: column;
    align-items: center;
    width: 100%; 
    max-width: 800px; 
    margin-bottom: 30px; 
    box-sizing: border-box;
}
@keyframes skeleton-pulse {
    0% { background-color: var(--skeleton-bg); }
    50% { background-color: var(--skeleton-highlight); }
    100% { background-color: var(--skeleton-bg); }
}
.skeleton-quote {
    width: 100%;
    height: 80px; 
    background-color: var(--skeleton-bg);
    border-radius: 8px;
    margin-bottom: 10px; 
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-explanation {
    width: 80%; 
    height: 40px; 
    background-color: var(--skeleton-bg);
    border-radius: 6px;
    margin-bottom: 15px;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-author {
    width: 40%; 
    height: 20px; 
    background-color: var(--skeleton-bg);
    border-radius: 4px;
    align-self: flex-start; 
    margin-left: 0; 
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}


/* --- FOOTER --- */
footer {
    text-align: center;
    padding: 20px; 
    width: 100%;
    box-sizing: border-box;
    margin-top: auto; 
}
footer .footer-logo-text {
    font-weight: 600; 
    font-size: 0.9em; 
    color: var(--text-color-secondary); 
    margin-bottom: 3px; 
}
footer .footer-logo-text .logo-green { color: var(--accent-green); }

footer .footer-credits { 
    font-size: 0.8em; 
    font-weight: 400; 
    color: var(--text-color-secondary); 
    margin: 0;
}
footer a { color: var(--accent-green); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* --- OVERLAYS Y MODALS GENERAL --- */
.overlay, .modal {
    display: none; 
    position: fixed;
    z-index: 1000; 
    left: 0;
    top: 0; 
    width: 100%;
    height: 100%;
    background-color: var(--overlay-bg); 
    align-items: center;
    justify-content: center;
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s;
    padding: 20px; 
    box-sizing: border-box;
}
.overlay.active, .modal.active { 
    display: flex; 
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
}
.overlay-content, .modal-content {
    background-color: var(--overlay-surface-color); 
    padding: 25px; 
    border-radius: 25px; 
    border-top-right-radius: 0;  
    width: 90%;
    max-width: calc(100% - 40px); 
    color: var(--text-color-primary);
    position: relative; 
    box-shadow: 0 15px 35px rgba(0,0,0,0.6); 
    text-align: left;
    border: 1.5px solid var(--accent-magenta); 
    max-height: 75vh; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.overlay.active .overlay-content,
.modal.active .modal-content {
    transform: scale(1) translateY(0);
}

.overlay-content h2 { 
    font-size: 1.4em; 
    font-weight: 600; 
    color: var(--text-color-primary); 
    margin-top: 0;
    margin-bottom: 20px; 
    text-align: center;
    letter-spacing: 1.5px; 
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color); 
    flex-shrink: 0; 
}
.overlay-content h2 .logo-green { color: var(--accent-green); }
.overlay-content h2 .logo-zero { font-variant-numeric: slashed-zero; }


.close-overlay-btn { 
    background: transparent; 
    border: none;
    color: var(--text-color-secondary);
    cursor: pointer;
    position: absolute;
    top: 10px;  
    right: 10px; 
    padding: 8px; 
    line-height: 1;
    width: 32px; 
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10; 
    border-radius: 50%; 
    transition: background-color 0.2s ease;
}
.close-overlay-btn:hover { background-color: rgba(255,255,255,0.1); }
.close-overlay-btn img { height: 14px; width: 14px; filter: brightness(0) invert(0.8); }
.close-overlay-btn:hover img { filter: brightness(0) invert(1); }

.overlay-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto; 
    flex-grow: 1; 
}
.overlay-content ul li {
    font-size: 1.1em; 
    font-weight: 500; 
    padding: 12px 10px; 
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: color 0.25s ease, background-color 0.25s ease, padding-left 0.25s ease; 
    color: var(--text-color-secondary);
    border-radius: 8px; 
    margin-bottom: 5px; 
}
.overlay-content ul li:last-child { border-bottom: none; margin-bottom: 0; }
.overlay-content ul li:hover {
    color: var(--accent-green);
    background-color: rgba(0, 204, 102, 0.05); 
    padding-left: 15px; 
}
.overlay-content ul li.active-option { color: var(--accent-green); font-weight: 600; }

.overlay-content ul::-webkit-scrollbar { width: 6px; }
.overlay-content ul::-webkit-scrollbar-track { background: transparent; border-radius: 10px; margin: 5px 0; }
.overlay-content ul::-webkit-scrollbar-thumb { background-color: var(--accent-magenta); border-radius: 10px; }
.overlay-content ul::-webkit-scrollbar-thumb:hover { background-color: #D4007A; }


/* --- NUEVO CALENDARIO PERSONALIZADO --- */
.calendar-overlay-custom .overlay-content.calendar-content-custom {
    background-color: var(--overlay-surface-color); 
    border-color: var(--accent-magenta); 
    max-width: calc(100% - 30px); 
    padding: 15px; 
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px; 
    padding: 0 5px;
}
.calendar-header h3#monthYearDisplay {
    font-size: 1em; 
    font-weight: 500;
    color: var(--text-color-primary);
    margin: 0;
    padding: 0;
    border-bottom: none; 
    letter-spacing: 0.5px;
    text-align: center; 
}
.calendar-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-color-secondary);
    font-size: 1.3em; 
    cursor: pointer;
    padding: 5px; 
    border-radius: 5px;
    transition: color 0.2s ease;
}
.calendar-nav-btn:hover { color: var(--accent-green); }

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.7em; 
    font-weight: 500;
    color: var(--text-color-secondary);
    margin-bottom: 5px; 
    opacity: 0.7;
}
.calendar-weekdays div { padding: 4px 0; }

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px; 
    justify-items: center; 
}
.calendar-days div.calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;  
    height: 30px; 
    font-size: 0.8em; 
    color: var(--text-color-secondary);
    border-radius: 50%; 
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border 0.2s ease, transform 0.1s ease;
    border: 1px solid transparent; 
}
.calendar-days div.calendar-day.other-month {
    color: #4a4a4a; 
    cursor: default;
    opacity: 0.6;
}
.calendar-days div.calendar-day.disabled {
    color: #383838; 
    cursor: not-allowed;
    background-color: transparent !important; 
    opacity: 0.5;
}
.calendar-days div.calendar-day:not(.disabled):not(.other-month):hover {
    background-color: rgba(0, 204, 102, 0.1); 
    color: var(--accent-green);
}
.calendar-days div.calendar-day.today {
    background-color: var(--accent-green);
    color: var(--bg-color) !important; 
    font-weight: 700;
}
.calendar-days div.calendar-day.has-quote {
    background-color: rgba(0, 204, 102, 0.15); 
}
.calendar-days div.calendar-day.has-quote:hover:not(.disabled) {
    background-color: rgba(0, 204, 102, 0.3); 
}
.calendar-days div.calendar-day.selected-for-quote {
    border-color: var(--accent-magenta);
    background-color: rgba(244, 0, 138, 0.1);
    color: var(--accent-magenta);
    transform: scale(1.05);
}

#categoriesOverlay .overlay-content ul::-webkit-scrollbar {
    width: 6px; 
}
#categoriesOverlay .overlay-content ul::-webkit-scrollbar-track {
    background: #111111; 
    border-radius: 3px;
}
#categoriesOverlay .overlay-content ul::-webkit-scrollbar-thumb {
    background-color: #FFFFFF; 
    border-radius: 3px;
}
#categoriesOverlay .overlay-content ul::-webkit-scrollbar-thumb:hover {
    background-color: #e0e0e0; 
}


/* --- ESTILOS MODAL DE AUTOR --- */
.author-modal .overlay-content.author-overlay-content {
    max-width: 580px; 
    padding: 25px; 
    background-color: var(--overlay-surface-color); 
}

.author-modal-layout { 
    display: flex;
    flex-direction: column; 
    align-items: center; 
    gap: 15px; 
}
#authorModalPhoto {
    width: 90px;  
    height: 90px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--accent-magenta); 
    flex-shrink: 0;
    filter: grayscale(100%);
    margin-bottom: 15px; 
}
.author-modal-info-text { 
    flex-grow: 1; 
    text-align: center; 
}
h3#authorModalNameLarge { 
    font-size: 1.7em; 
    font-weight: 700; 
    color: var(--text-color-primary);
    margin: 0 0 2px 0; 
    line-height: 1.1;
    text-align: center; 
}
h3#authorModalNameLarge .logo-green { color: var(--accent-green); }
span#authorModalYears.author-years { 
    font-size: 0.9em;
    font-weight: 400; 
    color: var(--text-color-secondary);
    margin: 0 0 10px 0;
    display: block; 
    text-align: center; 
}
p#authorModalProfessionAndNationality.author-profession-nationality {
    font-size: 1.1em;
    font-weight: 500; 
    color: var(--accent-green); 
    margin: 0 0 15px 0; 
    line-height: 1.3;
    text-align: center; 
}
hr.author-modal-separator {
    border: none;
    height: 1.5px; 
    background-color: var(--accent-magenta);
    margin: 0 0 15px 0; 
    width: 100%; 
}
.author-modal-bio p { 
    font-size: 0.95em;
    font-weight: 300; 
    line-height: 1.7;
    color: var(--text-color-secondary); 
    margin: 0;
    text-align: left; 
}

.lang-en, .lang-es { display: none; }

/* Media Query para Desktop y tablets más grandes */
@media (min-width: 769px) {
    header {
        flex-direction: row; 
        justify-content: space-between; 
        align-items: center; 
        padding: 0 30px; 
        height: var(--header-height-desktop);
    }
    .header-left-placeholder {
        display: block; 
        flex: 1 1 0px; /* Ocupa espacio flexible */
        /* background-color: rgba(255,0,0,0.1);  Para depurar */
    }
    .logo-container {
        /* position: absolute; Quitado */
        /* left: 50%; */
        /* transform: translateX(-50%); */
        flex: 2 1 0px; /* Ocupa más espacio para permitir centrado del contenido */
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 0; 
        height: 100%; 
        /* background-color: rgba(0,255,0,0.1); Para depurar */
    }
    .logo-container img#logo {
        height: 30px;
    }
    .header-subtitle {
        display: block; 
        margin-left: 0; 
        margin-top: 2px; /* Reducido para acercarlo al logo */
        font-size: 0.7em;
        line-height: 1; /* Para que no agregue altura extra */
        position: static; 
        transform: none;
        bottom: auto;
        width: auto; 
        text-align: center;
    }
    .mobile-icons-container {
        /* margin-left: auto; Quitado */
        flex: 1 1 0px; /* Ocupa espacio flexible */
        justify-content: flex-end; /* Alinea nav a la derecha */
        padding-bottom: 0;
        min-height: 0;
        height: 100%; 
        width: auto; 
        display: flex; 
        align-items: center; 
        /* background-color: rgba(0,0,255,0.1); Para depurar */
    }
    .header-nav {
       /* No necesita cambios aquí */
    }
    .header-nav .icon-btn {
        width: 40px;
        height: 40px;
        margin: 0 0 0 15px; 
    }
    .header-nav .icon-btn img {
        height: 18px;
        width: 18px;
    }
    main {
        padding-top: calc(var(--global-top-offset) + var(--header-height-desktop) + 5px); /* Un poco menos de padding, el subtítulo es pequeño */
        padding-left: 30px;
        padding-right: 30px;
        padding-bottom: 30px; 
    }
    
    /* ... (resto de estilos de desktop sin cambios) ... */
    .thematic-name-outside { font-size: 0.9em; }
    .quote-display-area { padding: 40px 50px; margin-bottom: 40px; }
    img.decorative-quote-mark-svg { width: 130px; top: -25px;  left: -20px; }
    .quote-text { font-size: 2.2em; margin-bottom: 20px; }
    .quote-explanation-text { font-size: 1em; }
    .author-text { font-size: 1.2em; }
    .share-button { padding: 15px 40px; font-size: 1.1em; }
    
    .overlay-content, .modal-content {
        padding: 30px 35px;
        max-width: 400px; 
        max-height: 85vh; 
    }
    .overlay-content h2 { font-size: 1.5em; margin-bottom: 25px; }
    
    .skeleton-quote { height: 100px; margin-bottom: 15px; }
    .skeleton-explanation { height: 50px; margin-bottom: 20px;}
    .skeleton-author { height: 24px; margin-left: 0; } 

    .calendar-overlay-custom .overlay-content.calendar-content-custom { max-width: 360px; padding: 20px 25px; max-height: 85vh; }
    .calendar-header h3#monthYearDisplay { font-size: 1.1em; } 
    .calendar-nav-btn { font-size: 1.4em; padding: 5px 8px; }
    .calendar-weekdays { font-size: 0.75em; margin-bottom: 8px; }
    .calendar-days div.calendar-day { width: 34px; height: 34px; font-size: 0.85em; gap: 4px;} 
    
    .author-modal .overlay-content.author-overlay-content { padding: 30px 35px; max-width: 580px; max-height: 85vh;}
    .author-modal-layout { flex-direction: row; align-items: flex-start; gap: 25px; } 
    #authorModalPhoto { margin-bottom: 0; width: 100px; height: 100px; }
    .author-modal-info-text { text-align: left; } 
    h3#authorModalNameLarge { font-size: 2em; text-align: left; }
    span#authorModalYears.author-years,
    p#authorModalProfessionAndNationality.author-profession-nationality { text-align: left; }
}

/* Media Query para móviles muy pequeños */
@media (max-width: 400px) {
    header {
        padding: 5px 15px 0; 
    }
    .logo-container img#logo {
        height: 24px; 
    }
    .header-subtitle {
        font-size: 0.6em; 
        margin-top: 2px;
    }
    .mobile-icons-container {
        padding-bottom: 5px; 
    }
    .header-nav .icon-btn {
        width: 34px;
        height: 34px;
        margin: 0 5px; 
    }
    .header-nav .icon-btn img {
        height: 16px;
        width: 16px;
    }
    main {
        padding-top: calc(var(--global-top-offset) + var(--header-height-mobile-logo-area) + var(--header-height-mobile-icons) + 0px); 
        padding-left: 15px;
        padding-right: 15px;
    }
    img.decorative-quote-mark-svg { width: 60px; top: -10px; left: -5px; }
    .quote-text {font-size: 1.5em;}
    .skeleton-quote { height: 70px; }
    .skeleton-explanation { height: 30px; }
    .skeleton-author { width: 50%; height: 18px; }
    .calendar-days div.calendar-day { width: 28px; height: 28px; font-size: 0.75em; }
    .overlay-content, .modal-content {
        max-height: 80vh; 
    }
}