/* Modern Design Tokens */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --info: #0ea5e9;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --sidebar-width: 280px;
    --border-radius: 1rem;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    background: #f8fafc;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(139, 92, 246, 0.05) 0px, transparent 50%);
    color: var(--dark);
    font-family: 'Outfit', 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

.glass-card {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
}

/* Sidebar Styling */
#sidebar {
    background: transparent !important;
}

.sidebar-container {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05) !important;
}

.shadow-primary {
    box-shadow: 0 8px 16px -4px rgba(99, 102, 241, 0.4);
}

.op-6 {
    opacity: 0.6;
}

.nav-link {
    color: #64748b;
    border-radius: 12px;
    margin: 0.1rem 0;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.06);
    color: var(--primary);
    transform: translateX(6px);
}

.nav-link.active {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    color: var(--white) !important;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.25);
}

.nav-link.active i {
    color: rgba(255, 255, 255, 0.9);
}

.hover-shadow:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.transition-all {
    transition: all 0.2s ease;
}

/* Main Content Area */
main {
    padding: 0;
    transition: all 0.3s ease-in-out;
}

@media (min-width: 768px) {
    main {
        margin-left: var(--sidebar-width) !important;
        width: calc(100% - var(--sidebar-width)) !important;
    }
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    body {
        padding-top: 4.5rem !important;
        padding-bottom: 8rem !important;
        /* Prevents sticky footer from covering content */
    }

    main {
        padding: 0.75rem;
        margin-left: 0 !important;
    }

    .offcanvas-md {
        width: 100% !important;
    }

    .glass-card {
        border-radius: 1rem;
    }

    .offcanvas-end {
        width: 100% !important;
        border-radius: 0 !important;
    }

    .offcanvas-header {
        padding: 1.5rem !important;
    }

    .sticky-bottom-footer {
        padding: 1.5rem !important;
        background: white !important;
        border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
    }

    .mobile-top-nav {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
    }

    .mobile-top-nav .transition-all {
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-content-wrapper {
        position: relative;
    }

    .opacity-0 {
        opacity: 0 !important;
    }

    .opacity-100 {
        opacity: 1 !important;
    }

    .translate-y-0 {
        transform: translateY(0) scale(1) !important;
    }

    .translate-y-up {
        transform: translateY(-30px) scale(0.9) !important;
    }

    .translate-y-down {
        transform: translateY(30px) scale(0.9) !important;
    }

    .w-fit-content {
        width: fit-content;
    }
}

/* Table Styling */
.table {
    --bs-table-bg: transparent;
}

.table thead th {
    background: rgba(0, 0, 0, 0.02);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--secondary);
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

/* Ticket Cards for Mobile */
.ticket-card {
    background: var(--white);
    border-radius: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stats Cards Redesign */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 1.25rem !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
}

.stat-card.primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

.stat-card.primary .text-muted,
.stat-card.primary .text-dark {
    color: rgba(255, 255, 255, 0.9) !important;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    border-radius: 50%;
}

.card-icon-bg {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.stat-card.primary .card-icon-bg {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Collapsible Entry Row Styles */
.entry-row-header {
    cursor: pointer;
    transition: background 0.2s ease;
}

.entry-row-header:hover {
    background: rgba(99, 102, 241, 0.05);
}

.toggle-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.collapsed .toggle-icon {
    transform: rotate(-180deg);
}

.entry-row-body {
    max-height: 500px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
}

.collapsed .entry-row-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

@media (max-width: 768px) {
    .entry-row-header {
        position: relative;
    }
}

/* Dashboard Specifics */
.hover-bg {
    transition: background 0.2s ease;
}

.hover-bg:hover {
    background: rgba(0, 0, 0, 0.03) !important;
}

.uppercase {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#week-mini-bars div {
    transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: help;
}

.table-primary {
    --bs-table-bg: rgba(99, 102, 241, 0.05);
}

.dropdown-menu.glass-card {
    border: 1px solid var(--glass-border);
}

.badge.bg-opacity-10 {
    font-weight: 700;
}

.sticky-actions-bar {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    z-index: 1020;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 100px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .sticky-actions-bar {
        position: static;
        background: transparent;
        backdrop-filter: none;
        border: none;
        box-shadow: none;
        padding: 0;
        margin-top: 2rem;
        border-radius: 0;
    }
}

/* Global Loader System */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.global-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-logo {
    width: 120px;
    height: 120px;
    margin-bottom: 30px;
    animation: loaderPulse 2s infinite ease-in-out;
    filter: drop-shadow(0 10px 20px rgba(99, 102, 241, 0.15));
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: loaderSpin 1s linear infinite;
    position: relative;
}

.loader-spinner::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 4px solid transparent;
    border-bottom: 4px solid rgba(79, 70, 229, 0.4);
    border-radius: 50%;
    animation: loaderSpin 1.5s linear infinite reverse;
}

.loader-text {
    margin-top: 25px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    letter-spacing: 0.5px;
    font-size: 1.1rem;
    animation: loaderTextFade 2s infinite;
}

@keyframes loaderSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes loaderPulse {
    0% {
        transform: scale(0.9);
        opacity: 0.8;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0.9);
        opacity: 0.8;
    }
}

@keyframes loaderTextFade {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.border-dashed {
    border: 1px dashed rgba(0, 0, 0, 0.1) !important;
}

.sticky-bottom-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Toast Styling */
.toast-container {
    z-index: 2000;
}

.toast {
    background: transparent !important;
    border: none !important;
}

.toast .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Loader Hidden Class */
.global-loader.hidden {
    display: none !important;
}

.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loader-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 2rem;
    animation: loader-pulse 2s infinite;
}

@keyframes loader-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: loader-spin 1s linear infinite;
}

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

.loader-text {
    margin-top: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
    letter-spacing: 0.05rem;
}