/*=============================================
DISEÑO DE INTERFAZ PREMIUM PARA ALPASOFT
=============================================*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #6366f1; /* Indigo */
    --primary-hover: #4f46e5;
    --secondary-color: #0f172a; /* Slate Dark */
    --accent-color: #f43f5e; /* Rose */
    --success-color: #10b981; /* Emerald */
    --warning-color: #f59e0b; /* Amber */
    --info-color: #0ea5e9; /* Sky Blue */
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --text-main: #334155;
    --text-muted: #64748b;
    --sidebar-width: 260px;
    --navbar-height: 70px;
    --font-inter: 'Inter', sans-serif;
}

html {
    font-size: 14px; /* Escala global de tipografía reducida para alta densidad de información */
}

body {
    font-family: var(--font-inter);
    background-color: var(--bg-light);
    color: var(--text-main);
    overflow-x: hidden;
    font-size: 0.9rem; /* 12.6px base */
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Layout Principal */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* Sidebar */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    transition: margin-left 0.3s ease, min-width 0.3s ease, max-width 0.3s ease;
    min-height: 100vh;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 1040;
}

#sidebar.collapsed {
    min-width: 0;
    max-width: 0;
    margin-left: -var(--sidebar-width);
    overflow: hidden;
}

#sidebar .sidebar-header {
    padding: 24px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar .sidebar-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.5px;
}

#sidebar ul.components {
    padding: 10px 0;
}

#sidebar ul li {
    padding: 1px 10px;
}

#sidebar ul li a {
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
}

#sidebar ul li a i {
    font-size: 1.1rem;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

#sidebar ul li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

#sidebar ul li.active > a {
    color: #fff;
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Contenido Principal */
#content {
    flex: 1;
    min-width: 0; /* Evita que los DataTables y elementos flexbox se desborden y rompan el responsive */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* Overlay para pantallas móviles */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5); /* Slate overlay con transparencia */
    backdrop-filter: blur(4px);
    z-index: 1030;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

/* Adaptabilidad Móvil */
@media (max-width: 767.98px) {
    #sidebar {
        position: fixed;
        height: 100vh;
        margin-left: -260px;
        z-index: 1050;
    }
    
    #sidebar.active {
        margin-left: 0;
    }
    
    /* El navbar superior se adapta */
    .navbar-custom {
        padding: 0 15px;
    }
}

/* Navbar */
.navbar-custom {
    height: var(--navbar-height);
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 30px;
}

.navbar-brand-name {
    font-weight: 600;
    color: var(--secondary-color);
}

/* Tarjetas Premium */
.card-premium {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

.card-premium:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

.card-premium .card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
}

.card-premium .card-body {
    padding: 20px;
}

/* Botones Premium con Micro-animación */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-success:hover, .btn-success:focus {
    background-color: #059669;
    border-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-danger {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-danger:hover, .btn-danger:focus {
    background-color: #e11d48;
    border-color: #e11d48;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.25);
}

/* Login Page con Fondo de Alpacas y Degradado */
.login-page {
    background: linear-gradient(rgba(15, 23, 42, 0.75), rgba(30, 27, 75, 0.85)), url('../img/login-bg.png') no-repeat center center;
    background-size: cover;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* DataTables Personalizado */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    color: white !important;
    border: 1px solid var(--primary-color) !important;
    border-radius: 6px !important;
}

.table {
    border-collapse: separate;
    border-spacing: 0 8px;
}

.table tr {
    transition: all 0.15s ease;
}

.table tbody tr {
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.table tbody tr:hover {
    background-color: #f8fafc !important;
    transform: scale(1.002);
}

.table th {
    border: none;
    padding: 8px 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.table td {
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table td:first-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.table td:last-child {
    border-right: 1px solid var(--border-color);
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Estado Badges */
.badge-status {
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active {
    background-color: #ecfdf5;
    color: #065f46;
}

.badge-inactive {
    background-color: #fef2f2;
    color: #991b1b;
}

/* Foto previsualizar */
.preview-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
}

/* Correcciones de Responsividad para DataTables en Flexbox/Tabs */
.tab-content, 
.tab-pane, 
.card, 
.card-body {
    min-width: 0;
}

.col-md-8, 
.col-lg-9, 
.col-md-4, 
.col-lg-3, 
.col-12 {
    min-width: 0;
}

table.dataTable {
    width: 100% !important;
}

/* Select2 inside SweetAlert2 z-index fix */
.select2-container--open {
    z-index: 999999999 !important;
}

/* Colores de solicitudes RGALLP en tablas */
.tr-rgallp-lai td {
    background-color: #fef9c3 !important; /* Amarillo suave */
}
.table-hover tbody tr.tr-rgallp-lai:hover td {
    background-color: #fef08a !important;
}
.tr-rgallp-lap td {
    background-color: #d1fae5 !important; /* Verde suave */
}
.table-hover tbody tr.tr-rgallp-lap:hover td {
    background-color: #a7f3d0 !important;
}
.tr-rgallp-lad td {
    background-color: #e0f2fe !important; /* Azul suave */
}
.table-hover tbody tr.tr-rgallp-lad:hover td {
    background-color: #bae6fd !important;
}
.tr-rgallp-lcp td {
    background-color: #fee2e2 !important; /* Rojo suave */
}
.table-hover tbody tr.tr-rgallp-lcp:hover td {
    background-color: #fecaca !important;
}
