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

:root {
    --primary: #321fdb;
    --secondary: #9da5b1;
    --success: #2eb85c;
    --danger: #e55353;
    --warning: #f9b115;
    --info: #3399ff;
    --light: #ebedef;
    --dark: #4f5d73;
    
    --bg-body: #f3f4f7;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f8f9fa;
    --text-main: #3c4b64;
    --text-muted: #768192;
    --border-color: #d8dbe0;
    
    --sidebar-width: 256px;
    --header-height: 64px;
}

html[data-theme="dark"] {
    --bg-body: #0d1117;
    --bg-surface: #161b22;
    --bg-surface-alt: #21262d;
    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --border-color: #30363d;
    --light: #21262d;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 0.875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

a:hover {
    color: #2819af;
}

/* Custom Selection */
::selection { background: rgba(50, 31, 219, 0.25); color: inherit; }

/* Skeleton Loading Animation */
.skeleton {
    background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-body) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 4px;
    color: transparent !important;
    pointer-events: none;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Global Interaction */
.btn { transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important; }
.btn:active { transform: scale(0.96) !important; }

/* Layout - Auth (Premium Modern Design) */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #0f172a;
    position: relative;
    overflow: hidden;
    padding: 2rem;
}

/* Elementos de fondo decorativos */
.bg-shape {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    z-index: 1;
    animation: float-shapes 20s infinite alternate ease-in-out;
}

.shape-1 { width: 400px; height: 400px; background: rgba(50, 31, 219, 0.2); top: -100px; left: -100px; }
.shape-2 { width: 350px; height: 350px; background: rgba(51, 153, 255, 0.15); bottom: -50px; right: -50px; animation-delay: -5s; }
.shape-3 { width: 250px; height: 250px; background: rgba(46, 184, 92, 0.1); top: 50%; left: 60%; animation-delay: -10s; }

@keyframes float-shapes {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 100px) scale(1.1); }
}

.auth-card {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 10;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .glass-panel {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Auth Components */
.logo-circle {
    width: 72px;
    height: 72px;
    background: #fff;
    margin: 0 auto 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.logo-circle img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.logo-circle:hover {
    transform: translateY(-5px) rotate(5deg);
}

.login-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .login-title { color: #f8fafc; }

.login-subtitle {
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.premium-input {
    background: rgba(241, 245, 249, 0.5) !important;
    border: 2px solid transparent !important;
    border-radius: 12px !important;
    padding: 0.75rem 1rem 0.75rem 2.75rem !important;
    height: auto !important;
    font-size: 0.95rem !important;
    transition: all 0.3s ease !important;
    color: #1e293b !important;
}

[data-theme="dark"] .premium-input {
    background: rgba(15, 23, 42, 0.5) !important;
    color: #f8fafc !important;
}

.premium-input:focus {
    background: #fff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(50, 31, 219, 0.1) !important;
}

[data-theme="dark"] .premium-input:focus {
    background: #0f172a !important;
}

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper .icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    transition: color 0.3s ease;
}

.premium-input:focus + .icon,
.premium-input:not(:placeholder-shown) + .icon {
    color: var(--primary);
}

.btn-premium {
    background: linear-gradient(135deg, #321fdb 0%, #2819af 100%);
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    box-shadow: 0 10px 15px -3px rgba(50, 31, 219, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(50, 31, 219, 0.4);
}

.glass-alert {
    background: rgba(229, 83, 83, 0.1);
    border: 1px solid rgba(229, 83, 83, 0.2);
    color: #e55353;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.login-footer-link {
    color: #64748b;
    font-weight: 500;
    transition: color 0.3s ease;
}

.login-footer-link:hover {
    color: var(--primary);
}

.login-divider {
    position: relative;
    text-align: center;
}

.login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(203, 213, 225, 0.4);
    z-index: 1;
}

.login-divider span {
    position: relative;
    z-index: 2;
    background: #fff;
    padding: 0 1rem;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 500;
}

[data-theme="dark"] .login-divider span {
    background: #1e293b;
}

.btn-outline-premium {
    background: transparent;
    border: 2px solid rgba(50, 31, 219, 0.2);
    border-radius: 12px;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-outline-premium:hover {
    background: rgba(50, 31, 219, 0.05);
    border-color: var(--primary);
}

.fade-in {
    animation: auth-fade-in 0.6s both;
}

@keyframes auth-fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.sidebar {
    width: var(--sidebar-width);
    background: #3c4b64;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1030;
    transition: margin-left 0.25s;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: rgba(0,0,0,0.2);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    list-style: none;
}

.sidebar-nav-item {
    padding: 0 1rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 0.25rem;
    font-weight: 500;
}

.sidebar-nav-link:hover, .sidebar-nav-link.active {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar-nav-link i {
    margin-right: 1rem;
    font-size: 1.1rem;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.header-nav {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 1rem;
}

.content-body {
    padding: 1.5rem;
    flex: 1;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.card-header {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background-color: transparent;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-main);
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: var(--text-main);
    background-color: #fff;
    border-color: #8a93a2;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(50, 31, 219, 0.25);
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
    border: 1px solid transparent;
}

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

.btn-primary:hover {
    background-color: #2a1ab9;
    border-color: #2819af;
}

.btn-block {
    display: block;
    width: 100%;
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }

/* Utilities */
.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.alert-danger {
    color: #762c2c;
    background-color: #fadada;
    border-color: #f7c6c6;
}

/* ==========================================================
   Premium Login UI Enhancements
   ========================================================== */

/* Animated Background Shapes */
.auth-wrapper {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f0f4fd 0%, #e1e9fa 100%);
    z-index: 1;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 12s ease-in-out infinite alternate;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: rgba(50, 31, 219, 0.2); /* Primary tint */
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: rgba(51, 153, 255, 0.2); /* Info tint */
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: rgba(249, 177, 21, 0.15); /* Warning tint */
    bottom: 20%;
    left: 15%;
    animation-duration: 15s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 40px) scale(1.1); }
}

/* Glassmorphism Panel */
.glass-panel {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05), 
                inset 0 0 0 1px rgba(255,255,255,0.5) !important;
    border-radius: 16px !important;
    padding: 3rem !important;
    z-index: 10;
}

/* Login Header */
.login-header {
    margin-bottom: 2.5rem;
}

.logo-circle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), #5240e6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    color: white;
    font-size: 1.8rem;
    box-shadow: 0 8px 20px rgba(50, 31, 219, 0.3);
}

.login-title {
    font-weight: 700;
    font-size: 1.5rem;
    color: #1a202c;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: #718096;
    font-size: 0.95rem;
}

/* Floating Label Inputs */
.floating-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper .icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 1.1rem;
    transition: color 0.3s ease;
    z-index: 5;
}

.premium-input {
    height: 3.5rem;
    padding: 1rem 1rem 0 3rem !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid rgba(203, 213, 225, 0.6) !important;
    border-radius: 10px !important;
    font-size: 1rem !important;
    font-weight: 500;
    color: #2d3748 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.premium-input:focus {
    background: #ffffff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(50, 31, 219, 0.1) !important;
}

.premium-input:focus ~ .icon {
    color: var(--primary);
}

.floating-label {
    position: absolute;
    left: 3rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 0.95rem;
    pointer-events: none;
    transition: all 0.25s ease-out;
}

.premium-input:focus ~ .floating-label,
.premium-input:not(:placeholder-shown) ~ .floating-label {
    top: 14px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
}

.premium-input:not(:placeholder-shown) ~ .floating-label {
    color: #718096; /* gray when filled but not focused */
}
.premium-input:focus:not(:placeholder-shown) ~ .floating-label {
    color: var(--primary);
}

/* Premium Button */
.btn-premium {
    height: 3.5rem;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), #4834e8);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(50, 31, 219, 0.25);
    margin-top: 2rem;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(50, 31, 219, 0.35);
    background: linear-gradient(135deg, #2a1ab9, #3f2bd1);
}

.btn-premium:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px rgba(50, 31, 219, 0.2);
}

/* Animations */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

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

.glass-alert {
    background: rgba(253, 237, 237, 0.8) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(229, 83, 83, 0.2) !important;
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--danger);
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(229, 83, 83, 0.1);
}


/* ==========================================================
   Responsive Design & Media Queries
   ========================================================== */

/* Sidebar Backdrop (hidden by default) */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Base structural adjustments */
.main-content {
    transition: margin-left 0.3s ease;
}

.sidebar {
    transition: transform 0.3s ease;
    z-index: 1000;
}

@media (max-width: 992px) {
    /* Hide some info on tablet */
    .user-info-box {
        display: none !important;
    }
    
    .logout-box {
        border-left: none !important;
        margin-left: 0 !important;
    }
    
    .logout-text {
        display: none;
    }
    
    .btn-primary i {
        margin: 0;
    }
}

@media (max-width: 768px) {
    /* Mobile Off-canvas Sidebar */
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        height: 100vh;
    }

    .sidebar.sidebar-show {
        transform: translateX(0);
        box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    }

    /* Main content expands full width */
    .main-content {
        margin-left: 0;
        width: 100%;
    }

    /* Adjust paddings */
    .header {
        padding: 0 1rem;
    }

    .content-body {
        padding: 1rem;
    }

    .card-body {
        padding: 1.5rem !important;
    }
}

/* Desktop Sidebar Toggle */
@media (min-width: 769px) {
    .sidebar.sidebar-hidden {
        transform: translateX(-100%);
    }
    
    .sidebar.sidebar-hidden ~ .main-content {
        margin-left: 0;
    }
}

/* ==========================================================
   Dark Mode Styles
   ========================================================== */
[data-theme="dark"] {
    --bg-body: #181924; /* Darker background */
    --bg-surface: #212332; /* Slightly lighter for cards */
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #333a4d;
}

[data-theme="dark"] .sidebar {
    background: #1e222d;
}

[data-theme="dark"] .card {
    background-color: var(--bg-surface);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .btn-outline {
    border-color: var(--border-color);
    color: var(--text-main);
}

[data-theme="dark"] .btn-outline:hover {
    background: rgba(255,255,255,0.05);
}

/* Theme Dropdown */
.theme-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 1rem;
}

.theme-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.theme-toggle-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-main);
}

[data-theme="dark"] .theme-toggle-btn:hover {
    background: rgba(255,255,255,0.1);
}

.theme-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    min-width: 150px;
    z-index: 1050;
    padding: 0.5rem 0;
    display: none; /* Hidden by default */
}

.theme-menu.show {
    display: block;
}

.theme-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}

.theme-item:hover {
    background: rgba(0,0,0,0.05);
}

[data-theme="dark"] .theme-item:hover {
    background: rgba(255,255,255,0.05);
}

.theme-item i {
    width: 24px;
    margin-right: 0.5rem;
    color: var(--text-muted);
}

.theme-item.active {
    color: var(--primary);
    background: rgba(50, 31, 219, 0.1);
}

.theme-item.active i {
    color: var(--primary);
}

/* ==========================================================
   SPA Navigation Styles (Progress Bar & Transitions)
   ========================================================== */

#nprogress {
    pointer-events: none;
}

#nprogress .bar {
    background: var(--primary);
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    box-shadow: 0 0 10px var(--primary);
}

.content-body {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.spa-loading {
    opacity: 0.5;
    transform: translateY(5px);
    pointer-events: none;
}

.fade-in-content {
    animation: fadeInContent 0.4s ease forwards;
}

@keyframes fadeInContent {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================
   Global UI Components (Reusable)
   ========================================================== */

/* Avatars */
.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.avatar-sq {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.avatar-sq img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 2px;
}

/* Background Utilities (Soft) */
.bg-soft-primary { background-color: rgba(50, 31, 219, 0.1) !important; }
.bg-soft-success { background-color: rgba(46, 184, 92, 0.1) !important; }
.bg-soft-info { background-color: rgba(51, 153, 255, 0.1) !important; }
.bg-soft-warning { background-color: rgba(249, 177, 21, 0.1) !important; }
.bg-soft-danger { background-color: rgba(229, 83, 83, 0.1) !important; }

/* Badge Styles (Soft Colors) */
.badge-soft-primary { background-color: rgba(50, 31, 219, 0.1); color: var(--primary); }
.badge-soft-success { background-color: rgba(46, 184, 92, 0.1); color: var(--success); }
.badge-soft-info { background-color: rgba(51, 153, 255, 0.1); color: var(--info); }
.badge-soft-warning { background-color: rgba(249, 177, 21, 0.1); color: var(--warning); }
.badge-soft-danger { background-color: rgba(229, 83, 83, 0.1); color: var(--danger); }

[data-theme='dark'] .badge-soft-primary { background-color: rgba(50, 31, 219, 0.2); }
[data-theme='dark'] .badge-soft-success { background-color: rgba(46, 184, 92, 0.2); }
[data-theme='dark'] .badge-soft-info { background-color: rgba(51, 153, 255, 0.2); }

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    position: relative;
}

.status-indicator.bg-success::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    background: inherit;
    animation: pulse-success 2s infinite;
}

@keyframes pulse-success {
    0% { transform: scale(1); opacity: 0.8; }
    70% { transform: scale(2.5); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

/* Table Enhancements */
.table th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.table td {
    vertical-align: middle;
}

/* Utils */
.font-weight-600 { font-weight: 600; }
.opacity-5 { opacity: 0.5; }
.opacity-2 { opacity: 0.2; }
.bg-soft-primary { background-color: rgba(50, 31, 219, 0.1); }

/* Empty State Styling */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: block;
    color: var(--text-muted);
    opacity: 0.2;
}

.empty-state h4 {
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    max-width: 300px;
    margin: 0 auto;
}


/* ==========================================================
   Utility Classes (Missing from Bootstrap)
   ========================================================== */
.d-flex { display: flex !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-end { align-items: flex-end !important; }
.flex-column { flex-direction: column !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mr-3 { margin-right: 1rem !important; }

.ml-1 { margin-left: 0.25rem !important; }
.ml-auto { margin-left: auto !important; }

.p-0 { padding: 0 !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }

.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-uppercase { text-transform: uppercase !important; }

.shadow-sm { box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important; }
.border-0 { border: 0 !important; }


/* Responsive Header */
@media (max-width: 768px) {
    .module-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .module-header .btn {
        width: 100%;
        margin-top: 1rem;
    }
    
    .module-header h1 {
        font-size: 1.5rem;
    }
}


/* ==========================================================
   Custom Modal System
   ========================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1040; /* Lower than SweetAlert (1060) */
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show {
    display: block !important;
    opacity: 1;
}

.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--bg-surface);
    color: var(--text-main);
    width: 100%;
    max-width: 650px;
    margin: 0 !important;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1045; /* Lower than SweetAlert (1060) */
}

.modal-overlay.show .modal-container {
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background-color: rgba(0,0,0,0.02);
}

/* Form layouts inside modal */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 576px) {
    .form-grid { grid-template-columns: 1fr; }
}

.form-group { margin-bottom: 0.75rem; }
.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.35rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.4rem 0.75rem;
    font-size: 11px !important;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
    height: auto !important;
}

.form-control-sm {
    padding: 0.3rem 0.6rem !important;
    font-size: 11px !important;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(50, 31, 219, 0.1);
}


/* ==========================================================
   DataTables Premium Styling
   ========================================================== */
.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter {
    padding: 1.25rem 1.5rem;
    color: var(--text-main);
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    background: var(--bg-surface);
    color: var(--text-main);
    margin-left: 0.5rem;
}

.dataTables_wrapper .dataTables_info {
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 1rem 1.5rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-surface) !important;
    color: var(--text-main) !important;
    margin-left: 4px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--bg-body) !important;
    color: var(--primary) !important;
}

/* Fix table header spacing with DataTables */
table.dataTable thead th {
    border-bottom: 1px solid var(--border-color) !important;
}

table.dataTable.no-footer {
    border-bottom: 1px solid var(--border-color) !important;
}


/* ==========================================================
   DataTables Premium Fixes (Custom Theme)
   ========================================================== */
.dataTables_wrapper {
    padding: 0 !important;
}

/* Control Row (Search and Length) */
.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter {
    padding: 1.5rem !important;
    display: flex;
    align-items: center;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    margin: 0 0.75rem !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 0.5rem 1rem !important;
    background: var(--bg-surface) !important;
    color: var(--text-main) !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Table styling fixes */
table.dataTable {
    border-collapse: collapse !important;
    width: 100% !important;
    margin: 0 !important;
    border: none !important;
}

table.dataTable thead th {
    background: var(--bg-body) !important;
    padding: 1rem 1.5rem !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--border-color) !important;
    text-align: left !important;
}

table.dataTable tbody td {
    padding: 1.25rem 1.5rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    vertical-align: middle !important;
}

/* Pagination and Info footer */
.dataTables_wrapper .dataTables_info {
    padding: 1.5rem !important;
    font-size: 0.85rem !important;
    color: var(--text-muted) !important;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 1.5rem !important;
    display: flex !important;
    gap: 5px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid var(--border-color) !important;
    background: var(--bg-surface) !important;
    border-radius: 8px !important;
    padding: 0.4rem 0.8rem !important;
    color: var(--text-main) !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) {
    background: var(--bg-body) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Remove default sort icons and add custom ones if needed */
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    display: none !important;
}


/* Extra DataTables Refinements */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    text-decoration: none !important;
    color: var(--text-main) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    color: white !important;
}

/* Fix for overlapping elements on small screens */
@media (max-width: 768px) {
    .dataTables_wrapper .d-flex.justify-content-between {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 0.5rem !important;
    }
}


/* ==========================================================
   DataTables ULTRA-PREMIUM Refinements
   ========================================================== */
.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

/* Pagination Buttons Fix */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    color: #666 !important;
    padding: 6px 12px !important;
    margin: 0 2px !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #ccc !important;
    background: #f9f9f9 !important;
}

/* Search Box refinement */
.dataTables_wrapper .dataTables_filter input {
    border: 2px solid #f0f0f0 !important;
    transition: all 0.3s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary) !important;
    background: white !important;
}

/* Remove default DataTables background images for sorting */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    background-image: none !important;
    position: relative;
    cursor: pointer;
}

/* Custom Sorting Icons using pseudo-elements */
table.dataTable thead .sorting::after {
    content: '\f0dc';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 10px;
    opacity: 0.3;
    font-size: 0.7rem;
}

table.dataTable thead .sorting_asc::after {
    content: '\f0de';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 10px;
    opacity: 1;
    color: var(--primary);
}

table.dataTable thead .sorting_desc::after {
    content: '\f0dd';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 10px;
    opacity: 1;
    color: var(--primary);
}

/* Fix table cell alignment */
table.dataTable thead th {
    padding-right: 25px !important; /* Space for icon */
}

/* Dark Mode support for DataTables internal parts */
[data-theme='dark'] .dataTables_wrapper .dataTables_paginate .paginate_button {
    background: #2a2a2a !important;
    border-color: #444 !important;
    color: #eee !important;
}

[data-theme='dark'] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: white !important;
}

[data-theme='dark'] .dataTables_wrapper .dataTables_filter input,
[data-theme='dark'] .dataTables_wrapper .dataTables_length select {
    background: #1a1a1a !important;
    border-color: #333 !important;
    color: white !important;
}


/* DataTables Header Sorting Clean-up */
table.dataTable thead .sorting::before,
table.dataTable thead .sorting_asc::before,
table.dataTable thead .sorting_desc::before,
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    content: '' !important;
}

/* Add custom sorting icons that look better */
table.dataTable thead .sorting {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNhYmFjYWQiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cGF0aCBkPSJNNyAxNWw1IDUgNS01TTE3IDlsLTUtNS01IDUiLz48L3N2Zz4=') !important;
    background-repeat: no-repeat !important;
    background-position: center right 10px !important;
    background-size: 12px !important;
}

table.dataTable thead .sorting_asc {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMzMjFmZGIiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cGF0aCBkPSJNNyAxNWw1LTUgNS01Ii8+PC9zdmc+') !important;
    background-repeat: no-repeat !important;
    background-position: center right 10px !important;
    background-size: 12px !important;
}

table.dataTable thead .sorting_desc {
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMzMjFmZGIiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cGF0aCBkPSJNNyA5bDUgNSA1LTUiLz48L3N2Zz4=') !important;
    background-repeat: no-repeat !important;
    background-position: center right 10px !important;
    background-size: 12px !important;
}

/* Shadow utilities for buttons */
.shadow-xs { box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important; }
.gap-2 { gap: 0.5rem !important; }


/* Pagination Text Color Fix */
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    color: #ffffff !important;
}

/* Ensure pagination buttons look consistent */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-main) !important;
}


/* Better visibility for Next/Prev buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.dataTables_wrapper .dataTables_paginate .paginate_button.next {
    font-weight: 600 !important;
    background: var(--bg-body) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    background: transparent !important;
    border-color: transparent !important;
    opacity: 0.3 !important;
}


/* ULTRA-SPECIFIC FIX FOR PAGINATION */
div.dataTables_wrapper div.dataTables_paginate a.paginate_button.current,
div.dataTables_wrapper div.dataTables_paginate a.paginate_button.current:hover {
    color: #ffffff !important;
    background: var(--primary) !important;
}

div.dataTables_wrapper div.dataTables_paginate a.paginate_button:not(.current) {
    color: var(--text-main) !important;
}

div.dataTables_wrapper div.dataTables_paginate a.paginate_button.disabled,
div.dataTables_wrapper div.dataTables_paginate a.paginate_button.disabled:hover,
div.dataTables_wrapper div.dataTables_paginate a.paginate_button.disabled:active {
    color: #ccc !important;
}


/* ==========================================================
   Compact Table (11px) and Tight Spacing
   ========================================================== */
.dataTables_wrapper, 
table.dataTable, 
.dataTables_wrapper .dataTables_info, 
.dataTables_wrapper .dataTables_paginate {
    font-size: 11px !important;
}

/* Tight padding for cells */
table.dataTable thead th {
    padding: 8px 12px !important;
    font-weight: 700 !important;
}

table.dataTable tbody td {
    padding: 6px 12px !important;
}

/* Adjust avatar size for compact table */
.avatar-circle {
    width: 24px !important;
    height: 24px !important;
    font-size: 10px !important;
    margin-right: 8px !important;
}

/* Small badges */
.badge {
    padding: 2px 6px !important;
    font-size: 9px !important;
}

/* Smaller action buttons */
.btn-sm {
    padding: 2px 6px !important;
    font-size: 10px !important;
}

/* Compact controls */
.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter {
    padding: 10px 15px !important;
    font-size: 11px !important;
}

.dataTables_wrapper .dataTables_length select, 
.dataTables_wrapper .dataTables_filter input {
    padding: 3px 8px !important;
    font-size: 11px !important;
    height: auto !important;
}

/* Tighten the gaps */
.gap-2 { gap: 4px !important; }


/* Extra compaction for user info */
.font-weight-600.text-main {
    line-height: 1.1 !important;
}

.small.text-muted {
    font-size: 10px !important;
}

.status-indicator {
    width: 6px !important;
    height: 6px !important;
}


/* Ultra-compact pagination buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 3px 10px !important;
    font-size: 11px !important;
    border-radius: 6px !important;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 10px 15px !important;
}


/* ==========================================================
   Premium UI Enhancements (Unified)
   ========================================================== */

/* Modern Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(157, 165, 177, 0.3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(157, 165, 177, 0.5); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); }

/* Glassmorphism Modals (Dark Theme Overrides) */

html[data-theme="dark"] .modal-container {
    background-color: #161b22 !important;
    border-color: #30363d !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

html[data-theme="dark"] .modal-header {
    border-bottom: 1px solid #30363d !important;
}

html[data-theme="dark"] .modal-footer {
    border-top: 1px solid #30363d !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
}

/* Sidebar Dropdowns & Submenus */
.sidebar-nav-item.has-dropdown { position: relative; }
.sidebar-nav-item.open .sidebar-nav-dropdown-toggle { 
    opacity: 1; 
    color: white; 
}
.sidebar-nav-dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between !important;
}
.sidebar-nav-dropdown-toggle .arrow {
    font-size: 0.65rem;
    transition: transform 0.3s ease;
    opacity: 0.5;
    margin-right: 0.5rem;
}
.sidebar-nav-item.open .sidebar-nav-dropdown-toggle .arrow { transform: rotate(90deg); opacity: 1; }

.sidebar-nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0 8px; /* Margen lateral para el bloque */
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px; /* Bordes redondeados para el contenedor */
}
.sidebar-nav-item.open .sidebar-nav-submenu { max-height: 200px; padding: 4px 0; margin-bottom: 8px; }

.sidebar-nav-submenu .sidebar-nav-link {
    padding-left: 2rem !important;
    font-size: 0.8rem;
    height: 36px;
    opacity: 0.6;
    border-left: none !important;
    margin: 2px 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}
.sidebar-nav-submenu .sidebar-nav-link i {
    font-size: 0.8rem;
    width: 24px;
    margin-right: 0.5rem;
    text-align: center;
    opacity: 0.8;
}
.sidebar-nav-submenu .sidebar-nav-link:hover { 
    opacity: 1; 
    background: rgba(255, 255, 255, 0.05) !important; 
}
.sidebar-nav-submenu .sidebar-nav-link.active { 
    opacity: 1; 
    background: var(--primary) !important; 
    color: white !important;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(50, 31, 219, 0.3); /* Sombra más suave y colorida */
}

/* Entrance Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

/* Premium Sidebar Active State */
.sidebar-nav-link.active {
    background: rgba(50, 31, 219, 0.15) !important;
    border-left: 4px solid var(--primary);
    color: white !important;
    padding-left: 12px !important;
}

/* NProgress Customization */
#nprogress .bar { background: var(--primary) !important; height: 3px !important; }
#nprogress .spinner-icon { border-top-color: var(--primary) !important; border-left-color: var(--primary) !important; }

/* Dark Mode Form Improvements */
[data-theme="dark"] .form-control {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] select.form-control {
    appearance: none; 
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem !important;
}
[data-theme="dark"] select option {
    background-color: #212332 !important;
    color: white !important;
}
[data-theme="dark"] .form-control:focus {
    background-color: rgba(0, 0, 0, 0.3) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(50, 31, 219, 0.25) !important;
}
[data-theme="dark"] label {
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 500 !important;
}

/* Custom Checkboxes */
.form-check-input {
    width: 1.2rem !important;
    height: 1.2rem !important;
    margin-right: 0.5rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    border-radius: 4px;
    appearance: none;
    transition: all 0.2s ease;
}
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
    background-size: 100% 100%;
}

[data-theme="dark"] .modal-header { border-bottom-color: rgba(255,255,255,0.05) !important; }
[data-theme="dark"] .modal-footer { border-top-color: rgba(255,255,255,0.05) !important; background: rgba(0,0,0,0.1) !important; }

/* Autofill Fix for Dark Mode */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus {
    -webkit-text-fill-color: white !important;
    -webkit-box-shadow: 0 0 0px 1000px #212332 inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Real-time Validation Styles (Subtle) */
.form-control:valid:not(:placeholder-shown) { border-color: #2eb85c !important; box-shadow: 0 0 0 2px rgba(46, 184, 92, 0.1) !important; }
.form-control:invalid:not(:placeholder-shown) { border-color: #e55353 !important; box-shadow: 0 0 0 2px rgba(229, 83, 83, 0.1) !important; }

/* Password Toggle Positioning */
.password-wrapper { position: relative; }
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    z-index: 10;
}
.password-toggle:hover { color: var(--primary); }

/* Compact DataTable Pagination */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 22px !important;
    min-width: 22px !important;
    padding: 0 8px !important;
    margin: 0 2px !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    line-height: 1 !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-surface) !important;
    color: var(--text-main) !important;
    cursor: pointer !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary) !important;
    color: white !important;
}
.dataTables_wrapper .dataTables_info {
    font-size: 11px !important;
    color: var(--text-muted) !important;
}
.dataTables_wrapper .dataTables_length select, 
.dataTables_wrapper .dataTables_filter input {
    font-size: 11px !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-surface) !important;
    color: var(--text-main) !important;
}

/* Responsive Tweaks */
@media (max-width: 768px) {
    .header-nav { gap: 0.5rem !important; }
    .user-info-box { display: none !important; }
    .logout-text { display: none !important; }
    .content-body { padding: 0.75rem !important; }
    .module-header { flex-direction: column !important; align-items: stretch !important; gap: 1rem !important; }
    .module-header .btn { width: 100% !important; }
    
    .dataTables_wrapper .dataTables_length, 
    .dataTables_wrapper .dataTables_filter { 
        flex-direction: column !important; 
        align-items: stretch !important; 
        padding: 1rem !important; 
        gap: 0.5rem !important;
    }
    .dataTables_wrapper .dataTables_filter input { margin: 0 !important; width: 100% !important; }
    
    .datatable th:nth-child(2), .datatable td:nth-child(2),
    .datatable th:nth-child(4), .datatable td:nth-child(4) {
        display: none !important;
    }

    .sidebar-nav-item {
        opacity: 0;
        transform: translateX(-20px);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar.sidebar-show .sidebar-nav-item {
        opacity: 1;
        transform: translateX(0);
    }
    .sidebar-nav-item:nth-child(1) { transition-delay: 0.1s; }
    .sidebar-nav-item:nth-child(2) { transition-delay: 0.15s; }
    .sidebar-nav-item:nth-child(3) { transition-delay: 0.2s; }
    .sidebar-nav-item:nth-child(4) { transition-delay: 0.25s; }
    .sidebar-nav-item:nth-child(5) { transition-delay: 0.3s; }
    .sidebar-nav-item:nth-child(6) { transition-delay: 0.35s; }
    .sidebar-nav-item:nth-child(7) { transition-delay: 0.4s; }
    .sidebar-nav-item:nth-child(8) { transition-delay: 0.45s; }
    .sidebar-nav-item:nth-child(9) { transition-delay: 0.5s; }
}

/* Sidebar Link Animations */
.sidebar-nav-link { transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important; }
.sidebar-nav-link:hover:not(.active) {
    padding-left: 1.5rem !important;
    background: rgba(255, 255, 255, 0.05) !important;
    color: white !important;
}

/* Back to Top Button Refinement */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: var(--primary) !important;
    color: white !important;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999 !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
}
#backToTop i {
    font-size: 1.2rem;
    line-height: 1;
}
#backToTop:hover { 
    transform: translateY(-5px); 
    background: #2a1ab9 !important; 
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
#backToTop.show { 
    display: flex; 
    animation: fadeInUpButton 0.3s forwards; 
}
@keyframes fadeInUpButton {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Premium Status Badges */
.badge-pill {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-soft-success { background: rgba(46, 184, 92, 0.15); color: #2eb85c; }
.badge-soft-danger { background: rgba(229, 83, 83, 0.15); color: #e55353; }
.badge-soft-warning { background: rgba(249, 177, 21, 0.15); color: #f9b115; }
.badge-soft-info { background: rgba(51, 153, 255, 0.15); color: #3399ff; }

/* Premium Soft Buttons */
.btn-soft-primary { background: rgba(50, 31, 219, 0.1) !important; color: var(--primary) !important; border: none !important; }
.btn-soft-primary:hover { background: rgba(50, 31, 219, 0.2) !important; }
.btn-soft-info { background: rgba(51, 153, 255, 0.1) !important; color: #3399ff !important; border: none !important; }
.btn-soft-info:hover { background: rgba(51, 153, 255, 0.2) !important; }
.btn-soft-success { background: rgba(46, 184, 92, 0.1) !important; color: #2eb85c !important; border: none !important; }
.btn-soft-success:hover { background: rgba(46, 184, 92, 0.2) !important; }
.btn-soft-danger { background: rgba(229, 83, 83, 0.1) !important; color: #e55353 !important; border: none !important; }
.btn-soft-danger:hover { background: rgba(229, 83, 83, 0.2) !important; }

/* Dropdown No-Caret Utility */
.no-caret::after { display: none !important; }

/* Card Hover Lift */
.card { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
[data-theme="dark"] .card:hover { box-shadow: 0 10px 25px rgba(0,0,0,0.4); }

@media (max-width: 768px) {
    .sidebar { height: 100% !important; }
}
table.dataTable { width: 100% !important; }

/* ==========================================================
   Autofill Overrides (Neutralize Browser Defaults)
   ========================================================== */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--bg-surface) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* ==========================================================
   Google Drive Style - Premium Module Styles
   ========================================================== */

/* Breadcrumb Polishing */
.drive-breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}
.drive-breadcrumb-item {
    display: flex;
    align-items: center;
    color: var(--text-muted);
}
.drive-breadcrumb-item:not(:last-child)::after {
    content: "\f054";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-left: 8px;
    font-size: 0.65rem;
    opacity: 0.4;
}
.drive-breadcrumb-item.active {
    color: var(--primary);
    font-weight: 700;
}
.drive-breadcrumb-item a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}
.drive-breadcrumb-item a:hover {
    color: var(--primary);
}

/* Drive Layout Container */
.drive-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.85rem;
}

/* Folder Pill Design */
.drive-folder-pill {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.01);
    min-width: 0; /* Permite que el grid item se encoja correctamente */
}
.drive-folder-pill:hover {
    border-color: var(--primary);
    background: var(--bg-surface-alt);
    transform: translateY(-1.5px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.04);
}
.drive-folder-pill > div {
    min-width: 0; /* Permite que los flex children de la píldora se encojan y disparen el text-ellipsis */
}
.folder-icon-wrapper {
    width: 28px;
    height: 28px;
    background: rgba(249, 177, 21, 0.1);
    color: #f9b115;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0; /* Evita que el icono se deforme */
}
.drive-folder-pill .folder-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-main);
    white-space: normal;
    word-break: break-word;
    width: 100%;
    line-height: 1.25;
}

/* File Card Design */
.drive-file-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
}
.drive-file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.05);
    border-color: var(--primary);
}
.file-preview-area {
    height: 90px;
    background: #f8f9fc;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
[data-theme='dark'] .file-preview-area { background: #2a2a35; }

.file-type-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}

.file-info-area {
    padding: 10px;
    border-top: 1px solid var(--border-color);
}
.file-name-label {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-main);
    display: block;
    margin-bottom: 4px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}
.file-meta-label {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Actions Menu */
.file-hover-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    opacity: 0;
    transform: translateY(-3px);
    transition: all 0.15s ease;
    display: flex;
    gap: 4px;
    z-index: 10;
}
.drive-file-card:hover .file-hover-actions {
    opacity: 1;
    transform: translateY(0);
}
.btn-action-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: var(--text-main);
    transition: all 0.15s;
    font-size: 0.75rem;
}
.btn-action-circle:hover {
    background: var(--primary);
    color: white;
}
.btn-action-circle.btn-delete:hover {
    background: var(--danger);
}

/* Section Titles */
.drive-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 2rem 0 1rem;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    gap: 10px;
}
.drive-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(0,0,0,0.05);
}

/* Empty State Modern */
.drive-empty-state {
    padding: 100px 0;
    text-align: center;
    background: rgba(0,0,0,0.01);
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    margin-top: 20px;
}
.empty-icon-box {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    font-size: 2.5rem;
    color: var(--primary);
    opacity: 0.8;
}
