/* ============================================
   MAIN STYLES - Industrial Minimalista Unificado
   ============================================ */

/* ---------- VARIABLES GLOBALES ---------- */
:root {
    /* colores principales - paleta industrial */
    --primary: #1e3a5f;
    --primary-light: #2d5a8a;
    --primary-soft: #e8eef4;

    --success: #059669;
    --success-soft: #d1fae5;

    --warning: #f9a825;
    --warning-soft: #fff8e1;

    --danger: #c62828;
    --danger-soft: #ffebee;

    --info: #0277bd;
    --info-soft: #e1f5fe;

    /* superficies */
    --bg: #f5f7fa;
    --surface: #ffffff;
    --border: #e2e8f0;

    /* texto */
    --text: #1a1a2e;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* sombras */
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.12);
    --shadow-lg: 0 10px 40px rgba(30,58,95,0.15);

    /* radios */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    /* sidebar */
    --sidebar-width: 240px;
}

/* ---------- GENERAL ---------- */
body {
    background: linear-gradient(135deg, #f4f6fb 0%, #eef2f7 100%);
    font-family: 'Source Code Pro', 'Iosevka Charon Mono', monospace;
    margin: 0;
    padding: 0;
    color: var(--text);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(30, 58, 95, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(30, 58, 95, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ---------- CONTENEDOR PRINCIPAL ---------- */
.col-md-10 {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.right {
    padding: 24px 32px;
}

/* ---------- TARJETAS ---------- */
.card {
    font-family: 'Source Code Pro', monospace;
    border: none;
    border-radius: var(--radius);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card img {
    border-radius: var(--radius-sm);
    border: 3px solid #f1f1f1;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}

.card:hover img {
    transform: scale(1.05);
}

/* ---------- SIDEBAR FIXED ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    min-height: 100vh;
    z-index: 1000;
}

.sidebar-container {
    width: var(--sidebar-width);
    height: 100vh;
}

/* ---------- GRÁFICAS ---------- */
.chartContainer {
    width: 100%;
}

/* ---------- HEADERS ---------- */
.page-header,
.supervisor-header,
.provider-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-lg);
    padding: 24px 32px;
    margin-bottom: 24px;
    color: white;
    position: relative;
    overflow: hidden;
}

.page-header::before,
.supervisor-header::before,
.provider-header::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.page-header h2,
.page-header h3,
.supervisor-header h2,
.provider-header h2 {
    font-family: 'Source Code Pro', monospace;
    font-weight: 700;
    font-size: 28px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.page-header h2 i,
.page-header h3 i,
.supervisor-header h2 i,
.provider-header h2 i {
    font-size: 24px;
    opacity: 0.9;
}

.page-header .subtitle,
.supervisor-header .subtitle,
.provider-header .subtitle {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 4px;
    font-family: 'Iosevka Charon Mono', monospace;
}

/* ---------- BOTONES ---------- */
.btn {
    font-family: 'Iosevka Charon Mono', monospace;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    transition: all 0.2s ease;
}

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

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

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

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #000;
}

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

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

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

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

/* ---------- BADGES ---------- */
.badge {
    font-family: 'Iosevka Charon Mono', monospace;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.badge.bg-primary { background: var(--primary) !important; }
.badge.bg-success { background: var(--success) !important; }
.badge.bg-warning { background: var(--warning) !important; color: #000; }
.badge.bg-danger { background: var(--danger) !important; }
.badge.bg-info { background: var(--info) !important; }
.badge.bg-secondary { background: var(--text-muted) !important; }

/* ---------- FORMULARIOS ---------- */
.form-control {
    font-family: 'Iosevka Charon Mono', monospace;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30,58,95,0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

/* ---------- TABLAS ---------- */
.table {
    font-family: 'Iosevka Charon Mono', monospace;
}

.table thead th {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    border: none;
    padding: 14px 16px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody td {
    padding: 14px 16px;
    border-color: var(--border);
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: var(--bg);
}

/* ---------- ALERTAS ---------- */
.alert {
    font-family: 'Iosevka Charon Mono', monospace;
    border-radius: var(--radius-sm);
    border: none;
    padding: 16px 20px;
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
}

.alert-warning {
    background: var(--warning-soft);
    color: #856404;
}

.alert-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.alert-info {
    background: var(--info-soft);
    color: var(--info);
}

/* ---------- MODALES ---------- */
.modal-dialog {
    max-width: 480px;
}

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 20px 24px;
    border: none;
}

.modal-header .modal-title {
    font-family: 'Source Code Pro', monospace;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.7;
}

.modal-header .btn-close:hover {
    opacity: 1;
}

/* ---------- SIN SOLICITUDES ---------- */
.no_request {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no_request i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.no_request h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-muted);
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ---------- UTILIDADES ---------- */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary-soft { background: var(--primary-soft) !important; }
.bg-success-soft { background: var(--success-soft) !important; }
.bg-warning-soft { background: var(--warning-soft) !important; }
.bg-danger-soft { background: var(--danger-soft) !important; }
.bg-info-soft { background: var(--info-soft) !important; }

/* ---------- DROPDOWN ---------- */
.dropdown-menu {
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover);
    padding: 8px;
}

.dropdown-item {
    font-family: 'Iosevka Charon Mono', monospace;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .col-md-10 {
        margin-left: 0;
        padding: 0 16px;
    }

    .right {
        padding: 16px;
    }

    .page-header,
    .supervisor-header,
    .provider-header {
        padding: 20px;
    }

    .page-header h2,
    .page-header h3,
    .supervisor-header h2,
    .provider-header h2 {
        font-size: 22px;
    }
}

/* ============================================
   LAYOUT UNIFICADO - Sistema de Dashboard
   ============================================ */

/* --- Sistema de Espaciado --- */
:root {
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

/* --- Contenedor Principal --- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: var(--space-lg);
    min-height: 100vh;
    background: var(--bg);
}

/* --- Sección de Contenido --- */
.content-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow);
}

/* --- Page Header Unificado --- */
.page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    color: white;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.page-header h2,
.page-header h3 {
    font-family: 'Source Code Pro', monospace;
    font-weight: 700;
    font-size: 28px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.page-header h2 i,
.page-header h3 i {
    font-size: 24px;
    opacity: 0.9;
}

.page-header .subtitle {
    font-size: 14px;
    opacity: 0.85;
    margin-top: var(--space-xs);
    font-family: 'Iosevka Charon Mono', monospace;
}

/* Variantes de Page Header */
.page-header.dashboard {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.page-header.supervisor {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.page-header.provider {
    background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
}

/* --- Cards Unificadas --- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    transition: all 0.25s ease;
}

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

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

/* --- Search Container --- */
.search-container {
    position: relative;
    margin-bottom: var(--space-md);
}

.search-container .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.search-container input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Iosevka Charon Mono', monospace;
    font-size: 13px;
    transition: all 0.25s ease;
    background: var(--surface);
}

.search-container input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30,58,95,0.1);
    outline: none;
}

/* --- Filters Container --- */
.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

/* --- Acciones Container --- */
.actions-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

/* --- Responsive --- */
@media (max-width: 991px) {
    .main-content {
        margin-left: 0;
        padding: var(--space-md);
    }

    .page-header h2,
    .page-header h3 {
        font-size: 22px;
    }

    .page-header {
        padding: var(--space-md);
    }
}

/* ============================================
   DATA TABLE - Componente Reutilizable
   Uso: <table class="data-table">...</table>
   ============================================ */

.data-table-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}

/* Table Wrapper */
.data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Source Code Pro', monospace;
    font-size: 13px;
}

/* Table Head */
.data-table thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.data-table thead th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border: none;
}

.data-table thead th:first-child {
    border-top-left-radius: 0;
}

.data-table thead th:last-child {
    border-top-right-radius: 0;
}

/* Sortable Headers */
.data-table thead th.sortable {
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
}

.data-table thead th.sortable:hover {
    background: var(--primary-light);
}

.data-table thead th.sortable::after {
    content: "\f0dc";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 12px;
    opacity: 0.5;
    font-size: 10px;
}

.data-table thead th.sortable.asc::after {
    content: "\f0de";
    opacity: 1;
}

.data-table thead th.sortable.desc::after {
    content: "\f0dd";
    opacity: 1;
}

/* Table Body */
.data-table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: var(--primary-soft);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody td {
    padding: 14px 16px;
    color: var(--text);
    vertical-align: middle;
}

/* Table Footer */
.data-table tfoot {
    background: var(--bg);
    border-top: 2px solid var(--border);
}

.data-table tfoot td {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Table Actions */
.data-table .actions-cell {
    white-space: nowrap;
    text-align: right;
}

.data-table .actions-cell .btn-action {
    padding: 6px 10px;
    font-size: 11px;
    margin-left: 4px;
}

/* Table Badges in cells */
.data-table .cell-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.data-table .cell-badge.success {
    background: var(--success-soft);
    color: var(--success);
}

.data-table .cell-badge.warning {
    background: var(--warning-soft);
    color: #856404;
}

.data-table .cell-badge.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.data-table .cell-badge.info {
    background: var(--info-soft);
    color: var(--info);
}

/* Table Toolbar */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.table-toolbar .search-box {
    position: relative;
    min-width: 250px;
}

.table-toolbar .search-box input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Source Code Pro', monospace;
    font-size: 12px;
    transition: border-color 0.2s ease;
}

.table-toolbar .search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.table-toolbar .search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.table-toolbar .table-actions {
    display: flex;
    gap: 8px;
}

/* Pagination */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.table-pagination .pagination-info {
    font-size: 12px;
    color: var(--text-muted);
}

.table-pagination .pagination-controls {
    display: flex;
    gap: 4px;
}

.table-pagination .page-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: 'Source Code Pro', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
}

.table-pagination .page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.table-pagination .page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.table-pagination .page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty State */
.table-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.table-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.table-empty h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.table-empty p {
    font-size: 13px;
}

/* Loading State */
.table-loading {
    text-align: center;
    padding: 60px 20px;
}

.table-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Row Selection */
.data-table tbody tr.selected {
    background: var(--primary-soft);
}

.data-table tbody tr.selectable {
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-toolbar .search-box {
        min-width: 100%;
    }
    
    .table-pagination {
        flex-direction: column;
        text-align: center;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table thead th,
    .data-table tbody td {
        padding: 10px 12px;
    }
}
