:root {
    --primary: #3DA5D9;
    --primary-gradient: linear-gradient(135deg, #3DA5D9, #E31E24);
    --secondary: #8392ab;
    --success: #2dce89;
    --info: #3DA5D9;
    --warning: #FFD600;
    --danger: #E31E24;
    --dark: #344767;
    --light: #f6f9fc;
    --white: #ffffff;

    --sidebar-bg: linear-gradient(180deg, #3DA5D9, #E31E24);
    --card-shadow: 0 10px 30px rgba(0,0,0,0.08);
    --card-radius: 20px;
    --btn-radius: 14px;
    --font-family: 'Outfit', sans-serif;
    --text-dim: #94a3b8;
}

body {
    font-family: var(--font-family) !important;
}

/* Sidebar Overhaul */
body .app-sidebar {
    background: var(--sidebar-bg) !important;
    border-right: 0 !important;
    box-shadow: 5px 0 20px rgba(0,0,0,0.1) !important;
}

.side-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
}

.side-menu__item {
    color: rgba(255,255,255,0.8) !important;
    border-radius: 12px !important;
    margin: 8px 15px !important;
    padding: 12px 15px !important;
    transition: 0.3s all ease !important;
}

.side-menu__item:hover {
    background: rgba(255,255,255,0.2) !important;
    color: white !important;
}

.side-menu__item.active {
    background: white !important;
    color: #E31E24 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
}

.side-menu__item.active .side-menu__icon,
.side-menu__item.active .side-menu__label {
    color: #E31E24 !important;
}

.side-menu__icon {
    color: rgba(255,255,255,0.8) !important;
    font-size: 1.1rem !important;
    margin-right: 12px !important;
}

.side-menu__label {
    font-weight: 600 !important;
}

.angle {
    color: rgba(255,255,255,0.8) !important;
}

/* Card Overhaul */
.card {
    border: none !important;
    border-radius: var(--card-radius) !important;
    box-shadow: var(--card-shadow) !important;
    position: relative;
    overflow: hidden;
    transition: 0.3s transform ease, 0.3s box-shadow ease !important;
    margin-bottom: 25px;
}

.card:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.12) !important;
}

.card::before {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    background: var(--warning);
    border-radius: 50%;
    top: -40px;
    right: -40px;
    opacity: 0.15;
    z-index: 0;
}

.card-body {
    position: relative;
    z-index: 1;
}

/* Dashboard Specific Styles */
.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.top-performer {
    background: var(--primary-gradient) !important;
    border-radius: 25px !important;
    color: white !important;
}

.top-performer h3, .top-performer h5, .top-performer p, .top-performer h2 {
    color: white !important;
}

/* Buttons */
.btn {
    border-radius: var(--btn-radius) !important;
    font-weight: 700 !important;
    padding: 10px 20px !important;
    transition: 0.3s transform ease !important;
    border: none !important;
}

.btn:hover {
    transform: scale(1.05);
}

.btn-primary {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(61, 165, 217, 0.3) !important;
}

.btn-danger {
    background: var(--danger) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(227, 30, 36, 0.3) !important;
}

.btn-warning {
    background: var(--warning) !important;
    color: #000 !important;
    box-shadow: 0 4px 15px rgba(255, 214, 0, 0.3) !important;
}

.btn-success {
    background: var(--success) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(45, 206, 137, 0.3) !important;
}

/* Tables */
.table-responsive {
    border-radius: 15px !important;
    overflow-x: auto !important;
}

.table thead th {
    background-color: var(--primary) !important;
    color: white !important;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 15px 20px !important;
    border: none !important;
}

.table tbody td {
    padding: 15px 20px !important;
    border-bottom: 1px solid #f0f2f5 !important;
}

html[data-theme="light"] .table tr:hover,
body:not(.dark-mode) .table tr:hover {
    background-color: #f8faff !important;
}

/* Badge Styles */
.badge {
    border-radius: 8px !important;
    padding: 6px 12px !important;
    font-weight: 700 !important;
}

/* Header/Navbar Enhancements */
.app-header {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 15px !important;
    margin: 15px 20px !important;
    width: calc(100% - 40px) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05) !important;
    border: 1px solid rgba(255,255,255,0.5) !important;
}

/* Responsive Fixes */
@media (max-width: 768px) {
    body .app-sidebar {
        position: fixed;
        z-index: 9999;
    }

    .card {
        margin-bottom: 15px;
    }

    .app-header {
        margin: 10px !important;
        width: calc(100% - 20px) !important;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

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

/* Dashboard Soft UI Styles */
.border-radius-xl { border-radius: 1rem !important; }
.border-radius-lg { border-radius: 0.75rem !important; }
.border-radius-md { border-radius: 0.5rem !important; }
.bg-white-transparent { background: rgba(255, 255, 255, 0.2); }
.bg-gray-100-hover:hover { background-color: #f8faf9ad !important; }
.hover-translate-y { transition: transform 0.2s ease; }
.hover-translate-y:hover { transform: translateY(-5px); }
.hover-translate-x { transition: transform 0.2s ease; }
.hover-translate-x:hover { transform: translateX(5px); }
.hover-bg-gray-50:hover { background-color: rgba(0,0,0,0.02); }
.opacity-1 { opacity: 0.1; }
.opacity-7 { opacity: 0.7; }
.opacity-8 { opacity: 0.8; }
.bg-gray-50 { background-color: #fcfcfcff; }
.text-xxs { font-size: 0.65rem !important; }
.customer-scroll::-webkit-scrollbar { width: 4px; }
.customer-scroll::-webkit-scrollbar-thumb { background: #e9ecef; border-radius: 10px; }
.customer-scroll::-webkit-scrollbar-track { background: transparent; }
.icon-shape {
    width: 48px;
    height: 48px;
    background-position: center;
    border-radius: 0.75rem;
}
.bg-gradient-primary { background-image: linear-gradient(310deg, #525ce5 0%, #a44de7 100%); }
.bg-gradient-success { background-image: linear-gradient(310deg, #2dce89 0%, #2dcecc 100%); }
.bg-gradient-info { background-image: linear-gradient(310deg, #11cdef 0%, #1171ef 100%); }
.bg-gradient-warning { background-image: linear-gradient(310deg, #fb6340 0%, #fbb140 100%); }
.bg-gradient-danger { background-image: linear-gradient(310deg, #fa94a9ff 0%, #f56036 100%); }
.bg-gradient-secondary { background-image: linear-gradient(310deg, #8392ab 0%, #71819a 100%); }
.bg-gradient-light { background-image: linear-gradient(310deg, #33516eff 0%, #4a779bff 100%); }

/* Custom Success Alert */
.alert-custom-success {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 300px;
}
.small-badge {
    font-size: 0.75rem;
    padding: 0.25em 0.4em;
    border-radius: 0.2rem;
}

/* Admin Login: Premium Aesthetic */
.admin-login-body {
    background-color: #0f172a;
    color: #f8fafc;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}
.admin-bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 100%);
}
.admin-login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    padding: 3.5rem;
    text-align: center;
    position: relative;
    z-index: 10;
}
.admin-badge-pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 99px;
    color: #6366f1;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
}
.form-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #f8fafc;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}
.form-subtitle {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-bottom: 2.5rem;
}
.input-group {
    text-align: left;
    margin-bottom: 1.5rem;
}
.input-label {
    display: block;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    margin-left: 0.5rem;
}
.modern-input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}
.admin-login-btn {
    width: 100%;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 1.1rem;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: 1rem;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}
.admin-login-btn:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.3);
}
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #1e293b inset !important;
    -webkit-text-fill-color: white !important;
    transition: background-color 5000s ease-in-out 0s;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Milestone Card */
.milestone-card {
    background: linear-gradient(135deg, #3DA5D9, #E31E24);
    border-radius: 20px;
}
.border-left-lg-white {
    border-left: 2px solid rgba(255,255,255,0.2);
}
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1) !important;
}
.tracking-wide {
    letter-spacing: 0.05em;
}
.bg-light-primary { background-color: rgba(61, 165, 217, 0.15) !important; }
.bg-light-success { background-color: rgba(45, 206, 137, 0.15) !important; }
.bg-light-warning { background-color: rgba(255, 214, 0, 0.2) !important; }
.bg-light-info { background-color: rgba(17, 205, 239, 0.15) !important; }
.bg-primary-gradient { background: var(--primary-gradient); }
.hover-shadow-sm:hover { box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.hover-text-primary:hover { color: var(--primary) !important; }
.hover-opacity:hover { opacity: 0.8; }

/* Table Enhancements */
.kids-table th {
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef !important;
}
.kids-table td {
    border-bottom: 1px solid #f8f9fa;
}
.hover-bg-light:hover {
    background-color: #f8fafc !important;
}

/* Customer Scrollbar */
.customer-scroll::-webkit-scrollbar {
    width: 5px;
}
.customer-scroll::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 10px;
}
.customer-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 10px;
}
.customer-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}

/* Today Sales Hiding Rows */
.total-today-sales-hidden .table-striped tbody tr:nth-of-type(odd),
.total-today-sales-hidden .table-striped tbody tr:nth-of-type(even) {
    display: none;
}

/* --- GLOBAL DARK MODE OVERRIDES FOR LEGACY BOOTSTRAP --- */
[data-theme="dark"] body,
.dark-mode body,
.dark body {
    background-color: #0f172a !important; /* Tailwind slate-900 */
    color: #f1f5f9 !important; /* Tailwind slate-100 */
}

[data-theme="dark"] .card,
.dark-mode .card,
.dark .card {
    background-color: #1e293b !important; /* Tailwind slate-800 */
    border-color: #334155 !important;
}

[data-theme="dark"] .card-header, 
.dark-mode .card-header,
.dark .card-header,
[data-theme="dark"] .card-footer,
.dark-mode .card-footer,
.dark .card-footer {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .table,
.dark-mode .table,
.dark .table {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd),
.dark-mode .table-striped tbody tr:nth-of-type(odd),
.dark .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

[data-theme="dark"] .table-hover tbody tr:hover,
.dark-mode .table-hover tbody tr:hover,
.dark .table-hover tbody tr:hover,
[data-theme="dark"] .table tr:hover,
.dark-mode .table tr:hover,
.dark .table tr:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .table td, 
.dark-mode .table td,
.dark .table td,
[data-theme="dark"] .table th,
.dark-mode .table th,
.dark .table th {
    border-color: #334155 !important; /* Tailwind slate-700 */
}

[data-theme="dark"] .table thead th,
.dark-mode .table thead th,
.dark .table thead th {
    background-color: #0f172a !important;
    border-bottom: 2px solid #334155 !important;
    color: #cbd5e1 !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_length, 
.dark-mode .dataTables_wrapper .dataTables_length,
.dark .dataTables_wrapper .dataTables_length,
[data-theme="dark"] .dataTables_wrapper .dataTables_filter, 
.dark-mode .dataTables_wrapper .dataTables_filter,
.dark .dataTables_wrapper .dataTables_filter,
[data-theme="dark"] .dataTables_wrapper .dataTables_info, 
.dark-mode .dataTables_wrapper .dataTables_info,
.dark .dataTables_wrapper .dataTables_info,
[data-theme="dark"] .dataTables_wrapper .dataTables_processing, 
.dark-mode .dataTables_wrapper .dataTables_processing,
.dark .dataTables_wrapper .dataTables_processing,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate,
.dark-mode .dataTables_wrapper .dataTables_paginate,
.dark .dataTables_wrapper .dataTables_paginate {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
.dark-mode .dataTables_wrapper .dataTables_filter input,
.dark .dataTables_wrapper .dataTables_filter input,
[data-theme="dark"] .dataTables_wrapper .dataTables_length select,
.dark-mode .dataTables_wrapper .dataTables_length select,
.dark .dataTables_wrapper .dataTables_length select {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
    border: 1px solid #334155 !important;
}

[data-theme="dark"] .modal-content,
.dark-mode .modal-content,
.dark .modal-content {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .modal-header, 
.dark-mode .modal-header,
.dark .modal-header,
[data-theme="dark"] .modal-footer,
.dark-mode .modal-footer,
.dark .modal-footer {
    border-color: #334155 !important;
}

[data-theme="dark"] .form-control,
.dark-mode .form-control,
.dark .form-control {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .form-control:focus,
.dark-mode .form-control:focus,
.dark .form-control:focus {
    background-color: #0f172a !important;
    color: #f1f5f9 !important;
}

/* Bulletproof Mobile Sidebar CSS */
html[dir="ltr"] #modern-sidebar {
    left: 0;
    right: auto;
}
html[dir="rtl"] #modern-sidebar {
    right: 0;
    left: auto;
}

@media (max-width: 767.98px) {
    html[dir="ltr"] #modern-sidebar {
        transform: translateX(-100%);
    }
    html[dir="rtl"] #modern-sidebar {
        transform: translateX(100%);
    }
    html[dir="ltr"] #modern-sidebar.sidebar-open,
    html[dir="rtl"] #modern-sidebar.sidebar-open {
        transform: translateX(0);
    }
}
@media (min-width: 768px) {
    #modern-sidebar {
        transform: translateX(0) !important;
    }
}
