/* ======================================================================
   We Know IT Ltd — Store CSS
   Bootstrap 5 companion stylesheet.
   Primary: #025add | Accent: #f97316 | Dark-mode aware
   ====================================================================== */

/* ------------------------------------------------------------------
   1. CSS Custom Properties
   ------------------------------------------------------------------ */
:root {
    --color-primary: #025add;
    --color-primary-hover: #0148b3;
    --color-primary-light: #e8f0fe;
    --color-primary-rgb: 2, 90, 221;

    --color-accent: #f97316;
    --color-accent-hover: #ea670c;
    --color-accent-light: #fff5eb;

    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-warning: #eab308;
    --color-info: #0ea5e9;

    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-heading: #0f172a;

    --color-bg: #f8fafc;
    --color-bg-card: #ffffff;
    --color-bg-sidebar: #0f172a;
    --color-border: #e2e8f0;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
    --shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, .07), 0 2px 4px rgba(0, 0, 0, .06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, .1), 0 4px 6px rgba(0, 0, 0, .05);

    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    --transition: 0.2s ease;
}

/* ------------------------------------------------------------------
   2. Dark Mode
   ------------------------------------------------------------------ */
body.dark,
:root.dark {
    --color-primary-light: #1a2744;
    --color-accent-light: #2d2013;

    --color-text: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-heading: #f1f5f9;

    --color-bg: #0f172a;
    --color-bg-card: #1e293b;
    --color-bg-sidebar: #020617;
    --color-border: #334155;

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

/* ------------------------------------------------------------------
   3. Base / Reset Tweaks
   ------------------------------------------------------------------ */
body {
    color: var(--color-text);
    background-color: var(--color-bg);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--color-primary-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ------------------------------------------------------------------
   4. Buttons
   ------------------------------------------------------------------ */
.btn-primary,
.btn-primary:active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #fff;
}

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

.btn-success {
    background-color: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}

.btn-danger {
    background-color: var(--color-danger);
    border-color: var(--color-danger);
    color: #fff;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    transition: all var(--transition);
}
.btn-outline:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background-color: var(--color-primary-light);
}

.btn {
    border-radius: var(--radius);
    font-weight: 500;
    transition: all var(--transition);
}

/* ------------------------------------------------------------------
   5. Store Header
   ------------------------------------------------------------------ */
.store-header {
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1040;
    box-shadow: var(--shadow-sm);
}

.store-header .logo img {
    height: 40px;
}

.store-header .header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.store-header .cart-icon {
    position: relative;
    font-size: 1.35rem;
    color: var(--color-text);
    cursor: pointer;
    transition: color var(--transition);
}
.store-header .cart-icon:hover {
    color: var(--color-primary);
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--color-accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 999px;
    padding: 0 4px;
}

/* ------------------------------------------------------------------
   6. Search Bar
   ------------------------------------------------------------------ */
.search-bar {
    position: relative;
    max-width: 480px;
    width: 100%;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.15);
}

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

/* ------------------------------------------------------------------
   7. Category Sidebar & Chips
   ------------------------------------------------------------------ */
.category-sidebar {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: sticky;
    top: 80px;
}

.category-sidebar h5 {
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.category-sidebar .list-group-item {
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.9rem;
}
.category-sidebar .list-group-item:hover,
.category-sidebar .list-group-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.category-chip {
    display: inline-block;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-card);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.category-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.category-chip.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* ------------------------------------------------------------------
   8. Product Grid & Cards
   ------------------------------------------------------------------ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1199.98px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767.98px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 479.98px) {
    .product-grid { grid-template-columns: 1fr; }
}

.product-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-card .card-img-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: var(--color-bg);
}
.product-card .card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.product-card:hover .card-img-wrapper img {
    transform: scale(1.05);
}

.product-card .sale-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    z-index: 2;
}

.product-card .card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-card .product-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-heading);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
}

.product-card .original-price {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-decoration: line-through;
    margin-left: 0.5rem;
}

.product-card .card-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--color-border);
    background: transparent;
    margin-top: auto;
}

/* ------------------------------------------------------------------
   9. Product Detail
   ------------------------------------------------------------------ */
.product-detail .product-gallery {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-bg);
}

.product-detail .product-info h1 {
    font-weight: 700;
    color: var(--color-heading);
}

.product-detail .product-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
}

.product-detail .product-description {
    color: var(--color-text-muted);
    line-height: 1.7;
}

.product-detail .qty-selector {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.product-detail .qty-selector button {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background var(--transition);
}
.product-detail .qty-selector button:hover {
    background: var(--color-primary-light);
}
.product-detail .qty-selector input {
    width: 50px;
    height: 40px;
    border: none;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    text-align: center;
    font-weight: 600;
    background: var(--color-bg-card);
    color: var(--color-text);
}

/* ------------------------------------------------------------------
   10. Cart Sidebar
   ------------------------------------------------------------------ */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: var(--color-bg-card);
    border-left: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    z-index: 1060;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}
.cart-sidebar.open {
    right: 0;
}

.cart-sidebar .cart-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cart-sidebar .cart-header h5 {
    margin: 0;
    font-weight: 700;
    color: var(--color-heading);
}

.cart-sidebar .cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

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

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1055;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ------------------------------------------------------------------
   11. Cart Item
   ------------------------------------------------------------------ */
.cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
    align-items: center;
}
.cart-item:last-child {
    border-bottom: none;
}

.cart-item .item-img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--color-bg);
}

.cart-item .item-details {
    flex: 1;
    min-width: 0;
}

.cart-item .item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item .item-price {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 0.9rem;
}

.cart-item .item-remove {
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color var(--transition);
    padding: 0.25rem;
}
.cart-item .item-remove:hover {
    color: var(--color-danger);
}

/* ------------------------------------------------------------------
   12. Checkout Form
   ------------------------------------------------------------------ */
.checkout-form {
    max-width: 720px;
    margin: 0 auto;
}

.checkout-form .form-control,
.checkout-form .form-select {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    background: var(--color-bg-card);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.checkout-form .form-control:focus,
.checkout-form .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.12);
}

.checkout-form .order-summary {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

/* ------------------------------------------------------------------
   13. Portal Layout (Customer & Admin)
   ------------------------------------------------------------------ */
.portal-layout {
    display: flex;
    min-height: 100vh;
}

.portal-sidebar {
    width: 260px;
    background: var(--color-bg-sidebar);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1030;
    transition: transform 0.3s ease;
}

.portal-sidebar .sidebar-logo {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.portal-sidebar .sidebar-logo img {
    height: 36px;
}

.portal-sidebar .sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.portal-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0;
    transition: all var(--transition);
}
.portal-sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}
.portal-sidebar .nav-link.active {
    color: #fff;
    background: rgba(var(--color-primary-rgb), 0.25);
    border-left: 3px solid var(--color-primary);
}

.portal-sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.portal-sidebar .sidebar-section {
    padding: 0.5rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #475569;
    margin-top: 0.75rem;
}

/* Main content area */
.portal-main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    min-width: 0;
}

/* Portal header bar */
.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    margin: -2rem -2rem 2rem -2rem;
}

.portal-header .user-name {
    font-weight: 600;
    color: var(--color-heading);
    font-size: 0.9rem;
}

/* Portal card (generic) */
.portal-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* Responsive sidebar toggle */
@media (max-width: 991.98px) {
    .portal-sidebar {
        transform: translateX(-100%);
    }
    .portal-sidebar.open {
        transform: translateX(0);
    }
    .portal-main {
        margin-left: 0;
    }
}

/* ------------------------------------------------------------------
   14. Stat Cards (Dashboard)
   ------------------------------------------------------------------ */
.stat-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-card .stat-icon.blue   { background: var(--color-primary-light); color: var(--color-primary); }
.stat-card .stat-icon.green  { background: #dcfce7; color: var(--color-success); }
.stat-card .stat-icon.orange { background: var(--color-accent-light); color: var(--color-accent); }
.stat-card .stat-icon.red    { background: #fee2e2; color: var(--color-danger); }

.stat-card .stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-heading);
    line-height: 1.2;
}

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

.stat-cards-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}
@media (max-width: 991.98px) {
    .stat-cards-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 575.98px) {
    .stat-cards-row { grid-template-columns: 1fr; }
}

/* Dark mode stat icon overrides */
body.dark .stat-card .stat-icon.green  { background: #14532d; }
body.dark .stat-card .stat-icon.red    { background: #450a0a; }

/* ------------------------------------------------------------------
   15. Portal Table
   ------------------------------------------------------------------ */
.portal-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

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

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

.portal-table tbody tr {
    transition: background var(--transition);
}
.portal-table tbody tr:hover {
    background: var(--color-primary-light);
}

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

/* ------------------------------------------------------------------
   16. Status Badges
   ------------------------------------------------------------------ */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.status-badge.pending    { background: #fef9c3; color: #854d0e; }
.status-badge.processing { background: #dbeafe; color: #1e40af; }
.status-badge.shipped    { background: #ede9fe; color: #6d28d9; }
.status-badge.delivered  { background: #dcfce7; color: #166534; }
.status-badge.cancelled  { background: #fee2e2; color: #991b1b; }
.status-badge.completed  { background: #dcfce7; color: #166534; }
.status-badge.active     { background: #dcfce7; color: #166534; }
.status-badge.inactive   { background: #f1f5f9; color: #475569; }

/* Dark mode badge overrides */
body.dark .status-badge.pending    { background: #422006; color: #fde68a; }
body.dark .status-badge.processing { background: #1e3a5f; color: #93c5fd; }
body.dark .status-badge.shipped    { background: #2e1065; color: #c4b5fd; }
body.dark .status-badge.delivered  { background: #14532d; color: #86efac; }
body.dark .status-badge.cancelled  { background: #450a0a; color: #fca5a5; }
body.dark .status-badge.completed  { background: #14532d; color: #86efac; }
body.dark .status-badge.active     { background: #14532d; color: #86efac; }
body.dark .status-badge.inactive   { background: #1e293b; color: #94a3b8; }

/* ------------------------------------------------------------------
   17. Auth Pages
   ------------------------------------------------------------------ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
}

.auth-card .auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-card .auth-logo img {
    height: 48px;
}

.auth-card h2 {
    font-weight: 700;
    color: var(--color-heading);
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card .auth-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.auth-card .form-control {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.65rem 0.85rem;
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.auth-card .form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.12);
}

.auth-card .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-heading);
    margin-bottom: 0.35rem;
}

.auth-card .auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* ------------------------------------------------------------------
   18. Form Section
   ------------------------------------------------------------------ */
.form-section {
    margin-bottom: 2rem;
}

.form-section .section-header {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-heading);
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

/* ------------------------------------------------------------------
   19. Modal Overlay
   ------------------------------------------------------------------ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1070;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.active,
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"] {
    display: flex !important;
}

.modal-overlay .modal-content {
    background: var(--color-bg-card, #fff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
}

/* ------------------------------------------------------------------
   20. Pagination
   ------------------------------------------------------------------ */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: center;
    margin-top: 2rem;
}

.pagination .page-link {
    min-width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-bg-card);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.pagination .page-link:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
}
.pagination .page-link.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.pagination .page-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ------------------------------------------------------------------
   21. Empty State
   ------------------------------------------------------------------ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-muted);
}

.empty-state .empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.35;
}

.empty-state h5 {
    font-weight: 700;
    color: var(--color-heading);
    margin-bottom: 0.5rem;
}

.empty-state p {
    max-width: 360px;
    margin: 0 auto 1.5rem;
    font-size: 0.9rem;
}

/* ------------------------------------------------------------------
   22. Loading Spinner
   ------------------------------------------------------------------ */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.loading-spinner::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.loading-spinner.sm::after {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.loading-spinner.overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 1080;
}

body.dark .loading-spinner.overlay {
    background: rgba(15, 23, 42, 0.7);
}

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

/* ------------------------------------------------------------------
   23. Toast Notifications
   ------------------------------------------------------------------ */
#toast-container {
    z-index: 1090;
}

/* ------------------------------------------------------------------
   24. Utility Classes
   ------------------------------------------------------------------ */
.text-primary-blue { color: var(--color-primary) !important; }
.text-accent       { color: var(--color-accent) !important; }
.bg-primary-light  { background: var(--color-primary-light) !important; }
.bg-accent-light   { background: var(--color-accent-light) !important; }
.border-primary    { border-color: var(--color-primary) !important; }

.rounded-lg  { border-radius: var(--radius-lg) !important; }
.rounded-xl  { border-radius: var(--radius-xl) !important; }
.shadow-card { box-shadow: var(--shadow) !important; }

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ------------------------------------------------------------------
   25. Responsive Helpers
   ------------------------------------------------------------------ */
@media (max-width: 767.98px) {
    .portal-main {
        padding: 1rem;
    }
    .portal-header {
        margin: -1rem -1rem 1.5rem -1rem;
        padding: 0.75rem 1rem;
    }
    .auth-card {
        padding: 1.75rem;
    }
    .stat-card {
        padding: 1.15rem;
    }
    .stat-card .stat-number {
        font-size: 1.25rem;
    }
    .portal-table {
        font-size: 0.82rem;
    }
    .portal-table thead th,
    .portal-table tbody td {
        padding: 0.65rem 0.75rem;
    }
}

/* ------------------------------------------------------------------
   Image Upload Widget
   ------------------------------------------------------------------ */
.image-upload-widget {
    margin-bottom: 0.25rem;
}
.img-upload-preview {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.img-dropzone {
    transition: all 0.2s ease;
}
.img-dropzone:hover {
    border-color: #025add !important;
    background: #f0f4ff !important;
}
body.dark .img-dropzone {
    background: #2a2a2a !important;
    border-color: #444 !important;
}
body.dark .img-dropzone:hover {
    border-color: #025add !important;
    background: #1a2a4a !important;
}
body.dark .img-dropzone i { color: #666 !important; }
body.dark .img-dropzone p { color: #999 !important; }
body.dark .img-upload-preview img {
    border-color: #444 !important;
    background: #2a2a2a !important;
}

/* ------------------------------------------------------------------
   Settings Tabs
   ------------------------------------------------------------------ */
.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 2px solid var(--color-border, #e2e2e2);
    padding-bottom: 0;
}
.settings-tab {
    padding: 8px 18px;
    border: none;
    background: none;
    color: var(--color-text-muted, #888);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    border-radius: 6px 6px 0 0;
}
.settings-tab:hover {
    color: var(--color-primary, #025add);
    background: rgba(2, 90, 221, 0.05);
}
.settings-tab.active {
    color: var(--color-primary, #025add);
    border-bottom-color: var(--color-primary, #025add);
    font-weight: 600;
}
body.dark .settings-tabs { border-bottom-color: #444; }
body.dark .settings-tab { color: #999; }
body.dark .settings-tab:hover { color: #7db4ff; background: rgba(2,90,221,0.1); }
body.dark .settings-tab.active { color: #7db4ff; border-bottom-color: #7db4ff; }

/* ------------------------------------------------------------------
   Image Search Modal
   ------------------------------------------------------------------ */
.img-search-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.img-search-thumb {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    aspect-ratio: 4/3;
    background: #f0f2f5;
}
.img-search-thumb:hover {
    border-color: #025add;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.img-search-thumb.selected {
    border-color: #025add;
    box-shadow: 0 0 0 3px rgba(2,90,221,0.3);
}
.img-search-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.img-search-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: #025add;
    color: #fff;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}
.img-search-thumb.selected .img-search-check {
    display: flex;
}
.img-search-source {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.img-search-provider-tab {
    padding: 5px 14px;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    background: #f8f9fa;
    color: #555;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.img-search-provider-tab:hover:not(.disabled) {
    border-color: #025add;
    color: #025add;
}
.img-search-provider-tab.active {
    background: #025add;
    color: #fff;
    border-color: #025add;
}
.img-search-provider-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
@media (max-width: 575.98px) {
    .img-search-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 576px) and (max-width: 767.98px) {
    .img-search-grid { grid-template-columns: repeat(3, 1fr); }
}
body.dark .img-search-thumb { background: #2a2a2a; }
body.dark .img-search-provider-tab { background: #2a2a2a; border-color: #444; color: #ccc; }
body.dark .img-search-provider-tab.active { background: #025add; color: #fff; border-color: #025add; }
body.dark .img-search-provider-tab.disabled { opacity: 0.4; }
