/* Admin Panel Design System - Plus Jakarta Sans & Premium Slate Palette */
:root {
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Elegant Indigo & Dark Slate Palette */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #06b6d4;
    --info-light: #ecfeff;
    
    --dark-bg: #0f172a;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-text: #94a3b8;
    --sidebar-active-text: #ffffff;
    
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --navbar-bg: rgba(255, 255, 255, 0.8);
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --table-header-bg: #f8fafc;
    --table-hover-bg: #f1f5f9;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-text: #1e293b;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
}

[data-bs-theme="dark"] {
    --body-bg: #0f172a;
    --card-bg: #1e293b;
    --navbar-bg: rgba(30, 41, 59, 0.8);
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --table-header-bg: #1e293b;
    --table-hover-bg: #334155;
    --input-bg: #0f172a;
    --input-border: #334155;
    --input-text: #f8fafc;
    
    --primary-light: rgba(79, 70, 229, 0.15);
    --success-light: rgba(16, 185, 129, 0.15);
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger-light: rgba(239, 68, 68, 0.15);
    --info-light: rgba(6, 182, 212, 0.15);
}

body {
    font-family: var(--font-family);
    background-color: var(--body-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Page Layout */
#wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

#sidebar .brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.025em;
    white-space: nowrap;
}

#sidebar .brand img.brand-logo {
    max-height: 36px;
    width: auto;
    object-fit: contain;
    margin-right: 0.75rem;
    transition: all 0.3s ease;
}

#sidebar .brand i {
    color: var(--primary);
    margin-right: 0.75rem;
}

#sidebar .menu-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

/* Custom Scrollbar for Sidebar */
#sidebar .menu-container::-webkit-scrollbar {
    width: 4px;
}
#sidebar .menu-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu .menu-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 0.85rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.sidebar-menu li a i {
    font-size: 1.15rem;
    margin-right: 0.85rem;
    width: 20px;
    text-align: center;
    transition: transform 0.2s ease;
}

.sidebar-menu li a:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-active-text);
}

.sidebar-menu li a:hover i {
    transform: scale(1.1);
}

.sidebar-menu li.active > a {
    background-color: var(--primary);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.sidebar-menu li.active > a i {
    color: #ffffff;
}

/* Collapsed Sidebar State */
body.sidebar-collapsed #sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed #sidebar .brand span,
body.sidebar-collapsed #sidebar .menu-header,
body.sidebar-collapsed #sidebar .menu-container span {
    display: none;
}

body.sidebar-collapsed #sidebar .brand {
    justify-content: center;
    padding: 0;
}

body.sidebar-collapsed #sidebar .brand img.brand-logo {
    margin-right: 0 !important;
}

body.sidebar-collapsed #sidebar .brand i {
    margin-right: 0;
    font-size: 1.5rem;
}

body.sidebar-collapsed #sidebar .sidebar-menu li a {
    justify-content: center;
    padding: 0.75rem 0;
}

body.sidebar-collapsed #sidebar .sidebar-menu li a i {
    margin-right: 0;
    font-size: 1.25rem;
}

/* Main Content Layout */
#content-wrapper {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.sidebar-collapsed #content-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Navbar Styling */
.top-navbar {
    height: var(--header-height);
    background-color: var(--navbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.toggle-sidebar-btn {
    border: none;
    background: transparent;
    font-size: 1.25rem;
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.toggle-sidebar-btn:hover {
    background-color: var(--border-color);
}

/* Dashboard Cards (Ecommerce Focus) */
.dashboard-stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.dashboard-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.dashboard-stat-card .stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.dashboard-stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-primary .stat-icon { background-color: var(--primary-light); color: var(--primary); }
.stat-success .stat-icon { background-color: var(--success-light); color: var(--success); }
.stat-warning .stat-icon { background-color: var(--warning-light); color: var(--warning); }
.stat-danger .stat-icon { background-color: var(--danger-light); color: var(--danger); }

/* Card Styling */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.5rem;
}

/* GridView Overrides */
.grid-view {
    padding: 0;
}

.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    background-color: var(--table-header-bg);
    border-top: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.table-hover tbody tr:hover {
    background-color: var(--table-hover-bg);
}

/* Pagination Overrides */
.pagination {
    margin-top: 1.5rem;
    margin-bottom: 0;
    justify-content: flex-end;
}

.pagination .page-item .page-link {
    border-color: var(--border-color);
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.pagination .page-item .page-link:hover {
    background-color: var(--table-hover-bg);
    color: var(--primary);
}

/* ActiveForm Styling */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--input-text);
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    border-radius: 0.375rem;
}

.form-control:focus, .form-select:focus {
    background-color: var(--input-bg);
    color: var(--input-text);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: #94a3b8;
}

/* Breadcrumbs overrides */
.breadcrumb {
    margin-bottom: 0;
    background: transparent;
    padding: 0;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* Button UI */
.btn {
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.55rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

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

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

/* Modal Styling */
.modal-content {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

/* Flash alerts / Toasts */
.alert-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1060;
    max-width: 350px;
}
.alert-toast {
    animation: slideInRight 0.3s ease forwards;
    box-shadow: var(--shadow-lg);
    border-radius: 0.5rem;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive adjust */
@media(max-width: 991.98px) {
    #sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    #content-wrapper {
        margin-left: 0 !important;
    }
    body.sidebar-open #sidebar {
        margin-left: 0;
    }
    body.sidebar-open #content-wrapper {
        margin-left: 0;
    }
}

/* Global Dark Mode Utility Overrides */
[data-bs-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}
[data-bs-theme="dark"] .text-muted {
    color: var(--text-secondary) !important;
}
[data-bs-theme="dark"] .bg-light {
    background-color: var(--body-bg) !important;
}
[data-bs-theme="dark"] .bg-white {
    background-color: var(--card-bg) !important;
}
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border {
    border-color: var(--border-color) !important;
}
[data-bs-theme="dark"] .btn-light {
    background-color: #334155;
    border-color: #475569;
    color: #f8fafc;
}
[data-bs-theme="dark"] .btn-light:hover {
    background-color: #475569;
    border-color: #64748b;
    color: #ffffff;
}
[data-bs-theme="dark"] .dropdown-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
}
[data-bs-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}
[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: var(--body-bg);
    color: #ffffff;
}
[data-bs-theme="dark"] .dropdown-divider {
    border-color: var(--border-color);
}
[data-bs-theme="dark"] .card-header {
    background-color: transparent !important;
    border-color: var(--border-color) !important;
}
[data-bs-theme="dark"] .card-footer {
    background-color: transparent !important;
    border-color: var(--border-color) !important;
}
[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: #0f172a;
}
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #334155;
}

/* Custom Red Tooltip for Sortable Grids */
.sortable-info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.sortable-info-tooltip .sortable-tooltip-trigger {
    background-color: var(--danger-light, #fef2f2);
    color: var(--danger, #ef4444);
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 50rem;
    cursor: help;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.sortable-info-tooltip .sortable-tooltip-trigger:hover {
    background-color: var(--danger, #ef4444);
    color: #ffffff;
    border-color: var(--danger, #ef4444);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.sortable-info-tooltip .sortable-tooltip-text {
    visibility: hidden;
    width: 240px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    text-align: center;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    position: absolute;
    z-index: 1050;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    font-size: 0.775rem;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
    pointer-events: none;
}

.sortable-info-tooltip .sortable-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #dc2626 transparent transparent transparent;
}

.sortable-info-tooltip:hover .sortable-tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
