/* Energia 360 Web - Stylesheet */
/* ═══ TEMA CLARO (default) ═══ */
:root, .tema-claro {
    --e360-dark: #1a1d21;
    --e360-sidebar: #212529;
    --e360-navbar: #212529;
    --e360-primary: #0d6efd;
    --e360-accent: #ffc107;
    --e360-bg: #f0f2f5;
    --e360-card: #ffffff;
    --e360-text: #1a1a1a;
    --e360-text-muted: #5a5a5a;
    --e360-border: #dee2e6;
    --e360-table-head: #212529;
    --e360-table-head-text: #fff;
    --e360-table-hover: #f8f9fa;
    --sidebar-width: 250px;
    --sidebar-text: #adb5bd;
    --sidebar-hover: rgba(255,255,255,0.08);
}

/* ═══ TEMA OSCURO ═══ */
.tema-oscuro {
    --e360-dark: #0d1117;
    --e360-sidebar: #161b22;
    --e360-navbar: #161b22;
    --e360-primary: #58a6ff;
    --e360-accent: #f0b429;
    --e360-bg: #0d1117;
    --e360-card: #161b22;
    --e360-text: #e6edf3;
    --e360-text-muted: #8b949e;
    --e360-border: #30363d;
    --e360-table-head: #21262d;
    --e360-table-head-text: #e6edf3;
    --e360-table-hover: #1c2128;
    --sidebar-text: #8b949e;
    --sidebar-hover: rgba(255,255,255,0.06);
}

/* ═══ TEMA AZUL PROFESIONAL ═══ */
.tema-azul {
    --e360-dark: #0a1628;
    --e360-sidebar: #0f2440;
    --e360-navbar: #0f2440;
    --e360-primary: #2e75b6;
    --e360-accent: #f0b429;
    --e360-bg: #e8eef5;
    --e360-card: #ffffff;
    --e360-text: #1a2a3a;
    --e360-text-muted: #5a7a9a;
    --e360-border: #c4d4e8;
    --e360-table-head: #0f2440;
    --e360-table-head-text: #fff;
    --e360-table-hover: #dde8f4;
    --sidebar-text: #8fabc8;
    --sidebar-hover: rgba(255,255,255,0.1);
}

/* ═══ BASE STYLES ═══ */
body {
    background-color: var(--e360-bg) !important;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--e360-text) !important;
}

/* Force text colors globally */
p, span:not(.badge), div, li, label, td, th,
h1, h2, h3, h4, h5, h6 { color: inherit; }

/* Navbar */
.e360-navbar { background: var(--e360-navbar) !important; }

/* Sidebar */
.e360-sidebar {
    width: var(--sidebar-width);
    min-height: calc(100vh - 56px);
    background: var(--e360-sidebar) !important;
    position: sticky; top: 56px;
    overflow-y: auto;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 8px;
    color: var(--sidebar-text) !important; text-decoration: none; font-size: 0.9rem;
    transition: all 0.2s;
}
.sidebar-link:hover, .sidebar-link.active { background: var(--sidebar-hover); color: #fff !important; }
.sidebar-link.active { border-left: 3px solid var(--e360-accent); }
.sidebar-section {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--e360-text-muted); padding: 16px 14px 6px; font-weight: 700;
}

/* Main */
.e360-main { min-height: calc(100vh - 56px); }

/* KPI Cards */
.kpi-card {
    border: none; border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); background: var(--e360-card) !important;
    transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.kpi-card .card-body { padding: 1.25rem; }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.kpi-value { font-size: 1.8rem; font-weight: 700; line-height: 1; color: var(--e360-text) !important; }
.kpi-label { font-size: 0.8rem; color: var(--e360-text-muted) !important; text-transform: uppercase; letter-spacing: 0.5px; }

/* Pipeline */
.pipeline-column { min-width: 280px; max-width: 320px; flex-shrink: 0; }
.pipeline-header { padding: 12px 16px; border-radius: 10px 10px 0 0; color: #fff; font-weight: 600; }
.pipeline-card {
    background: var(--e360-card) !important; border-radius: 8px; padding: 14px;
    margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border-left: 3px solid transparent; transition: box-shadow 0.2s;
    cursor: grab;
}
.pipeline-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.pipeline-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.pipeline-body { min-height: 200px; transition: background 0.2s; }
.pipeline-body.drag-over { background: rgba(13,110,253,0.08); border-radius: 0 0 10px 10px; }

/* Tables */
.table-e360 { border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.table-e360 thead { background: var(--e360-table-head) !important; color: var(--e360-table-head-text) !important; }
.table-e360 thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; padding: 12px; border: none; color: var(--e360-table-head-text) !important; }
.table-e360 tbody tr:hover { background: var(--e360-table-hover) !important; }
.table-e360 td { vertical-align: middle; padding: 10px 12px; }

/* Detail pages */
.detail-header { background: linear-gradient(135deg, #1a1d21 0%, #2c3e50 100%); color: #fff !important; border-radius: 12px; padding: 2rem; margin-bottom: 1.5rem; }
.detail-header * { color: #fff !important; }
.detail-header .badge { font-size: 0.85rem; }
.info-card { background: var(--e360-card) !important; border-radius: 12px; padding: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 1.5rem; border: 1px solid var(--e360-border); }
.info-label { font-size: 0.75rem; text-transform: uppercase; color: var(--e360-text-muted) !important; letter-spacing: 0.5px; margin-bottom: 2px; }
.info-value { font-weight: 600; color: var(--e360-text) !important; }

/* Forms */
.form-card { background: var(--e360-card) !important; border-radius: 12px; padding: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border: 1px solid var(--e360-border); }

/* Cards generic */
.card { background: var(--e360-card) !important; border-color: var(--e360-border) !important; }

/* ═══ TEMA OSCURO - Specific overrides ═══ */
.tema-oscuro .form-control, .tema-oscuro .form-select {
    background-color: #0d1117 !important; color: #e6edf3 !important; border-color: #30363d !important;
}
.tema-oscuro .form-control:focus, .tema-oscuro .form-select:focus {
    background-color: #0d1117 !important; color: #e6edf3 !important; border-color: #58a6ff !important;
    box-shadow: 0 0 0 0.25rem rgba(88,166,255,0.25);
}
.tema-oscuro .form-control::placeholder { color: #484f58; }
.tema-oscuro .table { color: var(--e360-text) !important; --bs-table-bg: transparent; }
.tema-oscuro .table-bordered { border-color: var(--e360-border) !important; }
.tema-oscuro .table-bordered td, .tema-oscuro .table-bordered th { border-color: var(--e360-border) !important; }
.tema-oscuro .table-light { background-color: #21262d !important; color: var(--e360-text) !important; --bs-table-bg: #21262d; }
.tema-oscuro .table-light th { color: var(--e360-text) !important; }
.tema-oscuro .bg-light { background-color: #161b22 !important; }
.tema-oscuro .text-dark { color: var(--e360-text) !important; }
.tema-oscuro .text-muted { color: var(--e360-text-muted) !important; }
.tema-oscuro .dropdown-menu { background: #21262d !important; border-color: #30363d !important; }
.tema-oscuro .dropdown-item { color: #e6edf3 !important; }
.tema-oscuro .dropdown-item:hover { background: #30363d !important; color: #fff !important; }
.tema-oscuro .alert-info { background: #0d2847 !important; color: #58a6ff !important; border-color: #1f3d5a !important; }
.tema-oscuro .alert-success { background: #0d2d1b !important; color: #3fb950 !important; border-color: #1a4d2e !important; }
.tema-oscuro .alert-warning { background: #2d2200 !important; color: #d29922 !important; border-color: #4d3800 !important; }
.tema-oscuro .alert-danger { background: #3d0a0a !important; color: #f85149 !important; border-color: #5a1a1a !important; }
.tema-oscuro hr { border-color: var(--e360-border) !important; }
.tema-oscuro .modal-content { background: #161b22 !important; border-color: #30363d !important; }
.tema-oscuro .btn-outline-secondary { color: #8b949e; border-color: #30363d; }
.tema-oscuro .btn-outline-secondary:hover { background: #30363d; color: #e6edf3; }
.tema-oscuro .offcanvas { background: #161b22 !important; color: #e6edf3; }
.tema-oscuro .badge.bg-secondary { background-color: #30363d !important; }
.tema-oscuro .badge.bg-light { background-color: #21262d !important; color: #e6edf3 !important; }
.tema-oscuro a:not(.btn):not(.sidebar-link):not(.badge) { color: #58a6ff; }
.tema-oscuro a:not(.btn):not(.sidebar-link):not(.badge):hover { color: #79b8ff; }
.tema-oscuro .btn-light { background: #21262d; border-color: #30363d; color: #e6edf3; }
.tema-oscuro .btn-light:hover { background: #30363d; color: #fff; }
.tema-oscuro .contacto-search-results .search-item { color: #e6edf3; }

/* Badges */
.badge-borrador { background: #6c757d; }
.badge-enviada, .badge-programada { background: #0dcaf0; color: #000; }
.badge-confirmada, .badge-confirmado { background: #198754; }
.badge-en_progreso, .badge-en_camino, .badge-en_sitio { background: #0d6efd; }
.badge-pausado { background: #ffc107; color: #000; }
.badge-completada, .badge-completado { background: #20c997; }
.badge-cancelada, .badge-cancelado { background: #dc3545; }
.badge-operativo { background: #198754; }
.badge-falla { background: #dc3545; }
.badge-mantenimiento { background: #fd7e14; }
.badge-retirado { background: #6c757d; }
.badge-disponible { background: #198754; }
.badge-en_uso { background: #0d6efd; }
.badge-baja { background: #6c757d; }

/* Progress */
.progress-e360 { height: 8px; border-radius: 4px; background: #e9ecef; }
.progress-e360 .progress-bar { border-radius: 4px; }

/* Auth pages */
.auth-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a1d21 0%, #2c3e50 100%); }
.auth-card { background: #fff; border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.auth-card, .auth-card h3, .auth-card p, .auth-card label, .auth-card span { color: #1a1a1a !important; }

/* Contact search autocomplete */
.contacto-search-wrapper { position: relative; }
.contacto-search-results {
    position: absolute; z-index: 1000; width: 100%; max-height: 250px;
    overflow-y: auto; background: var(--e360-card); border: 1px solid var(--e360-border);
    border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); display: none;
}
.contacto-search-results .search-item {
    padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--e360-border);
}
.contacto-search-results .search-item:hover { background: var(--e360-table-hover); }
.contacto-search-results .search-item:last-child { border-bottom: none; }

/* ASIAH branding */
.asiah-brand { font-size: 0.65rem; color: var(--e360-text-muted); }

/* Print */
@media print {
    .e360-sidebar, .navbar, .e360-navbar, .btn, .offcanvas { display: none !important; }
    .e360-main { margin: 0 !important; padding: 0 !important; }
}

/* Responsive */
@media (max-width: 991.98px) {
    .e360-main { padding: 1rem !important; }
}
