/* ===================================
   Admin Dashboard CSS - صيدليتي
   Professional Design System
   =================================== */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Tajawal:wght@300;400;500;700&display=swap');

/* ===== Design Tokens ===== */
:root {
    /* Layout */
    --sidebar-width: 260px;
    --navbar-height: 64px;

    /* Colors - Light */
    --bg-body: #f0f2f5;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
    --bg-sidebar-active: rgba(99, 102, 241, 0.15);
    --sidebar-text: rgba(255, 255, 255, 0.65);
    --sidebar-text-active: #ffffff;
    --sidebar-accent: #818cf8;
    --sidebar-border: rgba(255, 255, 255, 0.06);

    --bg-card: #ffffff;
    --bg-navbar: #ffffff;
    --bg-input: #ffffff;
    --bg-hover-row: #f8fafc;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.08);
    --accent-lighter: rgba(99, 102, 241, 0.04);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Dark Theme Tokens ===== */
[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-sidebar: #020617;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.04);
    --bg-sidebar-active: rgba(99, 102, 241, 0.2);
    --sidebar-border: rgba(255, 255, 255, 0.04);

    --bg-card: #1e293b;
    --bg-navbar: #1e293b;
    --bg-input: #1e293b;
    --bg-hover-row: #273449;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;
    --border-light: #1e293b;

    --accent-light: rgba(99, 102, 241, 0.15);
    --accent-lighter: rgba(99, 102, 241, 0.06);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Inter', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

[dir="rtl"] body {
    font-family: 'Tajawal', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

a {
    text-decoration: none;
}

/* ===== Sidebar ===== */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

[dir="ltr"] .admin-sidebar {
    left: 0;
}

[dir="rtl"] .admin-sidebar {
    right: 0;
}

.admin-sidebar::-webkit-scrollbar {
    width: 4px;
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Sidebar Header / Brand */
.sidebar-header {
    padding: 0 1.25rem;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-header h4 {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    letter-spacing: -0.01em;
}

.sidebar-header h4 i {
    color: var(--sidebar-accent);
    font-size: 1.35rem;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 0.75rem 0.65rem;
    flex: 1;
}

.sidebar-nav .nav {
    gap: 2px;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 0.6rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-size: 0.875rem;
    font-weight: 400;
    white-space: nowrap;
    position: relative;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--sidebar-text-active);
}

.sidebar-nav .nav-link.active {
    background: var(--bg-sidebar-active);
    color: var(--sidebar-text-active);
    font-weight: 500;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: -0.65rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--sidebar-accent);
    border-radius: 0 3px 3px 0;
}

[dir="rtl"] .sidebar-nav .nav-link.active::before {
    left: auto;
    right: -0.65rem;
    border-radius: 3px 0 0 3px;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.8;
}

.sidebar-nav .nav-link.active i {
    opacity: 1;
    color: var(--sidebar-accent);
}

/* Sidebar section label */
.sidebar-section-label {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem 0.85rem 0.4rem;
    margin: 0;
}

/* ===== Main Content Area ===== */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin var(--transition);
}

[dir="ltr"] .admin-main {
    margin-left: var(--sidebar-width);
}

[dir="rtl"] .admin-main {
    margin-right: var(--sidebar-width);
}

/* ===== Top Navbar ===== */
.admin-navbar {
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.75rem;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--shadow-xs);
    backdrop-filter: blur(10px);
}

.admin-navbar .page-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.05rem;
    margin: 0;
    letter-spacing: -0.01em;
}

.sidebar-toggle {
    color: var(--text-secondary);
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    border: none;
    background: none;
}

.sidebar-toggle:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* Navbar buttons */
.navbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all var(--transition);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
}

.navbar-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.navbar-dropdown-btn {
    height: 36px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all var(--transition);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 0.7rem;
    font-weight: 500;
}

.navbar-dropdown-btn:hover,
.navbar-dropdown-btn.show {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

/* User avatar in navbar */
.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== Content Area ===== */
.admin-content {
    padding: 1.5rem 1.75rem;
    flex: 1;
    max-width: 100%;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header-left h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-header-left p {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.card-body {
    padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
    border-radius: var(--radius-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.04;
    transform: translate(30px, -30px);
}

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

.stat-card .card-body {
    padding: 1.25rem;
    position: relative;
    z-index: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.icon-primary {
    background: var(--accent-light);
    color: var(--accent);
}

.stat-icon.icon-success {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.icon-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.icon-info {
    background: var(--info-bg);
    color: var(--info);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.1rem;
}

/* ===== Tables ===== */
.table-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-card .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.table {
    color: var(--text-primary);
    margin: 0;
    font-size: 0.875rem;
}

.table thead th {
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

[data-theme="dark"] .table thead th {
    background: rgba(0, 0, 0, 0.15);
}

.table tbody td {
    vertical-align: middle;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.table tbody td:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

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

.table-hover tbody tr:hover {
    background: var(--bg-hover-row) !important;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== Badges ===== */
.badge-role {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    border-radius: 50px;
    letter-spacing: 0.01em;
}

.badge-admin {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.05));
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.badge-pharmacy {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.05));
    color: #4f46e5;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.badge-customer {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.05));
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.badge-deliveryman {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.05));
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.15);
}

.badge-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-active {
    background: var(--success-bg);
    color: var(--success);
}

.badge-inactive {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

.badge-count {
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
}

.badge-perm {
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
    display: inline-block;
    margin: 0.15rem;
}

.badge-guard {
    background: rgba(100, 116, 139, 0.08);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* ===== Buttons ===== */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-light-primary {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid transparent;
}

.btn-light-primary:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
}

/* Action Button Group */
.action-btns {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all var(--transition);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.action-btn.edit:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.action-btn.delete:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger);
}

.action-btn.restore:hover {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

.action-btn.view:hover {
    background: var(--info-bg);
    color: var(--info);
    border-color: var(--info);
}

/* ===== Forms ===== */
.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    transition: all var(--transition);
}

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

.form-control::placeholder {
    color: var(--text-muted);
}

.form-text,
.form-control+small {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-check-input {
    border-color: var(--border-color);
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.15rem;
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--accent-light);
    border-color: var(--accent);
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Form card styling */
.form-card {
    border-radius: var(--radius-lg);
}

.form-card .card-body {
    padding: 1.75rem;
}

.form-section-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.permission-group {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.permission-group-header {
    background: var(--bg-body);
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: capitalize;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .permission-group-header {
    background: rgba(0, 0, 0, 0.15);
}

.permission-group-body {
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Search bar */
.search-box {
    position: relative;
}

.search-box .form-control {
    padding-left: 2.2rem;
    border-radius: var(--radius-sm);
    width: 260px;
}

[dir="rtl"] .search-box .form-control {
    padding-left: 0.85rem;
    padding-right: 2.2rem;
}

.search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

[dir="rtl"] .search-box .search-icon {
    left: auto;
    right: 0.75rem;
}

/* ===== Alerts ===== */
.alert {
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    border: none;
    padding: 0.85rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: alertSlideIn 0.35s ease;
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
}

[data-theme="dark"] .alert-success {
    color: #6ee7b7;
}

.alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
}

[data-theme="dark"] .alert-danger {
    color: #fca5a5;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

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

/* ===== Dropdown Menus ===== */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.4rem;
    min-width: 160px;
    animation: dropdownFade 0.15s ease;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

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

.dropdown-item {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--accent-light);
    color: var(--accent);
}

.dropdown-item.text-danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.dropdown-divider {
    border-color: var(--border-color);
    margin: 0.3rem 0;
}

/* ===== Pagination ===== */
.pagination {
    gap: 3px;
}

.page-link {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm) !important;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    transition: all var(--transition);
}

.page-link:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.page-item.disabled .page-link {
    background: var(--bg-body);
    color: var(--text-muted);
    border-color: var(--border-color);
}

/* ===== Detail / Show Page ===== */
.detail-group {
    margin-bottom: 1.25rem;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 0.75rem;
    display: block;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Soft-deleted row ===== */
.row-trashed {
    opacity: 0.6;
}

.row-trashed td {
    text-decoration: line-through;
    text-decoration-color: var(--text-muted);
}

.row-trashed td:last-child {
    text-decoration: none;
}

/* ===== User cell with avatar ===== */
.user-cell {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.user-cell-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.user-cell-info {
    line-height: 1.3;
}

.user-cell-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.user-cell-email {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    [dir="rtl"] .admin-sidebar {
        transform: translateX(100%);
    }

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

    .admin-main {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .sidebar-overlay {
        display: block;
    }

    .search-box .form-control {
        width: 200px;
    }
}

@media (max-width: 576px) {
    .admin-content {
        padding: 1rem;
    }

    .admin-navbar {
        padding: 0 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-box .form-control {
        width: 100%;
    }
}

/* ===== Sidebar Overlay (mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1045;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
}

/* ===== Code tag ===== */
code {
    font-size: 0.8rem;
    background: var(--accent-lighter);
    color: var(--accent);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="dark"] code {
    background: rgba(99, 102, 241, 0.15);
}

/* ===== Utilities ===== */
.gap-6 {
    gap: 1.5rem !important;
}

.fw-600 {
    font-weight: 600 !important;
}

.fs-sm {
    font-size: 0.85rem !important;
}

.text-accent {
    color: var(--accent) !important;
}

/* Nice scrollbar for content */
.admin-main::-webkit-scrollbar {
    width: 6px;
}

.admin-main::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* ===== Welcome banner ===== */
.welcome-banner {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.welcome-banner h3 {
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
    position: relative;
    z-index: 1;
}

.welcome-banner p {
    opacity: 0.85;
    font-size: 0.9rem;
    margin: 0;
    position: relative;
    z-index: 1;
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-body);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-card .card-body {
    padding: 2rem;
}

.login-card .form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.login-card .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ===== Select2 Theme Integration ===== */
.select2-container--bootstrap-5 .select2-selection {
    background-color: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
    min-height: 38px;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
    border-radius: 4px;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.select2-container--bootstrap-5 .select2-dropdown {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

.select2-container--bootstrap-5 .select2-results__option {
    color: var(--text-primary);
}

.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
    background-color: var(--accent);
    color: #fff;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    background-color: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* ===== Product Gallery ===== */
.gallery-thumb {
    position: relative;
    display: inline-block;
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-delete-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(220, 53, 69, 0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.gallery-delete-btn:hover {
    background: rgba(220, 53, 69, 1);
}