:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-accent: #a855f7;
    --gradient-main: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --gradient-hover: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    --gradient-hero: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    --bg-body: #0f0f13;
    --bg-card: #1a1a23;
    --bg-card-hover: #21212d;
    --bg-elevated: #24242f;
    --border-color: #2d2d3d;
    --border-accent: #3d3d5c;
    --text-primary: #e8e8f0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
    --glass-bg: rgba(26, 26, 35, 0.85);
    --glass-border: rgba(255, 255, 255, 0.06);
}

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

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.2); }
    50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.4); }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

* { scrollbar-width: thin; scrollbar-color: #3d3d5c #1a1a23; }
*::-webkit-scrollbar { width: 6px; }
*::-webkit-scrollbar-track { background: #1a1a23; }
*::-webkit-scrollbar-thumb { background: #3d3d5c; border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: #6366f1; }

html { scroll-behavior: smooth; }

[data-bs-theme="dark"] body,
body.dark-theme,
body {
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    animation: fadeIn 0.3s ease;
}

/* ─── Glass Navbar ─── */
.navbar {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(15, 15, 19, 0.9) !important;
    border-bottom: 1px solid var(--glass-border);
    animation: fadeIn 0.4s ease;
}
.navbar.bg-primary {
    background: var(--glass-bg) !important;
}
.navbar .navbar-brand {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.navbar .nav-link {
    position: relative;
    transition: color 0.3s ease;
}
.navbar .nav-link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 70%;
    height: 2px;
    background: var(--gradient-main);
    transition: transform 0.3s ease;
    border-radius: 2px;
}
.navbar .nav-link:hover::after,
.navbar .nav-link.active::after {
    transform: translateX(-50%) scaleX(1);
}
.navbar .nav-link:hover {
    color: var(--primary-light) !important;
}
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
}

/* ─── Buttons ─── */
.btn {
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.btn-primary {
    background: var(--gradient-main);
    border: none;
}
.btn-primary:hover {
    background: var(--gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.35);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: none;
}
.btn-success:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.35);
}
.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    border: none;
}
.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.35);
}
.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary-light);
}
.btn-outline-primary:hover {
    background: var(--gradient-main);
    border-color: transparent;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}
.btn-outline-light:hover {
    background: var(--gradient-main);
    border-color: transparent;
    transform: translateY(-2px);
}
.btn-outline-secondary {
    border-color: var(--border-accent);
    color: var(--text-secondary);
}
.btn-outline-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    color: var(--primary-light);
}
.btn-sm { border-radius: 8px; }

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.4s ease both;
}
.card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.card-header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
    border-radius: 14px 14px 0 0 !important;
    color: var(--text-primary);
    font-weight: 700;
}
.card.border-0 {
    border: 1px solid var(--border-color) !important;
}
.card-footer {
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 14px 14px !important;
}

/* ─── Product Cards ─── */
.product-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease both;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
}
.product-card:nth-child(1) { animation-delay: 0.05s; }
.product-card:nth-child(2) { animation-delay: 0.1s; }
.product-card:nth-child(3) { animation-delay: 0.15s; }
.product-card:nth-child(4) { animation-delay: 0.2s; }
.product-card:nth-child(5) { animation-delay: 0.25s; }
.product-card:nth-child(6) { animation-delay: 0.3s; }
.product-card:nth-child(7) { animation-delay: 0.35s; }
.product-card:nth-child(8) { animation-delay: 0.4s; }
.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), var(--shadow-glow);
    border-color: var(--border-accent);
}
.product-card .card-img-top {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 200px;
    object-fit: cover;
}
.product-card:hover .card-img-top {
    transform: scale(1.08);
}
.product-card .card-body {
    padding: 1rem;
}
.product-card .card-title {
    font-weight: 600;
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-card .card-text.price {
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── Hero Section ─── */
.hero-section {
    background: var(--gradient-hero);
    background-size: 200% 200%;
    animation: gradient-shift 8s ease infinite;
    border-bottom: 1px solid var(--border-accent);
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.hero-section h1 {
    font-weight: 800;
    font-size: 2.5rem;
    line-height: 1.2;
}
.hero-section .lead {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
}

/* ─── Tables ─── */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    margin-bottom: 0;
}
.table > :not(caption) > * > * {
    border-bottom-color: var(--border-color);
    padding: 0.85rem 0.75rem;
}
.table thead {
    background: var(--bg-elevated);
}
.table thead th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}
.table-hover > tbody > tr:hover {
    --bs-table-hover-bg: rgba(99, 102, 241, 0.05);
    --bs-table-hover-color: var(--text-primary);
}
.table-light {
    --bs-table-bg: var(--bg-elevated);
    --bs-table-color: var(--text-primary);
}

/* ─── Form Controls ─── */
.form-control, .form-select {
    background-color: #15151e;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 10px;
    transition: all 0.3s ease;
}
.form-control:focus, .form-select:focus {
    background-color: #15151e;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    color: var(--text-primary);
}
.form-control::placeholder {
    color: var(--text-muted);
}
.form-control-sm { border-radius: 8px; }
.form-label {
    color: var(--text-secondary);
    font-weight: 500;
}
.form-check-input {
    background-color: #15151e;
    border-color: var(--border-accent);
}
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ─── Modals ─── */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-header {
    border-bottom: 1px solid var(--border-color);
    border-radius: 16px 16px 0 0;
    background: var(--bg-elevated);
}
.modal-footer {
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 16px 16px;
    background: var(--bg-elevated);
}
.modal-backdrop.show {
    opacity: 0.7;
}
.btn-close {
    filter: invert(1) brightness(0.8);
}

/* ─── Alerts ─── */
.alert {
    border-radius: 12px;
    border: none;
}
.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}
.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.alert-info {
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ─── Badges ─── */
.badge {
    font-weight: 600;
    padding: 0.35em 0.75em;
    border-radius: 8px;
}
.badge.bg-primary { background: var(--gradient-main) !important; }
.badge.bg-success { background: linear-gradient(135deg, #059669, #10b981) !important; }
.badge.bg-danger { background: linear-gradient(135deg, #dc2626, #ef4444) !important; }
.badge.bg-warning { background: linear-gradient(135deg, #d97706, #f59e0b) !important; }
.badge.bg-info { background: linear-gradient(135deg, #6366f1, #818cf8) !important; }
.badge.bg-secondary { background: linear-gradient(135deg, #4b5563, #6b7280) !important; }

/* ─── Breadcrumb ─── */
.breadcrumb {
    background: none;
    padding: 0;
}
.breadcrumb-item a {
    color: var(--primary-light);
    text-decoration: none;
}
.breadcrumb-item.active {
    color: var(--text-secondary);
}
.breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

/* ─── Toast Container ─── */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

/* ─── Dropdown ─── */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
.dropdown-item {
    color: var(--text-primary);
    border-radius: 8px;
    transition: all 0.2s ease;
}
.dropdown-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
}
.dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}
.dropdown-divider {
    border-top-color: var(--border-color);
}

/* ─── Footer ─── */
footer {
    background: #0a0a0f !important;
    border-top: 1px solid var(--border-color);
}
footer h5, footer h6 {
    color: var(--text-primary) !important;
}
footer .text-white-50 {
    color: var(--text-secondary) !important;
}
footer a.text-white-50:hover {
    color: var(--primary-light) !important;
}
.hover-text-white:hover { color: var(--primary-light) !important; }
footer a { transition: color 0.3s ease; }

/* ─── Pagination ─── */
.page-link {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    margin: 0 2px;
    transition: all 0.3s ease;
}
.page-link:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    color: var(--primary-light);
}
.page-item.active .page-link {
    background: var(--gradient-main);
    border-color: transparent;
}

/* ─── Utilities ─── */
.bg-light {
    background-color: var(--bg-elevated) !important;
}
.bg-dark {
    background-color: #0a0a0f !important;
}
.text-muted {
    color: var(--text-secondary) !important;
}
.text-primary {
    color: var(--primary-light) !important;
}
a {
    color: var(--primary-light);
    transition: color 0.3s ease;
}
a:hover {
    color: var(--secondary-accent);
}
hr {
    border-color: var(--border-color);
    opacity: 0.5;
}

/* ─── Hover Shadow ─── */
.hover-shadow {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-shadow:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4) !important;
}

/* ─── Cart Badge ─── */
.cart-badge {
    font-size: 0.6rem;
    animation: float 3s ease-in-out infinite;
}

/* ─── Sticky Top ─── */
.sticky-top {
    z-index: 1020;
}

/* ─── Price Display ─── */
.price-display {
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* ─── Login/Register Forms ─── */
.login-form, .register-form {
    max-width: 420px;
    margin: 0 auto;
}
.login-form .card, .register-form .card {
    border: 1px solid var(--border-accent);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* ─── Timeline / Status Steps ─── */
.status-timeline .step {
    position: relative;
}
.status-timeline .step::before {
    background: var(--border-color);
}
.status-timeline .step.completed::before {
    background: var(--gradient-main);
}

/* ─── Number Input ─── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
}

/* ─── Navbar Toggler ─── */
.navbar-toggler {
    border-color: var(--border-accent);
}
.navbar-toggler-icon {
    filter: brightness(0.8);
}

/* ─── Modal Animation ─── */
.modal.fade .modal-dialog {
    transform: scale(0.95) translateY(-10px);
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
}

/* ─── List Group ─── */
.list-group-item {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.list-group-item:hover {
    background: var(--bg-card-hover);
}

/* ─── Progress Bars ─── */
.progress {
    background: var(--bg-elevated);
    border-radius: 10px;
}
.progress-bar {
    background: var(--gradient-main);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem !important;
    }
    .hero-section h1 {
        font-size: 1.5rem;
    }
    .hero-section::before,
    .hero-section::after {
        display: none;
    }
    .product-card .card-img-top {
        height: 160px;
    }
    .container-fluid.py-4 {
        padding: 1rem !important;
    }
}

/* ─── Input Group ─── */
.input-group .btn-light {
    background: var(--bg-elevated);
    border-color: var(--border-color);
    color: var(--text-primary);
}
.input-group .btn-light:hover {
    background: var(--border-accent);
    border-color: var(--border-accent);
}

/* ─── Close Button ─── */
.btn-close {
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23e8e8f0'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
}

/* ─── Table Image ─── */
.table img.rounded {
    border: 2px solid var(--border-color);
}

/* ─── Extra Glow for featured elements ─── */
.glow-border {
    border-color: var(--primary) !important;
    box-shadow: var(--shadow-glow);
}

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

/* Sidebar Overlay (mobile only) */
.admin-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.admin-sidebar-overlay.show {
    opacity: 1;
}

/* Sidebar */
.admin-sidebar {
    width: 270px;
    flex-shrink: 0;
    background: var(--bg-body);
    border-right: 1px solid var(--border-color);
    z-index: 1045;
}

@media (min-width: 992px) {
    .admin-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
    }

    .admin-sidebar-overlay {
        display: none !important;
    }
}

@media (max-width: 991.98px) {
    .admin-sidebar-overlay {
        display: block;
        pointer-events: none;
    }
    .admin-sidebar-overlay.show {
        pointer-events: auto;
    }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
    }

    .admin-sidebar.show {
        transform: translateX(0);
    }
}

.admin-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    overflow-y: auto;
}

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

.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.2rem;
    font-weight: 800;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

.admin-brand i {
    -webkit-text-fill-color: initial;
    color: var(--primary-light);
    font-size: 1.4rem;
}

.admin-nav {
    flex: 1;
    padding: 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-nav-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0.75rem 0.75rem 0.35rem;
    font-weight: 700;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.admin-nav-item i {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.admin-nav-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary-light);
}

.admin-nav-item.active {
    background: var(--gradient-main);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.admin-nav-item.active i {
    color: #fff;
}

.admin-nav-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171 !important;
}

.admin-sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0.85rem;
    margin-top: 0.25rem;
    border-radius: 10px;
    background: var(--bg-elevated);
    font-size: 0.8rem;
}

.admin-user-info i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.admin-content {
    flex: 1;
    min-width: 0;
    padding-top: 0;
    animation: fadeIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

.admin-content-header {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1025;
}

@media (max-width: 991.98px) {
    .admin-content-header {
        display: flex;
    }
}

/* Sidebar scrollbar */
.admin-sidebar-inner::-webkit-scrollbar {
    width: 4px;
}
.admin-sidebar-inner::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}
