@charset "UTF-8";
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');

:root {
    /* --- COLORES BASE (RESPALDO / FALLBACK) --- */
    --primary: #1e293b;   
    --secondary: #334155; 
    --accent: #3b82f6;    
    --success: #10b981;   
    --warning: #f59e0b;   
    --danger: #ef4444;    
    --light: #f1f5f9;     
    --white: #ffffff;
    --text-dark: #1f2937;
    --text-muted: #64748b;
    --sidebar-width: 260px; 
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    /* --- VARIABLES DINÁMICAS (ASIGNADAS POR PHP) --- */
    --brand-primary: var(--accent);
    --brand-secondary: var(--success);
    --aside-bg: var(--primary);
    --aside-txt: var(--white);
}

/* --- RESET --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
body { background-color: var(--light); color: var(--text-dark); overflow-x: hidden; }

/* --- ESTRUCTURA PRINCIPAL --- */
.dashboard-container { 
    display: block; 
    width: 100%; 
    min-height: 100vh;
}

/* --- NOTIFICACIONES TOAST (CINTAS) --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: white;
    color: var(--text-dark);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    border-left: 5px solid var(--brand-primary);
    animation: slideIn 0.3s ease, fadeOut 0.5s ease 3s forwards;
}

.toast.success { border-left-color: var(--brand-secondary); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--brand-primary); }

.toast i { font-size: 1.2rem; }
.toast.success i { color: var(--brand-secondary); }
.toast.error i { color: var(--danger); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }

/* --- MODAL DE ESTATUS --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: none; justify-content: center; align-items: center;
}

.modal-box {
    background: white; width: 90%; max-width: 400px;
    padding: 25px; border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: popIn 0.3s ease;
}

@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-footer { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* --- SIDEBAR DINÁMICA --- */
.sidebar {
    width: var(--sidebar-width); 
    background-color: var(--aside-bg); 
    color: var(--aside-txt);
    position: fixed; 
    top: 0; 
    left: 0; 
    height: 100vh; 
    z-index: 1000;
    display: flex; 
    flex-direction: column;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.sidebar-header { 
    padding: 20px; 
    min-height: 70px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
}

.sidebar-header h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--aside-txt); }

.sidebar nav { flex: 1; padding-top: 15px; }

.sidebar nav a { 
    display: flex; 
    align-items: center; 
    padding: 12px 25px; 
    color: var(--aside-txt); 
    opacity: 0.8;
    text-decoration: none; 
    border-left: 4px solid transparent; 
    transition: 0.2s; 
}

.sidebar nav a i { color: var(--aside-txt); margin-right: 12px; width: 20px; text-align: center; }

.sidebar nav a:hover, .sidebar nav a.active { 
    background: rgba(255,255,255,0.1); 
    color: #fff; 
    opacity: 1;
    border-left-color: var(--brand-primary); 
}

.sidebar-footer { padding: 20px; border-top: 1px solid rgba(255,255,255,0.1); }

/* --- CONTENIDO PRINCIPAL --- */
.main-content {
    margin-left: var(--sidebar-width); 
    width: calc(100% - var(--sidebar-width));
    padding: 30px; 
    min-height: 100vh;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* --- BARRA SUPERIOR --- */
.top-bar {
    background: var(--white); 
    padding: 15px 25px; 
    border-radius: 12px; 
    box-shadow: var(--shadow); 
    margin-bottom: 30px;
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    position: sticky; 
    top: 20px; 
    z-index: 99; 
}

/* --- GRID LAYOUT --- */
.order-layout {
    display: grid;
    grid-template-columns: 1fr 380px; 
    gap: 25px;
    align-items: start;
    width: 100%; 
}

.order-main { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.order-sidebar { position: sticky; top: 100px; z-index: 90; }

/* --- COMPONENTES --- */
.card { background: var(--white); border-radius: 12px; padding: 25px; box-shadow: var(--shadow); border: 1px solid #e2e8f0; margin-bottom: 25px; }
.card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid #f1f5f9; padding-bottom: 15px; }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--brand-primary); margin: 0; }

.input-std { width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; height: 45px; }
.input-std:focus { border-color: var(--brand-primary); outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* --- BOTONES --- */
.btn-action { background: var(--brand-primary); color: white; padding: 0 20px; height: 42px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s ease; text-decoration: none; font-size: 0.95rem; }
.btn-action:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.btn-success { background: var(--brand-primary); }
.btn-secondary { background: white; color: var(--text-dark); border: 1px solid #cbd5e1; }
.btn-secondary:hover { background: #f1f5f9; }

/* Botones de Icono en Tablas */
.acciones-td { display: flex; gap: 8px; justify-content: center; align-items: center; }
.btn-icon { width: 34px; height: 34px; border-radius: 6px; border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: 0.2s; font-size: 1rem; text-decoration: none; }
.btn-icon:hover { transform: scale(1.1); }

.btn-edit { background: rgba(59, 130, 246, 0.1); color: var(--brand-primary); }
.btn-edit:hover { background: var(--brand-primary); color: white; }

.btn-delete { background: #fee2e2; color: var(--danger); }
.btn-delete:hover { background: var(--danger); color: white; }

.btn-view { background: rgba(16, 185, 129, 0.1); color: var(--brand-secondary); }
.btn-view:hover { background: var(--brand-secondary); color: white; }

/* Grids Internos */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid-3 { display: grid; grid-template-columns: 2fr 1fr 80px 50px; gap: 10px; align-items: center; }

/* Paneles */
.hidden-panel { display: none; background: #f0f9ff; padding: 20px; border-radius: 12px; border: 1px dashed var(--brand-primary); margin-top: 15px; }
.total-display { text-align: center; padding: 20px; background: #f8fafc; border-radius: 12px; border: 1px dashed #cbd5e1; margin: 20px 0; }
.total-amount { font-size: 2.5rem; font-weight: 800; color: var(--brand-primary); display: block; }
.total-label { color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }

/* Tablas */
.table-responsive { width: 100%; overflow-x: auto; }
.custom-table { width: 100%; border-collapse: collapse; }
.custom-table th, .custom-table td { padding: 15px; border-bottom: 1px solid #f1f5f9; text-align: left; }
.custom-table th { background: #f8fafc; font-weight: 600; color: var(--text-muted); }

/* Utilidades */
.top-bar-left { display: flex; align-items: center; }
.page-title-box h1 { margin: 0; font-size: 1.3rem; color: var(--brand-primary); }
.page-title-box p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.search-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 0.9rem; }

/* --- RESPONSIVE --- */
.menu-toggle, .btn-close-sidebar { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }

@media (max-width: 1024px) {
    .sidebar { left: -260px; } 
    .sidebar.active { left: 0; }
    .main-content { margin-left: 0; width: 100%; padding: 15px; }
    .menu-toggle { display: block; color: var(--text-dark); margin-right: 15px; }
    .btn-close-sidebar { display: block; color: var(--aside-txt); }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; }
    .sidebar-overlay.active { display: block; }
    .order-layout { grid-template-columns: 1fr; }
    .order-sidebar { position: static; top: auto; }
    .btn-text-responsive { display: none; }
}

@media (max-width: 768px) {
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; gap: 10px; }
    .custom-table thead { display: none; }
    .custom-table tr { display: block; background: white; margin-bottom: 15px; border: 1px solid #e2e8f0; border-radius: 12px; padding: 15px; }
    .custom-table td { display: flex; justify-content: space-between; text-align: right; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
    .custom-table td::before { content: attr(data-label); font-weight: 700; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; }
}