/* 
 * Atlas Sensorial del Café de Sumapaz - Estilos CSS
 * Informe Visual Interactivo
 * Versión: 4.0
 */

:root {
    --primary: #5D4037;
    --secondary: #8D6E63;
    --accent: #D7CCC8;
    --light: #EFEBE9;
    --dark: #3E2723;
    --text: #212121;
    --gold: #D4AF37;
    --green: #4CAF50;
    --blue: #2196F3;
    --red: #FF6B6B;
    --teal: #4ECDC4;
    --light-blue: #45B7D1;
    --white: #FFFFFF;
}

/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--dark), var(--primary));
    color: white;
    padding: 2rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    backdrop-filter: blur(10px);
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.header-title {
    text-align: center;
    flex-grow: 1;
}

.header-title h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.header-title p {
    opacity: 0.9;
    font-size: 1.1rem;
}

.logo-small {
    max-width: 80px;
}

/* Container principal */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Grid de estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: white;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Playfair Display', serif;
}

.stat-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--secondary);
    margin-top: 0.5rem;
}

.stat-sublabel {
    font-size: 0.85rem;
    color: var(--secondary);
    opacity: 0.8;
    margin-top: 0.3rem;
}

/* Secciones de análisis */
.analysis-section {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* Grid de gráficos */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.chart-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.chart-wrapper {
    position: relative;
    height: 400px;
}

/* Mapa interactivo */
.map-wrapper {
    height: 500px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    background: #f8f9fa;
}

#mapContainer {
    height: 100%;
    width: 100%;
}

/* Leyenda del mapa */
.legend {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--light);
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Tabs de variedades */
.variety-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.variety-tab {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 25px;
    background: var(--light);
    color: var(--dark);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.variety-tab.active {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(93, 64, 55, 0.3);
}

.variety-tab:hover {
    background: var(--secondary);
    color: white;
    transform: translateY(-2px);
}

/* Nube de palabras */
.word-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    padding: 2rem;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 15px;
    border: 2px dashed var(--accent);
}

.word-item {
    padding: 0.4rem 1rem;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
}

.word-item:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* Tarjetas de información */
.info-card {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 15px;
    border-left: 4px solid var(--primary);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.info-card h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    padding: 0.3rem 0;
    color: var(--text);
    position: relative;
    padding-left: 1.2rem;
}

.info-card li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* Botones de exportación */
.export-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 1rem;
    box-shadow: 0 8px 25px rgba(93, 64, 55, 0.3);
}

.btn:hover {
    background: linear-gradient(135deg, var(--dark), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(93, 64, 55, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
    color: var(--dark);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #bdbdbd, #9e9e9e);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--dark), var(--primary));
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
}

footer p {
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

/* Estados de error y carga */
.error-container {
    text-align: center;
    padding: 4rem 2rem;
}

.error-message {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 0 auto;
}

.error-message i {
    font-size: 4rem;
    color: #f44336;
    margin-bottom: 1rem;
}

.error-message h3 {
    color: var(--dark);
    margin-bottom: 1rem;
}

.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--accent);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Personalización de Leaflet */
.leaflet-popup-content-wrapper {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.leaflet-popup-content {
    margin: 1rem;
    font-family: 'Poppins', sans-serif;
}

.leaflet-popup-tip {
    background: white;
}

/* Tooltips */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 1000;
    max-width: 200px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        max-width: 1000px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .back-btn {
        align-self: flex-start;
    }

    .header-title h1 {
        font-size: 2rem;
    }

    .container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1.5rem;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .chart-wrapper {
        height: 300px;
    }

    .map-wrapper {
        height: 400px;
    }

    .chart-container {
        padding: 1rem;
    }

    .analysis-section {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .variety-tabs {
        flex-direction: column;
        align-items: center;
    }

    .variety-tab {
        width: 100%;
        max-width: 250px;
        text-align: center;
    }

    .word-cloud {
        padding: 1rem;
        min-height: 250px;
    }

    .export-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    .legend {
        justify-content: center;
    }

    .legend-item {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-title h1 {
        font-size: 1.8rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .chart-wrapper {
        height: 250px;
    }

    .map-wrapper {
        height: 300px;
    }

    .word-cloud {
        gap: 0.5rem;
        padding: 0.8rem;
    }

    .word-item {
        padding: 0.3rem 0.8rem;
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Estados de focus para accesibilidad */
.btn:focus,
.back-btn:focus,
.variety-tab:focus {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Modo oscuro (opcional) */
@media (prefers-color-scheme: dark) {
    :root {
        --text: #e0e0e0;
        --background: #121212;
    }
    
    body {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    }
    
    .analysis-section,
    .chart-container,
    .stat-card {
        background: #2d2d2d;
        color: #e0e0e0;
    }
}

/* Estilos para impresión */
@media print {
    header,
    footer,
    .export-buttons,
    .back-btn {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .chart-container,
    .analysis-section,
    .stat-card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .map-wrapper {
        height: 400px;
        border: 2px solid #ddd;
    }
    
    .word-cloud {
        border: 1px solid #ddd;
    }
}

/* Efectos especiales para elementos interactivos */
.interactive-element {
    position: relative;
    overflow: hidden;
}

.interactive-element::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.interactive-element:hover::before {
    left: 100%;
}

/* Animaciones para elementos del mapa */
.map-marker-animation {
    animation: pulse 2s infinite;
}

/* Estilos para notificaciones */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 300px;
    max-width: 500px;
    border-left: 4px solid var(--primary);
}

.notification.success {
    border-left-color: var(--green);
}

.notification.error {
    border-left-color: #f44336;
}

.notification.warning {
    border-left-color: #ff9800;
}

/* Efectos de hover para tarjetas */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}