@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backface-visibility: hidden;
}

/* HIGH-PERFORMANCE MOBILE OPTIMIZATION */
@media (max-width: 1024px) {
    .glass-card, 
    .sidebar-glass, 
    .toast, 
    #modal-overlay, 
    .modal-content,
    .loader-overlay,
    .liquid-glass {
        /* User explicitly wants to keep blurs on mobile */
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
        background: rgba(15, 23, 42, 0.85) !important;
        transform: translate3d(0, 0, 0); /* Hardware acceleration */
        will-change: transform, opacity;
    }
}

.sidebar-glass {
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    transform: translate3d(0, 0, 0);
}

.sidebar-open {
    transform: translate3d(0, 0, 0) !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 1024px) {
    .sidebar-glass {
        transform: translate3d(-100%, 0, 0);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

.col-hidden {
    display: none !important;
}

.nav-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 16px !important;
    font-size: 0.825rem;
    font-weight: 500;
    color: #94a3b8;
    position: relative;
    gap: 12px !important;
    margin-bottom: 4px;
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: #f8fafc;
}

.nav-link:hover:not(.active) {
    background: rgba(255, 255, 255, 0.03);
    color: #f1f5f9;
    transform: translateX(4px);
}

/* Calendar/Date Input Styling */
input[type="date"] {
    position: relative;
    color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
    z-index: 10;
}

input[type="date"]::after {
    content: '\f073';
    /* Calendar icon if using font-awesome, but we use ionicons in HTML */
    position: absolute;
    right: 12px;
    color: var(--primary);
    pointer-events: none;
}

/* Chrome/Safari modern calendar theme */
::-webkit-datetime-edit {
    padding: 0.5em;
}

::-webkit-datetime-edit-fields-wrapper {
    background: transparent;
}

::-webkit-datetime-edit-text {
    color: var(--text-muted);
    padding: 0 0.3em;
}

::-webkit-datetime-edit-month-field {
    color: var(--text-main);
}

::-webkit-datetime-edit-day-field {
    color: var(--text-main);
}

::-webkit-datetime-edit-year-field {
    color: var(--text-main);
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary {
    background: var(--primary);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.2);
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 1;
        transform: none;
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.animate-fade-in {
    opacity: 1;
}

/* Mobile Nav */
.sidebar-open {
    transform: translate3d(0, 0, 0) !important;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    backdrop-filter: blur(4px);
}

/* Role Based Visibility (Flicker Prevention) */
.admin-only {
    display: none !important;
}

body.is-admin .admin-only {
    display: flex !important;
}

body.is-admin div.admin-only {
    display: block !important;
}

/* Modern Toast Notifications */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    pointer-events: auto;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    will-change: transform, opacity;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #f43f5e;
}

.toast.info {
    border-left: 4px solid #6366f1;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(120%) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.toast.fade-out {
    transform: translateX(120%) scale(0.9);
    opacity: 0;
}

/* Modern Confirmation System */
#modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
}

#modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Sidebar Navigation Refinement */
.nav-link.active {
    background: linear-gradient(to right, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
    color: #6366f1;
    border-right: 3px solid #6366f1;
}

.sync-container {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Visibility Control */
.col-hidden { display: none !important; }

.modal-content {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 440px;
    border-radius: 32px;
    padding: 40px;
    transform: scale(0.9) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

#modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-icon-circle {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 32px;
    border-width: 1px;
    border-style: solid;
}

.modal-title {
    font-size: 24px;
    font-weight: 900;
    color: white;
    margin-bottom: 12px;
    letter-spacing: -0.025em;
}

.modal-body {
    color: #94a3b8;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 32px;
    font-weight: 500;
}

.modal-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-btn {
    padding: 16px 24px;
    border-radius: 18px;
    font-weight: 800;
    font-size: 13px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    border: none;
    outline: none;
}

.modal-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-btn-primary {
    background: #6366f1;
    color: white;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.modal-btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.4);
}

/* Stolen Indicator */
.stat-card-stolen {
    border-color: rgba(244, 63, 94, 0.3) !important;
    background: linear-gradient(to bottom right, rgba(244, 63, 94, 0.05), rgba(0, 0, 0, 0)) !important;
}

.stat-value-stolen {
    color: #f43f5e !important;
    text-shadow: 0 0 20px rgba(244, 63, 94, 0.4);
}


/* Premium Cyber Orbital Loader */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: #0a0c10;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.cyber-spinner {
    position: relative;
    width: 64px;
    height: 64px;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    border-top-color: #6366f1;
    border-right-color: #6366f1;
    animation: cyber-spin 0.8s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.6));
}

@keyframes cyber-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spinner-pulse {
    position: absolute;
    inset: -16px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    animation: spinner-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes spinner-ping {

    75%,
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.gradient-text-pulse {
    background: linear-gradient(to right, #6366f1, #a855f7, #6366f1);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}