/* ==========================================================================
   SISTEMA DE ESTILOS OVO CONTROL PRO (NIGHT MODE)
   ========================================================================== */

:root {
    --bg-primary: #070a13;
    --bg-secondary: #0f1424;
    --bg-card: rgba(21, 28, 50, 0.7);
    --bg-header: rgba(15, 20, 36, 0.85);
    --bg-input: #1b233d;
    --border-color: rgba(255, 255, 255, 0.07);
    --border-active: rgba(0, 242, 254, 0.4);
    
    /* Accents & States */
    --accent-cyan: #00f2fe;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    
    /* Text */
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --text-inactive: #475569;
    
    /* Shadows & Effects */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 15px rgba(0, 242, 254, 0.3);
    --shadow-glow-red: 0 0 15px rgba(239, 68, 68, 0.4);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    min-height: 100vh;
}

/* Layout Container */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* ==========================================================================
   1. BARRA LATERAL (SIDEBAR)
   ========================================================================== */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.glow-icon {
    color: #ffffff;
    width: 22px;
    height: 22px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1.5px;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtitle {
    font-size: 10px;
    color: var(--accent-cyan);
    font-weight: 600;
    letter-spacing: 2px;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-fast);
}

.nav-btn i {
    width: 20px;
    height: 20px;
}

.nav-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-btn.active {
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.08), rgba(59, 130, 246, 0.08));
    border-color: rgba(0, 242, 254, 0.2);
    box-shadow: inset 0 0 10px rgba(0, 242, 254, 0.03);
}

.nav-btn.active i {
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 5px rgba(0, 242, 254, 0.5));
}

.badge {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.badge-info {
    background-color: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-accent {
    background: rgba(0, 242, 254, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 254, 0.3);
}

.animate-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse 1.5s infinite;
}

.status-indicator.offline {
    background-color: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

.status-info {
    display: flex;
    flex-direction: column;
}

.status-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-time {
    font-size: 10px;
    color: var(--text-muted);
}


/* ==========================================================================
   2. CONTENIDO PRINCIPAL & CABECERA
   ========================================================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.app-header {
    height: 70px;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 9;
}

.header-search {
    position: relative;
    width: 320px;
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.header-search input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px 10px 40px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition-fast);
}

.header-search input:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-btn {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

.header-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--accent-red);
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-secondary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 20px;
    border-left: 1px solid var(--border-color);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
    color: var(--accent-cyan);
}

/* ==========================================================================
   3. DROPDOWNS Y ALERTAS
   ========================================================================== */
.notification-dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    width: 350px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    z-index: 100;
    overflow: hidden;
}

.dropdown-content.show {
    display: block;
    animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.dropdown-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-header h3 {
    font-size: 14px;
    font-weight: 600;
}

.clear-btn {
    background: transparent;
    border: none;
    color: var(--accent-cyan);
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
    list-style: none;
}

.notification-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    transition: var(--transition-fast);
}

.notification-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.notification-item.unread {
    background-color: rgba(0, 242, 254, 0.02);
}

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-icon.danger { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.notif-icon.warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-orange); }
.notif-icon.success { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }

.notif-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notif-text {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.4;
}

.notif-time {
    font-size: 10px;
    color: var(--text-muted);
}


/* ==========================================================================
   4. BODY DE SECCIONES (SPA)
   ========================================================================== */
.content-body {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.content-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.content-section.active {
    display: block;
}

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

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.section-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.section-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.date-badge {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
}

.date-badge i {
    color: var(--accent-cyan);
    width: 16px;
    height: 16px;
}


/* ==========================================================================
   5. TARJETAS DE MÉTRICAS (STATS GRID)
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-md);
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon-wrapper i {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

.stat-icon-wrapper.bg-blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-icon-wrapper.bg-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon-wrapper.bg-green { background: linear-gradient(135deg, #10b981, #047857); }
.stat-icon-wrapper.bg-purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }

.stat-data {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-trend {
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-trend i {
    width: 12px;
    height: 12px;
}

.trend-up { color: var(--accent-green); }
.trend-down { color: var(--accent-red); }
.trend-stable { color: var(--text-muted); }


/* ==========================================================================
   6. GRID DEL DASHBOARD (DISEÑO MULTICOLUMNA)
   ========================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
}

.dashboard-left, .dashboard-right {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Tarjeta General (Card Panel) */
.panel-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.panel-actions {
    display: flex;
    gap: 6px;
}

.btn-sm {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-sm.active, .btn-sm:hover {
    background-color: var(--accent-cyan);
    color: var(--bg-primary);
    border-color: var(--accent-cyan);
}

.chart-container {
    height: 260px;
    position: relative;
    width: 100%;
}

.chart-container-donut {
    height: 190px;
    position: relative;
    width: 100%;
    margin-bottom: 12px;
}

/* Donut Legend */
.donut-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-val {
    margin-left: auto;
    font-weight: 600;
    color: var(--text-primary);
}


/* ==========================================================================
   7. LISTAS Y TABLAS MINI EN EL DASHBOARD
   ========================================================================== */
.mini-incubators-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mini-inc-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    justify-content: space-between;
    transition: var(--transition-fast);
}

.mini-inc-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.mini-inc-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
}

.mini-inc-name i {
    width: 16px;
    height: 16px;
    color: var(--accent-cyan);
}

.mini-inc-spec {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.mini-inc-progress-bar {
    width: 120px;
    height: 6px;
    background-color: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.mini-inc-progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent-blue), var(--accent-cyan));
    border-radius: 3px;
}

.mini-inc-temp, .mini-inc-hum {
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 3px;
}

.mini-inc-temp.alarm, .mini-inc-hum.alarm {
    color: var(--accent-red);
    animation: flashRed 1s infinite alternate;
}

@keyframes flashRed {
    from { opacity: 0.7; text-shadow: 0 0 2px rgba(239, 68, 68, 0.2); }
    to { opacity: 1; text-shadow: 0 0 8px rgba(239, 68, 68, 0.8); }
}

/* Alert Feed */
.alert-feed-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.feed-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: rgba(239, 68, 68, 0.05);
    border-left: 3px solid var(--accent-red);
    border-radius: 0 6px 6px 0;
    font-size: 12px;
}

.feed-item.warning {
    background: rgba(245, 158, 11, 0.05);
    border-left-color: var(--accent-orange);
}

.feed-item.info {
    background: rgba(59, 130, 246, 0.05);
    border-left-color: var(--accent-blue);
}

.feed-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feed-title {
    font-weight: 600;
}

.feed-time {
    font-size: 10px;
    color: var(--text-muted);
}


/* ==========================================================================
   8. SECCIÓN ANIMALES (DATATABLE & TABS)
   ========================================================================== */
.filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.filter-tab {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.filter-tab:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.filter-tab.active {
    background-color: var(--accent-cyan);
    color: var(--bg-primary);
    border-color: var(--accent-cyan);
    font-weight: 600;
    box-shadow: var(--shadow-glow);
}

/* Tabla de Datos Moderno */
.table-panel {
    padding: 0;
    overflow: hidden;
}

.table-toolbar {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px;
    height: 16px;
}

.search-box input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px 8px 36px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.toolbar-actions select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.table th, .table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: rgba(255, 255, 255, 0.01);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 1.2px;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

.status-pill {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.status-pill.excelente { background-color: rgba(16, 185, 129, 0.12); color: var(--accent-green); }
.status-pill.gestacion { background-color: rgba(139, 92, 246, 0.12); color: var(--accent-purple); }
.status-pill.produccion { background-color: rgba(59, 130, 246, 0.12); color: var(--accent-blue); }
.status-pill.enfermo { background-color: rgba(239, 68, 68, 0.12); color: var(--accent-red); }

.tag-species {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}


/* ==========================================================================
   9. SECCIÓN INCUBADORAS (VISTA REMOTA COMPLETA Y SIMULACIÓN)
   ========================================================================== */
.preset-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preset-selector-wrapper label {
    font-size: 13px;
    color: var(--text-muted);
}

.preset-selector-wrapper select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    outline: none;
}

/* Panel Control Simulación */
.simulation-control-panel {
    background: linear-gradient(135deg, rgba(21, 28, 50, 0.8), rgba(10, 15, 30, 0.8));
    border-color: rgba(0, 242, 254, 0.15);
    margin-bottom: 24px;
}

.sim-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.sim-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
}

.sim-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    align-items: center;
}

.control-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-box label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-wrapper input[type="range"] {
    flex: 1;
    accent-color: var(--accent-cyan);
}

.slider-wrapper span {
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
    min-width: 60px;
    text-align: right;
}

.help-text {
    font-size: 10px;
    color: var(--text-muted);
}

/* Grid de Incubadoras */
.incubators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

/* Tarjeta Incubadora Premium */
.incubator-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.incubator-card.alarm-active {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: var(--shadow-glow-red);
}

.incubator-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.inc-info {
    display: flex;
    flex-direction: column;
}

.inc-title {
    font-size: 16px;
    font-weight: 700;
}

.inc-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Indicadores de Sensores (Medidores circulares o numéricos) */
.inc-sensors-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.sensor-widget {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.sensor-icon {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.sensor-lbl {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.sensor-val {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 4px 0;
}

.sensor-val.temp-color { color: var(--accent-cyan); }
.sensor-val.hum-color { color: var(--accent-blue); }

.sensor-target {
    font-size: 10px;
    color: var(--text-muted);
}

/* Controles Remotos Integrados */
.inc-controls {
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.inc-controls-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-cyan);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.ctrl-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.ctrl-item:last-child {
    margin-bottom: 0;
}

.ctrl-lbl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 500;
}

.ctrl-val {
    font-family: monospace;
    font-weight: 700;
}

.ctrl-item input[type="range"] {
    width: 100%;
    accent-color: var(--accent-cyan);
    height: 4px;
    border-radius: 2px;
    outline: none;
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
}

.switch-label i {
    width: 16px;
    height: 16px;
}

/* Switch styling */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-input);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-primary);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-green);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Gráfico de Incubadora Individual */
.inc-chart-box {
    height: 100px;
    position: relative;
    width: 100%;
}


/* ==========================================================================
   10. SECCIÓN PRODUCCIÓN (FORMULARIO Y GRID DE ENTRADA)
   ========================================================================== */
.grid-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input, .form-group select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition-fast);
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--border-active);
}

.form-divider {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 10px 0;
}

.form-section-title {
    font-size: 13px;
    color: var(--accent-cyan);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.egg-grid-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.egg-input {
    text-align: center;
    font-weight: 700;
}

.total-group {
    grid-column: span 3;
}

.egg-input-total {
    background-color: rgba(0, 242, 254, 0.05) !important;
    border-color: var(--border-active) !important;
    font-weight: 800;
    font-size: 16px !important;
    text-align: center;
    color: var(--accent-cyan) !important;
}

.mini-table {
    max-height: 190px;
    overflow-y: auto;
}

.mini-table table {
    font-size: 12px;
}

.mini-table th, .mini-table td {
    padding: 10px 12px;
}


/* ==========================================================================
   11. CONFIGURACIÓN & AJUSTES
   ========================================================================== */
.settings-group {
    background-color: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.settings-group h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--accent-cyan);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-cyan);
}

.checkbox-wrapper label {
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.max-width-md {
    max-width: 600px;
}

.button-row {
    display: flex;
    gap: 10px;
}


/* ==========================================================================
   12. ELEMENTOS COMUNES Y COMPONENTES (BOTONES, MODALES)
   ========================================================================== */
/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--accent-blue);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: var(--bg-primary);
    font-weight: 700;
    box-shadow: var(--shadow-glow);
}

.btn-accent:hover {
    filter: brightness(1.1);
}

.btn-secondary {
    background-color: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background-color: var(--accent-red);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-block {
    width: 100%;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--accent-cyan);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

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

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 500px;
    max-width: 90%;
    box-shadow: var(--shadow-md);
    transform: translateY(-20px);
    transition: var(--transition-normal);
}

.modal-overlay.show .modal-container {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Utilidades generales */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.text-accent { color: var(--accent-cyan); }

/* Rotador de huevos animación */
.rotate-animation {
    animation: spin 3s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Alarm alert visual flash on incubator card */
.glow-red-card {
    animation: flashRedBorder 1.5s infinite alternate;
}

@keyframes flashRedBorder {
    from {
        border-color: rgba(239, 68, 68, 0.3);
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
    }
    to {
        border-color: rgba(239, 68, 68, 0.8);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
    }
}
