:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --sidebar-bg: #224abe; /* Gradient start */
    --sidebar-bg-end: #4e73df; /* Gradient end */
    --sidebar-width: 250px;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background-color: #f3f4f6;
    color: #111827;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--primary-color) 10%, #224abe 100%);
    color: #fff;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    transition: all 0.3s;
    z-index: 1000;
}

/* Mobile Sidebar & Header */
.mobile-header {
    background: linear-gradient(180deg, var(--primary-color) 10%, #224abe 100%);
    color: #fff;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        width: 250px;
        height: 100%;
        transition: 0.3s;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .content {
        padding: 1rem;
    }
}

.sidebar .brand {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.05rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 1rem;
}

.sidebar .brand i {
    font-size: 2rem;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.sidebar a.nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    display: block;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
    transition: all 0.2s;
}

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

.sidebar a.nav-link.active {
    color: #fff;
    font-weight: 700;
    border-left: 4px solid #fff;
    background: rgba(255, 255, 255, 0.15);
}

.sidebar a.nav-link i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.sidebar hr {
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 1rem 1rem;
}

/* Content Area */
.content {
    padding: 1.5rem;
    flex: 1;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.35rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 1.5rem;
    transition: transform 0.2s;
}

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

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    padding: 1rem 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.25rem;
}

/* Stats Cards */
.border-left-primary { border-left: 0.25rem solid var(--primary-color) !important; }
.border-left-success { border-left: 0.25rem solid var(--success-color) !important; }
.border-left-info { border-left: 0.25rem solid var(--info-color) !important; }
.border-left-warning { border-left: 0.25rem solid var(--warning-color) !important; }
.border-left-danger { border-left: 0.25rem solid var(--danger-color) !important; }

.text-gray-300 { color: #9ca3af !important; }
.text-gray-800 { color: #111827 !important; }

.text-gray-900 { color: #020617 !important; }

.text-muted { color: #6b7280 !important; }

.text-dark { color: #111827 !important; }

.bg-light { background-color: #f9fafb !important; }

.bg-white { background-color: #ffffff !important; }

.bg-dark { background-color: #111827 !important; color: #f9fafb !important; }

/* Tables */
.table {
    width: 100%;
    color: #111827;
    margin-bottom: 0;
    background-color: #ffffff;
}

.table th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05rem;
    border-top: none;
    background-color: #f3f4f6;
    color: #1f2937;
}

.table td {
    vertical-align: middle;
    background-color: #ffffff;
}

.table-bordered th,
.table-bordered td {
    border-color: #e5e7eb;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #f9fafb;
}

.table-hover tbody tr:hover {
    background-color: #e5efff;
}

.badge {
    padding: 0.5em 0.75em;
    font-weight: 700;
}

/* Modal (Log Content Popup) */
.modal-content {
    background-color: #ffffff;
    color: #111827;
}

.modal-header {
    border-bottom-color: #e5e7eb;
}

.modal-footer {
    border-top-color: #e5e7eb;
}

.modal-body {
    color: #111827;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: #2e59d9;
    text-decoration: underline;
}

/* Forms */
.form-control {
    border-radius: 0.35rem;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d3e2;
    font-size: 0.9rem;
}

.form-control:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.btn {
    border-radius: 0.35rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background-color: #2e59d9;
    border-color: #2653d4;
}

/* Auth Pages */
.bg-gradient-primary {
    background-color: var(--primary-color);
    background-image: linear-gradient(180deg, var(--primary-color) 10%, #224abe 100%);
    background-size: cover;
    min-height: 100vh;
}

.auth-card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.auth-card .card-body {
    padding: 3rem;
}

.auth-card {
    animation: authPop 0.55s cubic-bezier(0.2, 0.9, 0.2, 1);
    transform-origin: center;
}

.auth-form-wrap {
    animation: authSlideUp 0.55s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.auth-visual {
    position: relative;
    animation: authFade 0.8s ease-out;
}

.auth-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.35), rgba(59, 130, 246, 0.25));
}

.auth-mark {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(78, 115, 223, 0.12);
    color: var(--primary-color);
    border: 1px solid rgba(78, 115, 223, 0.18);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.auth-title {
    letter-spacing: -0.02em;
}

.auth-link {
    font-weight: 700;
}

.auth-recaptcha {
    transform-origin: left top;
}

.auth-card .form-control {
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, border-color 0.15s ease-out;
}

.auth-card .form-control:focus {
    transform: translateY(-1px);
}

.auth-card .btn-primary {
    position: relative;
    overflow: hidden;
}

.auth-card .btn-primary::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.25), transparent, rgba(255, 255, 255, 0.25));
    opacity: 0;
    transition: all 0.4s ease;
}

.auth-card .btn-primary:hover::after {
    left: 100%;
    opacity: 1;
}

@keyframes authPop {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes authFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 767.98px) {
    .auth-card .card-body {
        padding: 2rem 1.5rem;
    }

    .bg-login-image,
    .bg-register-image {
        display: none !important;
    }

    .auth-recaptcha {
        transform: scale(0.92);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card,
    .auth-form-wrap,
    .auth-visual,
    .container-fluid,
    .container {
        animation: none !important;
    }
}

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

.container-fluid, .container {
    animation: fadeIn 0.4s ease-out;
}

body.dark-mode {
    background-color: #020617;
    color: #e5e7eb;
}

body.dark-mode .card {
    background-color: #111827;
    color: #e5e7eb;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(15, 23, 42, 0.8);
}

body.dark-mode .card-header {
    background-color: #020617;
    border-bottom-color: #1f2937;
    color: #60a5fa;
}

body.dark-mode .sidebar {
    background: linear-gradient(180deg, #020617 10%, #111827 100%);
}

body.dark-mode .mobile-header {
    background: linear-gradient(180deg, #020617 10%, #111827 100%);
}

body.dark-mode .table {
    color: #d1d5db;
    background-color: #020617;
}

body.dark-mode .table th {
    background-color: #020617;
    color: #e5e7eb;
    border-bottom-color: #1f2937;
}

body.dark-mode .table td {
    color: #e5e7eb;
    background-color: #020617;
}

body.dark-mode .sidebar a.nav-link {
    color: rgba(249, 250, 251, 0.85);
}

body.dark-mode .sidebar a.nav-link:hover {
    color: #ffffff;
    background: rgba(55, 65, 81, 0.9);
}

body.dark-mode .sidebar a.nav-link.active {
    background: rgba(30, 64, 175, 0.9);
    border-left-color: #fbbf24;
}

body.dark-mode .form-control {
    background-color: #020617;
    border-color: #111827;
    color: #e5e7eb;
}

body.dark-mode .form-control:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.35);
}

body.dark-mode .text-gray-800 {
    color: #e5e7eb !important;
}

body.dark-mode .text-gray-300 {
    color: #4b5563 !important;
}

body.dark-mode .text-gray-900 {
    color: #f9fafb !important;
}

body.dark-mode .text-muted {
    color: #9ca3af !important;
}

body.dark-mode .text-dark {
    color: #e5e7eb !important;
}

body.dark-mode .bg-light,
body.dark-mode .bg-white {
    background-color: #111827 !important;
}

body.dark-mode .bg-dark {
    background-color: #020617 !important;
    color: #e5e7eb !important;
}

body.dark-mode .table-striped tbody tr:nth-of-type(odd) {
    background-color: #111827;
}

body.dark-mode .table-hover tbody tr:hover {
    background-color: #1f2937;
}

body.dark-mode .modal-content {
    background-color: #020617;
    color: #e5e7eb;
}

body.dark-mode .modal-header {
    border-bottom-color: #1f2937;
}

body.dark-mode .modal-footer {
    border-top-color: #1f2937;
}

body.dark-mode .modal-body {
    color: #e5e7eb;
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%);
}

body.dark-mode .bg-gradient-primary {
    background-image: linear-gradient(180deg, #020617 10%, #111827 100%);
}

body.dark-mode a {
    color: #93c5fd;
}

body.dark-mode a:hover {
    color: #bfdbfe;
}

body.dark-mode .badge.bg-secondary {
    background-color: #4b5563 !important;
    color: #e5e7eb;
}

body.dark-mode .badge.bg-success {
    background-color: #16a34a !important;
}

body.dark-mode .badge.bg-danger {
    background-color: #dc2626 !important;
}

.theme-toggle-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #111827;
    color: #f9fafb;
    border: none;
    box-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, 0.6);
    cursor: pointer;
    z-index: 1100;
}

.theme-toggle-btn i {
    font-size: 1.1rem;
}

body.dark-mode .theme-toggle-btn {
    background-color: #f9fafb;
    color: #020617;
}
