:root {
    --primary-color: #9C0000;
    --secondary-color: #2c3e50;
    --bg-color: #f8f9fa;
    --text-color: #333;
    --card-bg: #ffffff;
    --cold-color: #3498db;
    --warm-color: #f39c12;
    --hot-color: #e74c3c;
    --hover-color: #7a0000;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 3rem 1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 400;
}

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

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.project-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1), 0 4px 15px -5px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-top: 4px solid var(--primary-color);
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.15);
}

.project-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    min-height: 3.2rem; /* Mantener la alineación si los títulos son largos */
}

.chart-container {
    width: 100%;
    height: 320px;
    margin-bottom: 1rem;
}

.stats {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #edf2f7;
    text-align: left;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.stat-label {
    font-weight: 600;
    color: #718096;
}

.stat-value {
    font-weight: 800;
    color: var(--secondary-color);
    font-size: 1.2rem;
}

.stat-value.current {
    color: var(--primary-color);
    font-size: 1.3rem;
}

.loading {
    text-align: center;
    font-size: 1.2rem;
    color: #a0aec0;
    grid-column: 1 / -1;
    font-weight: 600;
    padding: 3rem 0;
}

.footer {
    text-align: center;
    padding: 2rem;
    background-color: var(--secondary-color);
    color: white;
    margin-top: auto;
}

.footer p {
    margin-bottom: 0.5rem;
    color: #cbd5e0;
}

.admin-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: #a0aec0;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s;
    font-weight: 600;
}

.admin-link:hover {
    color: white;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    .chart-container {
        height: 280px;
    }
    .project-card {
        padding: 1.5rem;
    }
}

/* Nuevos Estilos CTA y Descripción */
.project-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.project-desc {
    color: #555;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    min-height: 4.5rem; /* Para que todas las tarjetas se vean parejas si tienen distinto largo */
}

.cta-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    width: 100%;
}

.cta-button:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
}

/* Modal Estilos */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    padding: 2rem;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--hot-color);
}

.modal-title {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 800;
}

/* Modal Layout de dos columnas */
.modal-large {
    max-width: 900px;
}

.modal-body {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
}

.modal-image-col {
    flex: 1;
    min-width: 300px;
    display: flex;
    justify-content: center;
}

#modalImage {
    width: 100%;
    max-height: 400px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.modal-chart-col {
    flex: 1;
    min-width: 300px;
}

/* Lightbox Estilos */
.project-image {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.project-image:hover {
    transform: scale(1.03);
}

#lightboxModal {
    z-index: 2000;
}

#lightboxModal .modal-close {
    color: #fff;
    font-size: 2.5rem;
    top: 20px;
    right: 30px;
}

#lightboxModal .modal-close:hover {
    color: var(--hot-color);
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
