/* ==========================================
   TEMA Y VARIABLES (AZURE PREMIUM DASHBOARD)
   ========================================== */
   :root {
    --bg-base: #f0f2f5;
    --sidebar-bg: #001529; /* Azul muy oscuro estilo Azure */
    --surface-glass: rgba(255, 255, 255, 0.9);
    --surface-solid: #ffffff;
    --border-light: #e5e7eb;
    
    --primary: #0078D4;
    --primary-hover: #005a9e;
    --primary-glow: rgba(0, 120, 212, 0.2);
    
    --accent-success: #107C10;
    --accent-success-bg: #dff6dd;
    --accent-danger: #D13438;
    --accent-info-bg: #e1effe;
    
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --text-inverted: #ffffff;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body { 
    font-family: 'Inter', system-ui, sans-serif; 
    color: var(--text-main); 
    background-color: var(--bg-base);
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* LAYOUT PRINCIPAL */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}
.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header i { font-size: 24px; color: #3b82f6; }
.sidebar-header h2 { font-size: 1.2rem; font-weight: 600; }

.nav-links { list-style: none; padding: 20px 12px; flex: 1; }
.nav-item { margin-bottom: 8px; }
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    color: #9ca3af; text-decoration: none; border-radius: 8px;
    font-weight: 500; font-size: 0.95rem; transition: var(--transition);
}
.nav-link i { font-size: 1.2rem; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.1); color: white; }
.nav-link.active { border-left: 4px solid var(--primary); }

.sidebar-footer { padding: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-info .avatar { width: 40px; height: 40px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.user-info .details { display: flex; flex-direction: column; }
.user-info .name { font-size: 0.9rem; font-weight: 600; }
.user-info .role { font-size: 0.75rem; color: #9ca3af; }

/* MAIN CONTENT */
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
    background: var(--surface-solid);
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}
.breadcrumbs { font-size: 0.95rem; color: var(--text-main); }
.topbar-actions { display: flex; gap: 12px; }
.icon-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; transition: var(--transition); }
.icon-btn:hover { color: var(--primary); }

.page-content { padding: 30px; overflow-y: auto; flex: 1; }

/* BANNERS Y TARJETAS */
.welcome-banner { background: linear-gradient(135deg, #0078D4 0%, #005a9e 100%); color: white; padding: 30px; border-radius: var(--radius-lg); margin-bottom: 30px; box-shadow: var(--shadow-md); }
.welcome-banner h2 { margin-bottom: 8px; font-size: 1.5rem; }
.welcome-banner p { opacity: 0.9; }

.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; }
.stat-card { display: flex; align-items: center; gap: 20px; padding: 24px; }
.stat-icon { width: 60px; height: 60px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 2rem; }
.stat-info h3 { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.stat-info p { font-size: 1.8rem; font-weight: 700; color: var(--text-main); }

.split-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }

.glass-card { background: var(--surface-solid); border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 24px; box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border-light); }
.card-title { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--text-main); }

/* FORMULARIOS */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
input, textarea { width: 100%; background: #f9fafb; border: 1px solid #d1d5db; color: var(--text-main); padding: 10px 14px; border-radius: var(--radius-sm); font-family: inherit; font-size: 0.95rem; transition: var(--transition); }
input:focus, textarea:focus { outline: none; background: var(--surface-solid); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
input[readonly] { background: #f3f4f6; color: var(--text-muted); cursor: not-allowed; border-style: dashed; }

/* ZONA UPLOAD */
.upload-zone { text-align: center; padding: 50px 20px; background: linear-gradient(180deg, #ffffff 0%, #f0f9ff 100%); border: 2px dashed #93c5fd; }
.upload-icon { background: var(--accent-info-bg); color: var(--primary); width: 70px; height: 70px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; font-size: 2rem;}
.upload-zone h3 { font-size: 1.2rem; margin-bottom: 8px; }
.upload-zone p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; }
.file-input-modern { max-width: 300px; margin: 0 auto; background: white; padding: 8px; border: 1px solid #d1d5db; }

/* BOTONES */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: var(--transition); border: 1px solid transparent; width: 100%; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: var(--text-inverted); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px var(--primary-glow); }
.btn-success { background: var(--accent-success); color: var(--text-inverted); }
.btn-success:hover { background: #0B5A0B; box-shadow: 0 4px 12px rgba(16,124,16,0.2); }
.btn-outline { background: var(--surface-solid); border-color: #d1d5db; color: #374151; width: auto; padding: 6px 12px; font-size: 0.85rem; }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: #f0f9ff; }
.btn-outline:disabled { opacity: 0.5; cursor: not-allowed; }

/* TABLA */
.datagrid-container { overflow-x: auto; }
.datagrid { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.datagrid th { background: #f9fafb; padding: 12px 16px; text-align: left; font-weight: 600; color: #4b5563; border-bottom: 1px solid var(--border-light); text-transform: uppercase; letter-spacing: 0.5px; }
.datagrid td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.datagrid tbody tr:hover { background: #f8fafc; }
.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; display: inline-block; white-space: nowrap; }
.badge-success { background: var(--accent-success-bg); color: var(--accent-success); }
.badge-info { background: var(--accent-info-bg); color: var(--primary); }

.asignado-select { width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #d1d5db; background: white; cursor: text; font-size: 0.85rem; transition: var(--transition); }
.asignado-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

/* PAGINACION */
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 0.85rem; color: var(--text-muted); }
.page-controls { display: flex; gap: 4px; }
.page-btn { border: 1px solid #E1DFDD; background: var(--surface-solid); width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; justify-content: center; align-items: center; cursor: pointer; font-weight: 600; transition: var(--transition); }
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* MODAL Y TOASTS */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(17, 24, 39, 0.7); backdrop-filter: blur(4px); display: none; justify-content: center; align-items: center; z-index: 2000; opacity: 0; transition: opacity 0.3s ease; }
.modal-overlay.active { display: flex; opacity: 1; }
.modal-content { background: var(--surface-solid); width: 100%; max-width: 700px; max-height: 90vh; overflow-y: auto; border-radius: var(--radius-lg); padding: 30px; box-shadow: var(--shadow-lg); transform: scale(0.95); transition: all 0.3s ease; position: relative; }
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-close { position: absolute; top: 20px; right: 20px; background: transparent; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; border-radius: 50%; transition: var(--transition); }
.modal-close:hover { color: var(--accent-danger); }
.modal-actions { display: flex; gap: 16px; margin-top: 24px; border-top: 1px solid var(--border-light); padding-top: 20px;}

.toast-container { position: fixed; bottom: 30px; right: 30px; display: flex; flex-direction: column; gap: 12px; z-index: 3000; }
.toast { min-width: 280px; background: var(--surface-solid); border-left: 4px solid var(--primary); box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); padding: 16px; display: flex; align-items: flex-start; gap: 12px; transform: translateX(120%); opacity: 0; transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); }
.toast.show { transform: translateX(0); opacity: 1; }
.toast.success { border-color: var(--accent-success); }
.toast.error { border-color: var(--accent-danger); }

/* UTILIDADES Y ANIMACIONES */
.spinner { animation: rotate 2s linear infinite; width: 16px; height: 16px; }
.spinner .path { stroke: currentColor; stroke-linecap: round; animation: dash 1.5s ease-in-out infinite; }
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes dash { 0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; } 50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; } 100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; } }

/* AUTOCOMPLETE MANUl */
.autocomplete-wrapper { position: relative; }
.autocomplete-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface-solid); border: 1px solid var(--border-light); border-radius: var(--radius-sm); max-height: 200px; overflow-y: auto; z-index: 1000; display: none; box-shadow: var(--shadow-md); }
.autocomplete-item { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid #f3f4f6; font-size: 0.85rem; }
.autocomplete-item:hover { background: #f0f9ff; color: var(--primary); }