
:root {
    --bg-principal: #ffffff;
    --bg-tarjetas: #f9f9f9;
    --texto-primario: #222222;
    --texto-secundario: #666666;
    --color-borde: #e0e0e0;
    --color-accent: #800000; 
}


[data-theme="dark"] {
    --bg-principal: #121212;    
    --bg-tarjetas: #1e1e1e;       
    --texto-primario: #e0e0e0;    
    --texto-secundario: #a0a0a0;  
    --color-borde: #333333;       
    --color-accent: #ff4d4d;    
}

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



@font-face {
    font-family: 'BlackChancery';
    /* Asegúrate de que la ruta coincida exactamente con dónde guardaron el archivo */
    src: url('../assets/fonts/black_chancery.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    background-color: var(--bg-principal);
    color: var(--texto-primario);
    transition: background-color 0.3s ease, color 0.3s ease; /* Transición suave */
    display: flex;
    flex-direction: column; /* Permite empujar el footer hacia abajo si hay poco contenido */
}

/* Contenedor Único de la SPA */
#app {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1; /* Absorbe el espacio restante manteniendo el footer al fondo */
    width: 100%;
}

#app-container, .main-content {
    background-color: var(--bg-principal);
    color: var(--texto-primario);
}

.department-card, .artwork-card, .home-stat-card, div[style*="border: 1px solid"] {
    background-color: var(--bg-tarjetas) !important;
    color: var(--texto-primario);
    border-color: var(--color-borde) !important;
}

p, span, .meta-row {
    color: var(--texto-secundario);
}

h1, h2, h3 {
    color: var(--texto-primario);
}


h1, h2, h3 {
    font-family: var(--font-serif);
    color: var(--color-text);
    margin-bottom: 20px;
    font-weight: normal;
}

h1 {
    font-size: 2.2rem;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 10px;
}

h2 {
    font-size: 1.6rem;
    margin-top: 20px;
}

/* 4. COMPONENTES GLOBALES (NavBar & Footer) */
header, .main-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-principal);
    box-shadow: 0 4px 6px -2px rgba(0, 0, 0, 0.1); 
    padding: 20px;
    text-align: center;
}

footer, .main-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--color-border);
    padding: 20px;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.9rem;
    margin-top: auto; 
}

/* 5. SECCIÓN DE ESTADÍSTICAS (Home / Explore) */
.stats-section {
    margin-bottom: 30px;
}

.stats-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap; /* Soporte responsivo automático */
}

.stats-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 15px 25px;
    min-width: 200px;
    flex: 1;
}

.stats-card strong {
    font-size: 1.5rem;
    color: var(--color-accent);
    display: block;
}

/* 6. GALERÍA Y REJILLAS DE TARJETAS (Grid Adaptable) */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

/* Tarjetas de Obra Unificadas (Corrección de duplicados) */
.artwork-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 15px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.01);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    flex-direction: column;
}

.artwork-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(142, 36, 36, 0.08);
    border-color: var(--color-accent);
}

/* Elementos internos de las tarjetas */
.artwork-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 4px;
    background-color: #eae6e1;
    margin-bottom: 12px;
}

.artwork-card h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    line-height: 1.3;
}

.artwork-card p {
    font-size: 0.9rem;
    color: var(--color-muted);
}

/* 7. ESTRUCTURAS COMPLEJAS (Detalle y Comparador de 2 Columnas) */
.split-layout {
    display: flex;
    gap: 30px;
    margin-top: 30px;
    width: 100%;
}

.column-left, .column-right {
    flex: 1;
    min-width: 0; /* Evita desbordamientos de cajas flexibles */
    background-color: var(--bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 25px;
}

/* Responsividad para pantallas medianas o móviles */
@media (max-width: 768px) {
    .split-layout {
        flex-direction: column;
    }
}

/* 8. BOTONES, ENLACES Y ACCIONES */
a {
    color: var(--color-accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    text-decoration: underline;
}

button, .btn {
    background-color: var(--color-accent);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 4px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition);
}

button:hover, .btn:hover {
    background-color: #6b1b1b;
}

/* 9. ESTADOS GLOBALES DE LA INTERFAZ */
.loading-state {
    font-style: italic;
    color: var(--color-accent);
    padding: 20px 0;
    text-align: center;
}

.error-state {
    padding: 25px;
    border: 1px dashed var(--color-accent);
    border-radius: 6px;
    background-color: #fff5f5;
    text-align: center;
    margin: 20px 0;
}

.error-state p {
    color: var(--color-accent);
    margin-bottom: 15px;
    font-weight: bold;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.comparison-table td {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
}
.comparison-table .highlight {
    background-color: #fdf2f2; /* Un tono muy suave del acento */
    font-weight: bold;
}


.artwork-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.artwork-card {
    cursor: pointer;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.2s;
}

.artwork-card:hover {
    transform: translateY(-5px);
}

.artwork-image-container img {
    width: 100%;
    height: 200px;
    object-fit: cover; /* Esto hace que todas las imágenes midan lo mismo sin deformarse */
}

/* Contenedor del Detalle */
.artwork-detail-view {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Botón Volver */
.btn-back {
    background-color: #800000; /* Color vino típico del Met */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 25px;
}

.btn-back:hover {
    background-color: #a00000;
}

/* Layout de dos columnas */
.detail-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

/* Columna de la Imagen */
.detail-media-column {
    flex: 1;
    max-width: 50%;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: center;
}

.detail-main-image {
    width: 100%;
    max-height: 600px;
    object-fit: contain; /* Evita que la obra de arte se deforme */
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Columna de Datos */
.detail-info-column {
    flex: 1;
}

.detail-title {
    font-family: serif;
    font-size: 2.2rem;
    margin-top: 0;
    color: #222;
}

.detail-artist {
    font-size: 1.3rem;
    color: #555;
    margin-bottom: 15px;
}

.artist-bio {
    font-size: 1rem;
    font-style: italic;
    color: #777;
}

/* Filas técnicas */
.detail-meta-list {
    margin-top: 20px;
}

.meta-row {
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 10px 0;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 6px;
}

.btn-compare-action {
    background-color: #2a52be; /* Azul elegante de contraste */
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}


.compare-view-container {
    max-width: 1200px;
    margin: 0 auto;
}


.compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.btn-compare-action:hover {
    background-color: #1e3d96;
}


tr.diferente {
    background-color: rgba(255, 165, 0, 0.08);
    border-left: 4px solid orange;           
}


input:disabled, button:disabled {
    background-color: #f0f0f0 !important;
    color: #999999 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
}

.departments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.department-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.department-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}

.dept-card-image img {
    width: 100%;
    height: 180px;
    object-fit: cover; /* Recorta la foto perfectamente al recuadro */
}

.dept-card-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.dept-card-info h3 {
    margin-top: 0;
    font-size: 1.2rem;
    color: #800000; /* Color vino institucional */
}

.dept-card-info p {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.4;
}

.btn-theme-toggle {
    background: transparent;
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-theme-toggle:hover {
    background-color: rgba(128, 0, 0, 0.1); 
    transform: scale(1.05);
}

[data-theme="dark"] .btn-theme-toggle:hover {
    background-color: rgba(255, 77, 77, 0.1);
}
