/* ====== VARIABLES ====== */
:root {
    /* Paleta Light (Clean, Minimalist but Vibrant accents) */
    --bg-color: #FAFAFA;
    --text-color: #111111;
    --text-muted: #555555;
    --surface-color: #FFFFFF;
    --border-color: #E2E8F0;
    --accent-color: #4A90D9;
    --accent-hover: #3A78BF;
    --accent-glow: rgba(74, 144, 217, 0.2);
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* Font sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;
    --text-3xl: 2.5rem;
}

/* Paleta Dark */
html.dark {
    --bg-color: #121212;
    --text-color: #EEEEEE;
    --text-muted: #A0AEC0;
    --surface-color: #1E1E1E;
    --border-color: #2D3748;
    --accent-color: #5FA8EE;
    --accent-hover: #7CB5EE;
    --accent-glow: rgba(95, 168, 238, 0.2);
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.5);
}

/* ====== RESET & BASE ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    line-height: 1.2;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ====== BUTTONS & INPUTS ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: 'DM Sans', sans-serif;
    outline: none;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 2px 10px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.control-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
    font-family: 'DM Sans', sans-serif;
    font-size: var(--text-sm);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
    transition: var(--transition);
}

.control-select:hover {
    border-color: var(--accent-color);
}

/* ====== HEADER ====== */
.site-header {
    background-color: rgba(var(--surface-color), 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 0;
    transition: var(--transition);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'DM Serif Display', serif;
    font-size: var(--text-2xl);
    color: var(--text-color);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lang-selector {
    color: var(--text-muted);
    font-weight: 500;
    font-size: var(--text-sm);
}

.lang-option {
    cursor: pointer;
    transition: var(--transition);
}

.lang-option:hover {
    color: var(--accent-color);
}

.lang-option.active {
    color: var(--accent-color);
    font-weight: 700;
}

#theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

#theme-toggle:hover {
    background-color: var(--border-color);
}

#theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* ====== ADS ====== */
.ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90px;
    margin: 2rem auto;
    background-color: var(--surface-color);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.ad-placeholder-text {
    color: var(--text-muted);
    font-size: var(--text-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-infeed {
    min-height: 250px;
    background-color: var(--surface-color);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ====== LAYOUT ====== */
.main-layout {
    display: flex;
    gap: 2rem;
    flex: 1;
}

.content-area {
    flex: 1;
    min-width: 0;
}

.sidebar-ad {
    width: 300px;
    flex-shrink: 0;
    display: none; /* hidden on small */
}

@media (min-width: 1024px) {
    .sidebar-ad {
        display: block;
    }
}

.ad-sidebar-container {
    width: 300px;
    min-height: 250px;
    background-color: var(--surface-color);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    position: sticky;
    top: 90px;
}

/* ====== YEAR NAV ====== */
.year-header {
    text-align: center;
    margin: 2rem 0;
}

.page-title {
    font-size: var(--text-3xl);
    margin-bottom: 1.5rem;
}

.year-nav {
    display: inline-flex;
    align-items: center;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    padding: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.year-link {
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: 100px;
    transition: var(--transition);
}

.year-link:hover:not(.active):not(.disabled) {
    background-color: var(--border-color);
    color: var(--text-color);
}

.year-link.active {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 10px var(--accent-glow);
}

.year-link.arrow {
    padding: 0.5rem 0.8rem;
    font-size: 1.2rem;
    line-height: 1;
}

.year-link.disabled {
    opacity: 0.3;
    cursor: default;
}

/* ====== GRID & CARDS ====== */
.calendar-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 4rem;
}

@media (min-width: 640px) {
    .calendar-grid { grid-template-columns: repeat(2, 1fr); }
}

/* @media (min-width: 1024px) {
    .calendar-grid { grid-template-columns: repeat(3, 1fr); }
} */

.calendar-card {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.calendar-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-glow);
}

.card-thumb-wrapper {
    position: relative;
    cursor: center;
    overflow: hidden;
    aspect-ratio: 0.707; /* Relación de aspecto A4 (1/1.414) */
    background-color: #f0f0f0;
}

.card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    cursor: pointer;
}

.calendar-card:hover .card-thumb {
    transform: scale(1.05); /* Micro animation */
}

.card-actions {
    padding: 1.2rem;
    display: flex;
    gap: 0.8rem;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
}

.card-actions .btn {
    flex: 1;
}

.download-status {
    padding: 0 1.2rem 1.2rem;
    font-size: var(--text-sm);
    color: #e53e3e; /* error color */
    text-align: center;
    empty-cells: show;
}
.download-status:empty {
    padding: 0;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

/* ====== MODAL ====== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    z-index: 101;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.open .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
}

.modal-close:hover {
    transform: scale(1.1);
}

#modal-image {
    max-width: 100%;
    max-height: calc(90vh - 80px);
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.modal-actions {
    margin-top: 1rem;
    width: 100%;
    text-align: center;
}

/* ====== FOOTER ====== */
.site-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--surface-color);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.footer-seo {
    font-family: 'DM Serif Display', serif;
    font-size: var(--text-lg);
    color: var(--text-color);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* ====== ERROR PAGE ====== */
.error-page {
    text-align: center;
    padding: 6rem 2rem;
}

.error-title {
    font-size: 6rem;
    color: var(--accent-color);
    margin-bottom: 0;
}

.error-subtitle {
    font-size: var(--text-2xl);
    margin-bottom: 1rem;
}

.error-text {
    color: var(--text-muted);
}

/* ====== PRIVACY PAGE ====== */
.content-block {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: var(--shadow-sm);
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.tab-btn {
    background: transparent;
    border: none;
    font-family: 'DM Sans', sans-serif;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.tab-btn:hover {
    background-color: var(--border-color);
}

.tab-btn.active {
    background-color: var(--accent-glow);
    color: var(--accent-color);
}

.tab-content {
    animation: fadeIn 0.4s ease;
}

.tab-content.hidden {
    display: none;
}

.tab-content h1 {
    margin-bottom: 0.5rem;
}

.tab-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: var(--text-xl);
}

.tab-content p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

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