/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* Dashboard Layout */
.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 2rem;
    color: #2d5016;
    background: linear-gradient(135deg, #4CAF50, #2d5016);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d5016;
    letter-spacing: -0.5px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.date-time {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.status-indicator span {
    font-size: 0.85rem;
    color: #4CAF50;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* KPI Section */
.kpi-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4CAF50, #2d5016);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4CAF50, #2d5016);
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.kpi-icon.oil {
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

.kpi-icon.money {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
}

.kpi-icon.efficiency {
    background: linear-gradient(135deg, #2196F3, #1565C0);
}

.kpi-content {
    flex: 1;
}

.kpi-content h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.kpi-value .unit {
    font-size: 1rem;
    color: #666;
    font-weight: 400;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #4CAF50;
}

.kpi-trend.negative {
    color: #f44336;
}

.kpi-trend i {
    font-size: 0.7rem;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-secondary {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
}

.btn-secondary:hover,
.btn-secondary.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* Fruit Classification */
.fruit-classification {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.fruit-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.fruit-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.fruit-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fruit-color.verde {
    background: #4CAF50;
}

.fruit-color.maduro {
    background: #FF9800;
}

.fruit-color.sobremaduro {
    background: #FF5722;
}

.fruit-color.podrido {
    background: #795548;
}

.fruit-label {
    flex: 1;
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

.fruit-percentage {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.fruit-chart {
    display: flex;
    justify-content: center;
    align-items: center;
}

.production-chart {
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Data Table Section */
.data-table-section {
    margin-bottom: 2rem;
}

.table-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #4CAF50, #2d5016);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: #f8f9fa;
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
    color: #666;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: rgba(76, 175, 80, 0.05);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .kpi-section {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .fruit-classification {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .kpi-value {
        font-size: 1.5rem;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .chart-controls {
        justify-content: center;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(76, 175, 80, 0.3);
    border-radius: 50%;
    border-top-color: #4CAF50;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Smooth transitions for all interactive elements */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

/* Minimal guard to prevent flicker while JS removes column */
table thead th:last-child,
table tbody td:last-child { visibility: visible; } /* keep visible; JS does the removal */

/* === LOGOS HEADER — OVERRIDE FINAL === */
:root{
  /* tamaños que TÚ controlas */
  --arbquin-h-desktop: 50px;         /* ArbQuin escritorio */
  --guaicaramo-h-desktop: 28px;      /* Guaicaramo escritorio */
  --guaicaramo-maxw-desktop: 180px;  /* ancho máx Guaicaramo escritorio */

  --arbquin-h-mobile: 35px;          /* ArbQuin móvil */
  --guaicaramo-h-mobile: 20px;       /* Guaicaramo móvil */
  --guaicaramo-maxw-mobile: 120px;   /* ancho máx Guaicaramo móvil */
}

/* 1) Neutraliza reglas globales que encogen/estiran las <img> del header */
.header .logo img,
.logo .brand-img{
  width: auto !important;
  height: auto !important;
  max-height: none !important;   /* <- quita el tope de 40px */
  object-fit: contain;
  display: block;
}

/* 2) Aplica los tamaños QUE QUIERES (más específico) */
.logo .brand-img.brand-arbquin{
  height: var(--arbquin-h-desktop) !important;
}
.logo .brand-img.brand-guaicaramo{
  height: var(--guaicaramo-h-desktop) !important;
  max-width: var(--guaicaramo-maxw-desktop) !important;
}

/* 3) Asegura que el header tenga altura suficiente */
.header{
  min-height: calc(max(56px, var(--arbquin-h-desktop) + 12px));
}

/* 4) Responsive: reduce en móvil para que no “reviente” */
@media (max-width: 720px){
  .logo .brand-img.brand-arbquin{
    height: var(--arbquin-h-mobile) !important;
  }
  .logo .brand-img.brand-guaicaramo{
    height: var(--guaicaramo-h-mobile) !important;
    max-width: var(--guaicaramo-maxw-mobile) !important;
  }
}

@media (max-width: 520px){
  /* Si el espacio sigue justo, puedes ocultar el texto "Data Palm" */
  /* .logo h1{ display:none; } */
}

/* =========== INICIO DEL NUEVO CÓDIGO =========== */
.variety-classification {
    border-top: 1px solid #e0e0e0;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.variety-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.variety-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.variety-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}
/* =========== FIN DEL NUEVO CÓDIGO =========== */