/**
 * OH Hidráulica - Estilos del Centro de Control y Seguimiento (control-center.css)
 * Ubicación: Admin control center/control-center.css
 * Diseño Ejecutivo Exclusivo para el Super Administrador
 */

:root {
    --cc-bg-main: #f1f5f9;
    --cc-bg-card: #ffffff;
    --cc-navy: #0a2540;
    --cc-navy-light: #123e6e;
    --cc-blue: #1E60A8;
    --cc-cyan: #0ea5e9;
    --cc-cyan-soft: #e0f2fe;
    --cc-emerald: #10b981;
    --cc-emerald-soft: #dcfce7;
    --cc-amber: #f59e0b;
    --cc-amber-soft: #fef3c7;
    --cc-rose: #ef4444;
    --cc-rose-soft: #fee2e2;
    --cc-purple: #8b5cf6;
    --cc-purple-soft: #ede9fe;
    --cc-text-dark: #0f172a;
    --cc-text-body: #334155;
    --cc-text-muted: #64748b;
    --cc-border: #e2e8f0;
    --cc-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --cc-shadow-md: 0 8px 24px rgba(10, 37, 64, 0.08);
    --cc-shadow-lg: 0 20px 40px rgba(10, 37, 64, 0.14);
    --cc-radius: 14px;
}

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

body.cc-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--cc-bg-main);
    color: var(--cc-text-body);
    line-height: 1.5;
    min-height: 100vh;
}

/* ==========================================================================
   1. PANTALLA DE SEGURIDAD (CANDADO EXCLUSIVO SUPER ADMINISTRADOR)
   ========================================================================== */
.cc-security-gate {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 20% 20%, #123e6e 0%, #0a2540 55%, #061526 100%);
    position: relative;
    overflow: hidden;
}

.cc-security-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    max-width: 490px;
    width: 100%;
    padding: 36px 32px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(56, 189, 248, 0.35);
    text-align: center;
    position: relative;
    z-index: 2;
}

.cc-security-shield {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, #0a2540, #1E60A8);
    color: #38bdf8;
    font-size: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    box-shadow: 0 10px 25px rgba(30, 96, 168, 0.35);
}

.cc-security-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.cc-security-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--cc-navy);
    margin-bottom: 8px;
}

.cc-security-desc {
    font-size: 0.9rem;
    color: var(--cc-text-muted);
    margin-bottom: 20px;
}

.cc-security-current-user {
    background: #f8fafc;
    border: 1px solid var(--cc-border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.83rem;
    color: var(--cc-text-body);
    margin-bottom: 20px;
    text-align: left;
}

.cc-security-form {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cc-form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cc-navy);
    margin-bottom: 5px;
}

.cc-form-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.92rem;
    font-family: inherit;
    transition: all 0.2s;
}

.cc-form-input:focus {
    outline: none;
    border-color: var(--cc-cyan);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.cc-security-error {
    color: #dc2626;
    font-size: 0.82rem;
    font-weight: 600;
    min-height: 18px;
}

.cc-btn-unlock {
    background: linear-gradient(135deg, #0a2540, #1E60A8);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 6px 16px rgba(10, 37, 64, 0.25);
}

.cc-btn-unlock:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.35);
}

.cc-security-links {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--cc-border);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.84rem;
}

.cc-security-links a {
    color: var(--cc-blue);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cc-security-links a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   2. ENCABEZADO EJECUTIVO DEL CENTRO DE CONTROL
   ========================================================================== */
.cc-header {
    background: linear-gradient(135deg, #0a2540 0%, #123e6e 60%, #1E60A8 100%);
    color: #ffffff;
    padding: 18px 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(10, 37, 64, 0.22);
    border-bottom: 1px solid rgba(56, 189, 248, 0.25);
}

.cc-header-inner {
    max-width: 1480px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.cc-brand-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cc-brand-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #38bdf8;
}

.cc-brand-titles h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cc-superadmin-pill {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.cc-brand-subtitle {
    font-size: 0.82rem;
    color: #bae6fd;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.cc-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25);
    animation: ccPulse 2s infinite;
}

@keyframes ccPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.cc-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cc-btn {
    padding: 8px 14px;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    font-family: inherit;
}

.cc-btn-glass {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
}

.cc-btn-glass:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #38bdf8;
}

.cc-btn-cyan {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.cc-btn-cyan:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.cc-btn-emerald {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
}

.cc-btn-outline {
    background: #ffffff;
    color: var(--cc-navy);
    border-color: var(--cc-border);
}

.cc-btn-outline:hover {
    border-color: var(--cc-cyan);
    color: var(--cc-blue);
}

/* ==========================================================================
   3. CONTENEDOR PRINCIPAL Y NAVEGACIÓN DE SECCIONES
   ========================================================================== */
.cc-container {
    max-width: 1480px;
    margin: 0 auto;
    padding: 24px 28px 60px;
}

.cc-toolbar {
    background: var(--cc-bg-card);
    border-radius: var(--cc-radius);
    padding: 14px 20px;
    margin-bottom: 22px;
    border: 1px solid var(--cc-border);
    box-shadow: var(--cc-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.cc-nav-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cc-nav-pill {
    padding: 8px 15px;
    border-radius: 9px;
    border: 1px solid transparent;
    background: #f8fafc;
    color: var(--cc-text-muted);
    font-size: 0.83rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s;
}

.cc-nav-pill:hover {
    color: var(--cc-navy);
    background: #e2e8f0;
}

.cc-nav-pill.active {
    background: var(--cc-navy);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(10, 37, 64, 0.18);
}

.cc-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cc-select {
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--cc-navy);
    font-family: inherit;
}

/* ==========================================================================
   4. TARJETAS KPI PRINCIPALES (RESUMEN EJECUTIVO)
   ========================================================================== */
.cc-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.cc-kpi-card {
    background: var(--cc-bg-card);
    border-radius: var(--cc-radius);
    padding: 20px;
    border: 1px solid var(--cc-border);
    box-shadow: var(--cc-shadow-sm);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cc-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--cc-shadow-md);
}

.cc-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--cc-blue);
}

.cc-kpi-card.kpi-cyan::before { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.cc-kpi-card.kpi-emerald::before { background: linear-gradient(90deg, #10b981, #34d399); }
.cc-kpi-card.kpi-amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.cc-kpi-card.kpi-purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.cc-kpi-card.kpi-navy::before { background: linear-gradient(90deg, #0a2540, #1E60A8); }

.cc-kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.cc-kpi-label {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--cc-text-muted);
}

.cc-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.kpi-cyan .cc-kpi-icon { background: var(--cc-cyan-soft); color: #0284c7; }
.kpi-emerald .cc-kpi-icon { background: var(--cc-emerald-soft); color: #059669; }
.kpi-amber .cc-kpi-icon { background: var(--cc-amber-soft); color: #d97706; }
.kpi-purple .cc-kpi-icon { background: var(--cc-purple-soft); color: #7c3aed; }
.kpi-navy .cc-kpi-icon { background: #e0e7ff; color: #1e40af; }

.cc-kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2.05rem;
    font-weight: 800;
    color: var(--cc-navy);
    line-height: 1.1;
    margin-bottom: 10px;
}

.cc-kpi-subrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--cc-text-muted);
    padding-top: 10px;
    border-top: 1px dashed var(--cc-border);
    flex-wrap: wrap;
    gap: 6px;
}

.cc-kpi-pill {
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.74rem;
}

/* ==========================================================================
   5. BLOQUES DE SECCIÓN Y GRÁFICAS
   ========================================================================== */
.cc-section {
    margin-bottom: 28px;
}

.cc-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.cc-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.22rem;
    font-weight: 800;
    color: var(--cc-navy);
    display: flex;
    align-items: center;
    gap: 10px;
}

.cc-section-title i {
    color: var(--cc-blue);
}

.cc-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
    gap: 20px;
}

.cc-card {
    background: var(--cc-bg-card);
    border-radius: var(--cc-radius);
    border: 1px solid var(--cc-border);
    box-shadow: var(--cc-shadow-sm);
    padding: 22px;
}

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

.cc-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--cc-navy);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cc-card-subtitle {
    font-size: 0.8rem;
    color: var(--cc-text-muted);
}

/* Semáforo de los 3 estados de Pedidos */
.cc-orders-status-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.cc-order-state-box {
    border-radius: 12px;
    padding: 18px;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.cc-order-state-box:hover {
    transform: translateY(-2px);
}

.cc-order-state-box.state-pending {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #fde68a;
}

.cc-order-state-box.state-prep {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #bae6fd;
}

.cc-order-state-box.state-delivered {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #a7f3d0;
}

.cc-order-state-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.state-pending .cc-order-state-head { color: #b45309; }
.state-prep .cc-order-state-head { color: #0369a1; }
.state-delivered .cc-order-state-head { color: #047857; }

.cc-order-state-count {
    font-family: 'Outfit', sans-serif;
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--cc-navy);
    line-height: 1.1;
}

.cc-order-state-amount {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--cc-text-body);
}

.cc-order-state-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
    margin-top: 4px;
}

.cc-order-state-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

.state-pending .cc-order-state-bar-fill { background: #f59e0b; }
.state-prep .cc-order-state-bar-fill { background: #0284c7; }
.state-delivered .cc-order-state-bar-fill { background: #10b981; }

.cc-chart-box {
    position: relative;
    width: 100%;
    min-height: 290px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   6. TABLAS DE AUDITORÍA Y SEGUIMIENTO
   ========================================================================== */
.cc-table-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.cc-search-input {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 0.85rem;
    min-width: 250px;
    font-family: inherit;
}

.cc-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--cc-border);
}

.cc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.cc-table thead th {
    background: #0a2540;
    color: #ffffff;
    font-weight: 700;
    padding: 12px 14px;
    white-space: nowrap;
    font-size: 0.77rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.cc-table tbody tr {
    border-bottom: 1px solid var(--cc-border);
    transition: background 0.15s;
}

.cc-table tbody tr:hover {
    background: #f8fafc;
}

.cc-table tbody td {
    padding: 12px 14px;
    vertical-align: middle;
}

/* Badges de Rol y Estado */
.cc-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

.cc-badge-superadmin {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border: 1px solid #f59e0b;
}

.cc-badge-admin {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.cc-badge-client {
    background: #f3e8ff;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

.cc-badge-online {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.cc-badge-offline {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.cc-badge-pending {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.cc-badge-prep {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.cc-badge-delivered {
    background: #dcfce7;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.cc-badge-cancelled {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.cc-time-chip {
    font-family: 'Outfit', monospace;
    font-weight: 700;
    color: var(--cc-navy);
    background: #f1f5f9;
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ==========================================================================
   7. TOAST NOTIFICATIONS & RESPONSIVE
   ========================================================================== */
.cc-toast-container {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cc-toast {
    background: #0a2540;
    color: #ffffff;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(10, 37, 64, 0.3);
    border-left: 4px solid #38bdf8;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 960px) {
    .cc-grid-2 {
        grid-template-columns: 1fr;
    }
    .cc-container {
        padding: 16px;
    }
    .cc-header {
        padding: 14px 16px;
    }
}
