/*
 * FollowizAddons - Main Stylesheet v3.0
 * Elegant design with better contrast and no size transitions
 */

/* ============================================
   1. CSS RESET & VARIABLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Primary Colors */
    --primary: #1E9E74;
    --primary-dark: #188660;
    --primary-light: #29B885;
    --secondary: #29B885;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Status pairs (badge bg/fg) — single source, replaces per-page hardcoded pastels */
    --status-success-bg: #d1fae5; --status-success-fg: #065f46;
    --status-danger-bg:  #fee2e2; --status-danger-fg:  #991b1b;
    --status-warning-bg: #fef3c7; --status-warning-fg: #92400e;
    --status-info-bg:    #eff6ff; --status-info-fg:    #1d4ed8;
    --status-neutral-bg: #f1f5f9; --status-neutral-fg: #475569;

    /* Background Colors - Maximum contrast */
    --bg-body: #e2e5e9;      /* Darker gray body */
    --bg-primary: #ffffff;    /* Pure white cards */
    --bg-secondary: #f8f9fa;  /* Light gray */
    --bg-accent: #fcfcfd;     /* Very subtle accent */
    --bg-dark: #1f2937;

    /* Text Colors */
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-light: #6b7280;

    /* Border Colors */
    --border-light: #e5e7eb;
    --border-medium: #d1d5db;
    --border-dark: #9ca3af;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;

    /* Shadows - Subtle and elegant */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Fonts */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;

    /* IBM Plex Fonts */
    --cr-font-sans: 'IBM Plex Sans', -apple-system, Segoe UI, Roboto, sans-serif;
    --cr-font-mono: 'IBM Plex Mono', ui-monospace, monospace;

    /* v1 (main.css) compatibility aliases — lets legacy pages run on this sheet.
       Colors map to the common palette (unifies the theme); sizes keep v1's
       literal values (preserves each page's existing layout). */
    --primary-color: var(--primary);
    --secondary-color: var(--secondary);
    --accent: var(--primary);
    --border-color: var(--border-light);
    --border-color-dark: var(--border-dark);
    --bg-tertiary: var(--bg-accent);
    --bg-hover: var(--bg-secondary);
    --success-color: var(--success);
    --success-dark: #059669;
    --warning-color: var(--warning);
    --warning-dark: #d97706;
    --danger-color: var(--danger);
    --danger-dark: #dc2626;
    --info-color: var(--info);
    /* Brand accents mapped to the Followiz brand green (no islands) */
    --bot-accent: var(--primary);
    --bot-tint: var(--primary);
    --bot-tint-hover: var(--primary-dark);
    /* Fonts */
    --font-family: var(--font-sans);
    /* Sizes — v1 literal values, layout-preserving */
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-3xl: 32px;
    --radius-2xl: 16px;
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    --transition-fast: 150ms ease;
    --nav-height: 56px;
}

/* ============================================
   2. BASE STYLES
   ============================================ */
body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-top: 0;
    margin: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.875rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
h4 { font-size: 1.125rem; margin-bottom: 0.625rem; }
h5 { font-size: 1rem; margin-bottom: 0.5rem; }
h6 { font-size: 0.875rem; margin-bottom: 0.5rem; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* ============================================
   3. LAYOUT
   ============================================ */
.dashboard-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-lg);
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* ============================================
   4. NAVIGATION
   ============================================ */
.main-navigation {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nav-brand h2 {
    color: var(--primary);
    font-size: 1.25rem;
    margin: 0;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--space-xs);
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--bg-accent);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-info,
.nav-user-name {
    color: var(--text-secondary);
    font-weight: 500;
}

.logout-btn,
.nav-logout {
    background: transparent;
    color: var(--danger);
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.logout-btn:hover,
.nav-logout:hover {
    background: var(--danger);
    color: white;
}

/* ============================================
   5. PAGE HEADER
   ============================================ */
.page-header,
.dashboard-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 28px 32px;
    border-radius: var(--radius-2xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-md);
    position: relative;
    margin-top: 0; /* No additional top margin */
}

.page-header .nav-user {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
}

.page-header .nav-user-name {
    color: rgba(255, 255, 255, 0.95);
}

.page-header .nav-logout {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.page-header .nav-logout:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: white;
}

/* Any bare heading placed directly in a header banner is white (the global
   h1{color:var(--text-primary)} rule would otherwise render it dark on violet) */
.page-header h1, .page-header h2, .page-header h3,
.dashboard-header h1, .dashboard-header h2, .dashboard-header h3 {
    color: #fff;
}

.page-subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    color: rgba(255, 255, 255, 0.95);
}

.action-buttons {
    margin-top: var(--space-lg);
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

/* ============================================
   6. CARDS
   ============================================ */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: var(--space-lg);
    border: 1px solid rgba(0,0,0,0.06);
}

.card-header {
    padding: var(--space-lg);
    background: var(--bg-accent);
    border-bottom: 1px solid var(--border-light);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-body {
    padding: var(--space-lg);
}

/* ============================================
   7. STATS CARDS
   ============================================ */
.stats-grid,
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.06);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

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

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

/* ============================================
   8. FILTER BAR
   ============================================ */
.filter-bar {
    background: var(--bg-primary);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.06);
}

.filter-bar form {
    display: inline-block;
    margin: 0;
}

.filter-btn {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
    border: 1px solid var(--border-light);
}

.filter-btn:hover {
    background: var(--bg-accent);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

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

/* ============================================
   9. PROVIDER CARDS
   ============================================ */
.provider-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.08);
    overflow: hidden;
}

.provider-header {
    padding: var(--space-lg);
    background: var(--bg-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.15s ease;
    border-bottom: 2px solid var(--border-light);
}

.provider-header:hover {
    background: var(--bg-accent);
}

.provider-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.provider-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.provider-summary {
    display: flex;
    gap: var(--space-xl);
    align-items: center;
}

.provider-stats {
    display: flex;
    gap: var(--space-xl);
    align-items: center;
}

.provider-stat {
    text-align: center;
}

.provider-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.provider-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.provider-count {
    background: var(--primary);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
}

.provider-body,
.provider-content {
    display: none;
    background: var(--bg-accent);
    padding: var(--space-lg);
}

.provider-body.show,
.provider-content.show {
    display: block;
}

/* ============================================
   10. TYPE SECTIONS
   ============================================ */
.type-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--border-light);
}

.type-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
}

.type-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.type-badge {
    background: var(--primary);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.type-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.type-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ============================================
   11. STATUS SECTIONS
   ============================================ */
.status-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--border-light);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: background-color 0.2s ease;
    /* cursor: pointer; - Removed to limit pointer to clickable area only */
    user-select: none;
}

.status-header:hover {
    background: var(--bg-accent);
}

.status-header .toggle-icon {
    font-size: 14px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.status-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1rem;
    font-weight: 600;
}

/* ============================================
   12. BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    line-height: 1.5;
    white-space: nowrap;
}

.btn:hover {
    box-shadow: var(--shadow-sm);
}

.btn:active {
    box-shadow: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--text-primary);
}

.btn-outline {
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
}

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

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
}

.copy-btn {
    background: var(--success);
    color: white;
}

.copy-btn:hover {
    background: #059669;
}

.copy-btn.copied {
    background: #059669;
}

/* ============================================
   13. ORDER GRID
   ============================================ */
.orders-details {
    margin-top: var(--space-md);
    display: none;
}

.orders-details.show {
    display: block;
}

.order-grid {
    display: grid;
    grid-template-columns: 40px 80px 100px 1fr 80px 80px 80px 100px 120px;
    gap: var(--space-sm);
    padding: var(--space-md);
    align-items: center;
    font-size: 0.875rem;
}

/* Specific grid for stuck orders page */
.order-grid-stuck {
    display: grid;
    grid-template-columns: 35px 80px 100px 120px 2fr 70px 80px 80px 100px 110px 65px;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    align-items: center;
    font-size: 0.813rem;
}

/* Specific grid for client requests page */
.client-requests .order-grid {
    grid-template-columns: 40px 100px 100px 120px 1fr 80px 80px 80px 100px 100px 100px 60px 150px 150px;
}

.order-grid-header {
    background: var(--bg-accent);
    font-weight: 600;
    color: var(--text-primary);
    border-radius: var(--radius-md);
    position: sticky;
    top: 60px;
    z-index: 10;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--border-light);
}

.order-grid-item,
.order-grid-row {
    background: var(--bg-primary);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: var(--radius-md);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.order-grid-item:hover,
.order-grid-row:hover {
    background: var(--bg-accent);
    box-shadow: var(--shadow-xs);
}

.order-grid-item.completed,
.order-grid-row.completed {
    opacity: 0.5;
    background: var(--bg-secondary);
}

.order-grid-item.removing,
.order-grid-row.removing {
    animation: fadeOut 0.3s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

.order-item {
    background: var(--bg-accent);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: var(--space-md);
    align-items: center;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    border-left: 3px solid var(--primary);
}

.order-item:hover {
    background: var(--bg-secondary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.order-checkbox {
    display: flex;
    align-items: center;
}

/* Checkboxes individuelles avec classe dynamique order-checkbox-{hash} */
input[type="checkbox"][class*="order-checkbox-"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.order-id {
    font-family: var(--font-mono);
    font-size: 0.813rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.order-age {
    background: var(--danger);
    color: white;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.order-age.moderate {
    background: var(--warning);
}

.order-age.recent {
    background: var(--info);
}

/* ============================================
   14. SELECT ALL CONTAINER
   ============================================ */
.select-all-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-accent);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border-light);
}

.select-all-container input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

/* Checkboxes "Select All" dans les en-têtes de table */
.client-orders-table th input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.select-all-container label {
    cursor: pointer;
    font-weight: 500;
    flex: 1;
}

/* ============================================
   15. BADGES & STATUS
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary { background: var(--primary); color: white; }
.badge-secondary { background: var(--text-secondary); color: white; }
.badge-success { background: var(--success); color: white; }
.badge-danger { background: var(--danger); color: white; }
.badge-warning { background: var(--warning); color: white; }
.badge-info { background: var(--info); color: white; }

/* ============================================
   UNIFIED STATUS COLOR SYSTEM
   ============================================ */

/* Pending - Gray */
.badge-pending,
.status-pending {
    background: #e5e7eb;
    color: #374151;
}

/* In Progress - Yellow/Amber */
.badge-in-progress,
.badge-in_progress,
.status-in-progress,
.status-in_progress {
    background: #fef3c7;
    color: #78350f;
}

/* Processing - Blue */
.badge-processing,
.status-processing {
    background: #dbeafe;
    color: #1e3a8a;
}

/* Completed - Green */
.badge-completed,
.status-completed {
    background: #d1fae5;
    color: #064e3b;
}

/* Partial - Orange */
.badge-partial,
.status-partial {
    background: #fed7aa;
    color: #7c2d12;
}

/* Canceled - Red */
.badge-canceled,
.badge-cancelled,
.status-canceled,
.status-cancelled {
    background: #fee2e2;
    color: #7f1d1d;
}

/* Refunded - Purple */
.badge-refunded,
.status-refunded {
    background: #f3f4f6;
    color: #374151;
}

/* Request Type Badges */
.badge-cancel {
    background: #fee2e2;
    color: #7f1d1d;
}

.badge-refill {
    background: #dbeafe;
    color: #1e3a8a;
}

.badge-speed-up {
    background: #fef3c7;
    color: #78350f;
}

/* Base styling for status badges */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.request-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.request-badge.cancel {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.request-badge.refill {
    background: #dbeafe;
    color: #2563eb;
    border: 1px solid #93c5fd;
}

.request-badge.speed_up {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fcd34d;
}

/* ============================================
   16. ALERTS
   ============================================ */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    border-left: 4px solid;
}

.alert-success {
    background: #d1fae5;
    color: #064e3b;
    border-color: var(--success);
}

.alert-danger {
    background: #fee2e2;
    color: #7f1d1d;
    border-color: var(--danger);
}

.alert-warning {
    background: #fed7aa;
    color: #7c2d12;
    border-color: var(--warning);
}

.alert-info {
    background: #dbeafe;
    color: #1e3a8a;
    border-color: var(--info);
}

/* ============================================
   17. SYNC STATUS
   ============================================ */
#syncStatus {
    font-weight: 500;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    background: var(--bg-accent);
    color: var(--text-primary);
    display: none;
    margin-left: var(--space-md);
}

#syncStatus.success {
    background: #d1fae5;
    color: #064e3b;
}

#syncStatus.error {
    background: #fee2e2;
    color: #7f1d1d;
}

/* ============================================
   18. EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-state h2 {
    color: var(--success);
    margin-bottom: var(--space-md);
    font-size: 1.5rem;
}

.empty-state p {
    font-size: 1rem;
}

/* ============================================
   19. UTILITY CLASSES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }

.font-mono { font-family: var(--font-mono); font-size: 0.875rem; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.font-weight-600 { font-weight: 600; }

.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Allow service name to wrap in stuck orders */
.order-grid-stuck div:nth-child(5) {
    white-space: normal;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
}

/* Flexbox */
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Margins */
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

/* Display */
.d-none { display: none; }
.d-block { display: block; }

/* ============================================
   20. LOADING SPINNER
   ============================================ */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-primary {
    border-color: rgba(30, 158, 116, 0.3);
    border-top-color: var(--primary);
}

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

/* ============================================
   21. RESPONSIVE
   ============================================ */
@media (max-width: 1400px) {
    .order-grid {
        grid-template-columns: 40px 80px 80px 100px 200px 60px 60px 60px 80px 80px 80px 50px 120px 120px;
    }

    .order-grid-stuck {
        font-size: 0.75rem;
    }

    .order-grid-stuck .text-ellipsis {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 1200px) {
    .order-grid {
        font-size: 0.813rem;
        gap: 0.25rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: var(--space-md);
    }

    .page-header,
    .dashboard-header {
        padding: var(--space-lg);
    }

    .page-header .nav-user {
        position: static;
        margin-top: var(--space-md);
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-menu {
        display: none;
    }

    .order-grid {
        display: block;
    }

    .order-grid-header {
        display: none;
    }

    .order-grid-item {
        margin-bottom: var(--space-md);
        padding: var(--space-md);
    }

    .order-grid-item > div {
        display: block;
        margin-bottom: var(--space-xs);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   22. INVOICE DASHBOARD STYLES
   ============================================ */
.container-fluid {
    width: 100%;
    padding: var(--space-lg);
    padding-top: calc(var(--space-lg) + 60px);
}

.invoice-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: var(--space-2xl);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-md);
}

.invoice-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.invoice-header .fas {
    font-size: 1.5rem;
}

.stats-card {
    background: var(--bg-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.06);
}

.filter-card {
    background: var(--bg-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.06);
}

.migration-alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
    border-left: 4px solid;
}

.migration-alert {
    background: #d1fae5;
    color: #064e3b;
    border-color: var(--success);
}

.migration-alert.running {
    background: #fef3c7;
    border-color: var(--warning);
    color: #78350f;
}

.vip-badge {
    background: var(--warning);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}

.table-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
}

/* ============================================
   23. SERVICE DASHBOARD SPECIFIC
   ============================================ */
.metrics-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.popular-services {
    background: var(--bg-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.06);
}

.popular-services h3 {
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.popular-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    background: var(--bg-accent);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--success);
    transition: background-color 0.15s ease;
}

.popular-item:hover {
    background: var(--bg-secondary);
}

.popular-score {
    background: var(--success);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.table-wrapper {
    overflow-x: auto;
}

.table-container {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.06);
}

.table-header {
    background: var(--bg-secondary);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

/* ============================================
   24. FILTER SECTION & DROPDOWNS
   ============================================ */
.filter-section {
    background: var(--bg-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.06);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    align-items: end;
}

.filter-form {
    display: block;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

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

.filter-select {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 158, 116, 0.1);
}

.filter-select:hover {
    border-color: var(--primary);
}

/* ============================================
   25. AGENTS RATINGS SPECIFIC
   ============================================ */
.date-range-info {
    background: #f3f4f6;
    border: 1px solid #bae6fd;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: #0369a1;
    font-size: 0.875rem;
    margin-left: auto;
}

.agent-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: box-shadow 0.3s ease;
    border: 1px solid rgba(0,0,0,0.06);
}

.agent-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-lg);
    margin-bottom: var(--space-lg);
    border-bottom: 2px solid var(--bg-accent);
}

.agent-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-rating {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
}

.rating-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--warning);
}

.rating-stars {
    color: var(--warning);
    font-size: 1.125rem;
}

/* ============================================
   26. STUCK ORDERS SPECIFIC
   ============================================ */
.stuck-orders-container {
    width: 100%;
    max-width: 100%;
    padding: var(--space-lg);
}

/* Modern table styling with dynamic column widths */
.table-modern {
    width: 100%;
    background: var(--bg-primary);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.table-modern thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.table-modern thead th {
    padding: var(--space-md);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid var(--primary-dark);
}

.table-modern tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.15s ease;
}

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

.table-modern tbody td {
    padding: var(--space-md);
    vertical-align: middle;
    color: var(--text-primary);
}

/* Let columns auto-size based on content */
.stuck-orders-table {
    table-layout: auto;
}

/* Minimum widths for specific columns to prevent cramping */
.stuck-orders-table th:nth-child(1) { /* Checkbox */
    width: 40px;
    text-align: center;
}

.stuck-orders-table th:nth-child(2), /* Order ID */
.stuck-orders-table th:nth-child(3) { /* External ID */
    min-width: 100px;
}

.stuck-orders-table th:nth-child(4) { /* User */
    min-width: 120px;
}

.stuck-orders-table th:nth-child(5) { /* Service */
    min-width: 200px;
}

.stuck-orders-table th:nth-child(6), /* Quantity */
.stuck-orders-table th:nth-child(7), /* Charge */
.stuck-orders-table th:nth-child(8) { /* Provider Charge */
    min-width: 80px;
    text-align: right;
}

.stuck-orders-table th:nth-child(9) { /* Status */
    min-width: 100px;
}

.stuck-orders-table th:nth-child(10) { /* Created */
    min-width: 150px;
}

.stuck-orders-table th:nth-child(11) { /* Days Stuck */
    min-width: 90px;
    text-align: center;
}

/* Align number columns */
.stuck-orders-table td:nth-child(6),
.stuck-orders-table td:nth-child(7),
.stuck-orders-table td:nth-child(8) {
    text-align: right;
}

.stuck-orders-table td:nth-child(1),
.stuck-orders-table td:nth-child(11) {
    text-align: center;
}

/* Service name should wrap if too long */
.stuck-orders-table td:nth-child(5) {
    max-width: 400px;
    word-wrap: break-word;
    white-space: normal;
}

/* ============================================
   27. CLIENT ORDER REQUESTS TABLE
   Column order: Checkbox, Order ID, User, Service, Link, API, Start, Qty, Remain, Charge, Status, Client Request, Sent to Provider, Days
   ============================================ */
/* Column widths controlled by inline CSS in client_order_requests.php */

/* Ensure proper spacing for table wrapper */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: var(--space-md);
}

/* ============================================
   28. BOOTSTRAP COMPATIBILITY
   ============================================ */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--text-primary);
    background: var(--bg-primary);
}

.table th {
    background: var(--bg-accent);
    padding: var(--space-md);
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-light);
}

.table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.table-hover tbody tr:hover {
    background: var(--bg-accent);
    cursor: pointer;
}

.thead-light th {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-control {
    display: block;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease;
    height: 38px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 158, 116, 0.1);
}

.row, .form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
    padding: 0 15px;
}

@media (max-width: 768px) {
    .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: var(--space-md);
    }
}

.btn-block {
    display: block;
    width: 100%;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

/* ============================================
   29. PAGINATION
   ============================================ */
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: var(--space-xs);
}

.pagination.justify-content-center {
    justify-content: center;
}

.page-item {
    list-style: none;
}

.page-link {
    display: block;
    padding: var(--space-sm) var(--space-md);
    min-width: 40px;
    text-align: center;
    background: var(--bg-primary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

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

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    cursor: default;
}

.page-item.disabled .page-link {
    background: var(--bg-secondary);
    border-color: var(--border-light);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.page-item:first-child .page-link {
    border-top-left-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
}

.page-item:last-child .page-link {
    border-top-right-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* Navigation container */
nav.mt-4 {
    margin-top: var(--space-xl) !important;
}

/* ============================================
   30. PRINT
   ============================================ */
@media print {
    .main-navigation,
    .filter-bar,
    .btn,
    .type-actions,
    .nav-user {
        display: none !important;
    }

    body {
        background: white;
    }

    .provider-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}