:root {
    --primary: #2895f1;
    --primary-hover: #0071d1;
    --secondary: #6c757d;
    --success: #34c759;
    --danger: #ff3b30;
    --warning: #ffcc00;
    --info: #5856d6;
    --background: #f5f5f7;
    --surface: rgba(255, 255, 255, 0.8);
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ===== ESCALA GLOBAL: 14px base reduce todo proporcionalmente ===== */
html {
    font-size: 14px;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-size: 0.9rem;
}

/* Glassmorphism Utility */
.glass {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Inputs Premium */
.form-input {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Botones Premium */
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-premium:hover {
    background-color: var(--primary-hover);
    transform: scale(1.02);
}

.btn-premium:active {
    transform: scale(0.98);
}

/* Layout System */
.main-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    background-color: var(--background);
    transition: all 0.3s ease;
}

/* Page Header */
.page-header {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

/* Premium Cards */
.card-modern {
    background: white;
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.card-header-modern {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #f8f8fb;
}

.card-icon {
    width: 38px;
    height: 38px;
    background: rgba(40, 149, 241, 0.1);
    color: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* DataTables Modern Styling */
.table-responsive {
    padding: 0 0.75rem 0.75rem;
}

table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0 6px !important;
    border: none !important;
    margin-top: 0 !important;
}

table.dataTable thead th {
    background: #f8f9fa !important;
    border: none !important;
    padding: 10px 14px !important;
    font-weight: 700 !important;
    font-size: 0.78rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: var(--text-secondary) !important;
}

table.dataTable tbody tr {
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    border-radius: 10px;
    transition: transform 0.2s ease;
}

table.dataTable tbody tr:hover {
    background-color: #fcfdfe !important;
    transform: translateY(-1px);
}

table.dataTable tbody td {
    background: white !important;
    border-top: 1px solid #f8f9fa !important;
    border-bottom: 1px solid #f8f9fa !important;
    padding: 10px 14px !important;
    vertical-align: middle !important;
    font-size: 0.875rem;
}

table.dataTable tbody td:first-child {
    border-left: 1px solid #f8f9fa !important;
    border-radius: 10px 0 0 10px !important;
}

table.dataTable tbody td:last-child {
    border-right: 1px solid #f8f9fa !important;
    border-radius: 0 10px 10px 0 !important;
}

/* Badges */
.badge {
    padding: 4px 10px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    font-size: 0.75rem !important;
}

.bg-success-soft { background: rgba(52, 199, 89, 0.12) !important; color: #28a745 !important; }
.bg-danger-soft { background: rgba(255, 59, 48, 0.12) !important; color: #dc3545 !important; }
.bg-warning-soft { background: rgba(255, 204, 0, 0.12) !important; color: #856404 !important; }

/* Modals Modern */
.glass-modal .modal-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.2);
}

.modal-backdrop.show {
    opacity: 0.4;
    backdrop-filter: blur(4px);
}

/* Forms Modern */
.form-label {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #4a5568;
    font-size: 0.8rem;
}

.form-control-modern {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    width: 100%;
    background: #ffffff !important;
    color: #1a202c !important;
}

.form-control-modern:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(40, 149, 241, 0.15);
    background: #fff !important;
    outline: none;
}

/* Buttons System */
.btn-modern {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
}

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

.btn-primary-modern:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 149, 241, 0.3);
}

/* Sidebar */
.sidebar-modern {
    width: 230px;
    background: #fff;
    border-right: 1px solid #f1f1f5;
    padding: 1.25rem;
}

/* ===== RESPONSIVE MEDIA QUERIES ===== */

/* Tablets grandes y laptops pequeñas (1024px - 1280px) */
@media (max-width: 1280px) {
    html { font-size: 13px; }
    :root { --sidebar-width: 220px !important; }
    .content-body { padding: 20px !important; }
}

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
    html { font-size: 13px; }
    :root { --sidebar-width: 200px !important; }
    .sidebar-premium { width: 200px !important; }
    .main-wrapper { margin-left: 200px !important; width: calc(100% - 200px) !important; }
    .content-body { padding: 16px !important; }
    .card-modern { margin-bottom: 1rem; }
}

/* Móviles y tablets pequeñas (< 768px) */
@media (max-width: 768px) {
    html { font-size: 13px; }
    :root { --sidebar-width: 0px !important; }

    .sidebar-premium {
        width: 240px !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1050;
    }

    .sidebar-premium.mobile-open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .content-body { padding: 12px !important; }
    .top-navbar { padding: 0 16px !important; }

    table.dataTable thead th,
    table.dataTable tbody td { padding: 8px 10px !important; }

    .card-header-modern { padding: 0.75rem 1rem; }

    .col-md-2, .col-md-3, .col-md-4, .col-md-6 { flex: 0 0 100%; max-width: 100%; }

    .modal-dialog { margin: 10px !important; }
}

/* Pantallas muy pequeñas (< 480px) */
@media (max-width: 480px) {
    html { font-size: 12px; }
    .btn { padding: 6px 12px !important; font-size: 0.8rem !important; }
}


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

body {
    font-family: var(--font-main);
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Glassmorphism Utility */
.glass {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

/* Inputs Premium */
.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* Botones Premium */
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-premium:hover {
    background-color: var(--primary-hover);
    transform: scale(1.02);
}

.btn-premium:active {
    transform: scale(0.98);
}
/* Layout System */
.main-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 2.5rem;
    background-color: var(--background);
    transition: all 0.3s ease;
}

/* Page Header */
.page-header {
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

/* Premium Cards */
.card-modern {
    background: white;
    border-radius: 24px;
    padding: 0; /* Let internal layers handle padding */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header-modern {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem 2rem;
    background: #fff;
    border-bottom: 1px solid #f8f8fb;
}

.card-icon {
    width: 48px;
    height: 48px;
    background: rgba(40, 149, 241, 0.1);
    color: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* DataTables Modern Styling */
.table-responsive {
    padding: 0 1rem 1rem 1rem;
}

table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
    border: none !important;
    margin-top: 0 !important;
}

table.dataTable thead th {
    background: #f8f9fa !important;
    border: none !important;
    padding: 15px 20px !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: var(--text-secondary) !important;
}

table.dataTable tbody tr {
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    border-radius: 12px;
    transition: transform 0.2s ease;
}

table.dataTable tbody tr:hover {
    background-color: #fcfdfe !important;
    transform: translateY(-2px);
}

table.dataTable tbody td {
    background: white !important;
    border-top: 1px solid #f8f9fa !important;
    border-bottom: 1px solid #f8f9fa !important;
    padding: 15px 20px !important;
    vertical-align: middle !important;
}

table.dataTable tbody td:first-child {
    border-left: 1px solid #f8f9fa !important;
    border-radius: 12px 0 0 12px !important;
}

table.dataTable tbody td:last-child {
    border-right: 1px solid #f8f9fa !important;
    border-radius: 0 12px 12px 0 !important;
}

/* Badges */
.badge {
    padding: 6px 12px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    font-size: 0.8rem !important;
}

.bg-success-soft { background: rgba(52, 199, 89, 0.12) !important; color: #28a745 !important; }
.bg-danger-soft { background: rgba(255, 59, 48, 0.12) !important; color: #dc3545 !important; }
.bg-warning-soft { background: rgba(255, 204, 0, 0.12) !important; color: #856404 !important; }

/* Modals Modern */
.glass-modal .modal-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-backdrop.show {
    opacity: 0.4;
    backdrop-filter: blur(4px);
}

/* Forms Modern */
.form-label {
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: #4a5568;
    font-size: 0.9rem;
}

.form-control-modern {
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    width: 100%;
    background: #ffffff !important;
    color: #1a202c !important; /* Texto negro fuerte */
}

.form-control-modern:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(40, 149, 241, 0.15);
    background: #fff !important;
    outline: none;
}

/* Buttons System */
.btn-modern {
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
}

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

.btn-primary-modern:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 149, 241, 0.3);
}

/* Sidebar Placeholder Styles (Adjust if real sidebar exists) */
.sidebar-modern {
    width: 260px;
    background: #fff;
    border-right: 1px solid #f1f1f5;
    padding: 1.5rem;
}
