/**
 * BYNDbiz Executive Compensation - Design System
 * Premium UI/UX for Israeli B2B SaaS
 *
 * Brand: Professional blue + warm copper/orange accent
 * "Building Beyond" visual metaphor
 */

/* ============================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */

:root {
    /* Primary - BYND Blue (matching byndbiz.co.il) */
    --brand-blue-50: #f0f4ff;
    --brand-blue-100: #e0e8ff;
    --brand-blue-200: #c7d4ff;
    --brand-blue-300: #a3b8ff;
    --brand-blue-400: #7a96ff;
    --brand-blue-500: #4d65ff;  /* byndbiz.co.il primary */
    --brand-blue-600: #3d52e6;
    --brand-blue-700: #3142c7;
    --brand-blue-800: #2835a1;
    --brand-blue-900: #1f2a80;

    /* Accent - BYND Copper/Orange (energy, warmth) */
    --brand-copper-50: #fff7ed;
    --brand-copper-100: #ffedd5;
    --brand-copper-200: #fed7aa;
    --brand-copper-300: #fdba74;
    --brand-copper-400: #fb923c;
    --brand-copper-500: #f97316;  /* Modern orange */
    --brand-copper-600: #ea580c;
    --brand-copper-700: #c2410c;
    --brand-copper-800: #9a3412;
    --brand-copper-900: #7c2d12;

    /* Surfaces */
    --surface-bg: #f8fafc;
    --surface-card: #ffffff;
    --surface-elevated: #ffffff;
    --surface-muted: #f1f5f9;
    --surface-hover: #e2e8f0;

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    --text-link: var(--brand-blue-600);
    --text-link-hover: var(--brand-blue-700);

    /* Status Colors */
    --success-50: #f0fdf4;
    --success-100: #dcfce7;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;

    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;

    --error-50: #fef2f2;
    --error-100: #fee2e2;
    --error-500: #ef4444;
    --error-600: #dc2626;
    --error-700: #b91c1c;

    --info-50: #eff6ff;
    --info-100: #dbeafe;
    --info-500: #3b82f6;
    --info-600: #2563eb;
    --info-700: #1d4ed8;

    /* Borders */
    --border-light: #e2e8f0;
    --border-default: #cbd5e1;
    --border-dark: #94a3b8;
    --border-focus: var(--brand-blue-500);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-focus: 0 0 0 3px rgba(91, 141, 201, 0.3);
    --shadow-focus-copper: 0 0 0 3px rgba(198, 125, 61, 0.3);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Typography Scale */
    --text-xs: 0.75rem;     /* 12px */
    --text-sm: 0.875rem;    /* 14px */
    --text-base: 1rem;      /* 16px */
    --text-lg: 1.125rem;    /* 18px */
    --text-xl: 1.25rem;     /* 20px */
    --text-2xl: 1.5rem;     /* 24px */
    --text-3xl: 1.875rem;   /* 30px */
    --text-4xl: 2.25rem;    /* 36px */

    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Font Families */
    --font-sans: 'Heebo', 'Assistant', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Heebo', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;

    /* Spacing Scale (8px base) */
    --space-0: 0;
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */

    /* Animation & Transitions */
    --duration-fast: 100ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
    --duration-slower: 500ms;
    --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Index Scale */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
    --z-toast: 800;
}


/* ============================================
   2. CSS RESET & BASE STYLES
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--surface-bg);
    direction: rtl;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Remove default list styles */
ul, ol {
    list-style: none;
}

/* Anchor defaults */
a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-default);
}

a:hover {
    color: var(--text-link-hover);
}

a:focus-visible {
    outline: 2px solid var(--brand-blue-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Images */
img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
}

/* Form elements */
button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--brand-blue-500);
    outline-offset: 2px;
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}


/* ============================================
   3. TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: var(--text-4xl);
    letter-spacing: -0.025em;
}

h2 {
    font-size: var(--text-3xl);
    letter-spacing: -0.02em;
}

h3 {
    font-size: var(--text-2xl);
}

h4 {
    font-size: var(--text-xl);
}

h5 {
    font-size: var(--text-lg);
}

h6 {
    font-size: var(--text-base);
}

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.font-mono { font-family: var(--font-mono); }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-inverse { color: var(--text-inverse); }


/* ============================================
   4. BUTTON COMPONENT
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--duration-normal) var(--ease-default);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary Button (Blue) */
.btn-primary {
    background: var(--brand-blue-500);
    color: var(--text-inverse);
    border-color: var(--brand-blue-500);
}

.btn-primary:hover {
    background: var(--brand-blue-600);
    border-color: var(--brand-blue-600);
}

.btn-primary:active {
    background: var(--brand-blue-700);
}

/* Accent Button (Orange) */
.btn-accent {
    background: var(--brand-copper-500);
    color: var(--text-inverse);
    border-color: var(--brand-copper-500);
}

.btn-accent:hover {
    background: var(--brand-copper-600);
    border-color: var(--brand-copper-600);
}

.btn-accent:focus-visible {
    box-shadow: var(--shadow-focus-copper);
}

/* Secondary/Outline Button */
.btn-secondary,
.btn-outline {
    background: transparent;
    color: var(--brand-blue-600);
    border-color: var(--brand-blue-500);
}

.btn-secondary:hover,
.btn-outline:hover {
    background: var(--brand-blue-50);
    color: var(--brand-blue-700);
    border-color: var(--brand-blue-600);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--surface-muted);
    color: var(--text-primary);
}

/* Success Button */
.btn-success {
    background: var(--success-500);
    color: var(--text-inverse);
    border-color: var(--success-500);
}

.btn-success:hover {
    background: var(--success-600);
    border-color: var(--success-600);
}

/* Danger Button */
.btn-danger {
    background: var(--error-500);
    color: var(--text-inverse);
    border-color: var(--error-500);
}

.btn-danger:hover {
    background: var(--error-600);
    border-color: var(--error-600);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}

/* Button with icon */
.btn-icon {
    padding: var(--space-2);
    aspect-ratio: 1;
}

/* Loading state */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

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


/* ============================================
   5. INPUT COMPONENT
   ============================================ */

.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
}

.form-label.required::after {
    content: '*';
    color: var(--error-500);
    margin-right: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--surface-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: border-color var(--duration-fast) var(--ease-default),
                box-shadow var(--duration-fast) var(--ease-default);
}

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

.form-input:hover {
    border-color: var(--border-default);
}

.form-input:focus {
    outline: none;
    border-color: var(--brand-blue-500);
    box-shadow: var(--shadow-focus);
}

/* Input with error */
.form-input.error,
.form-input:invalid:not(:placeholder-shown) {
    border-color: var(--error-500);
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Input with success */
.form-input.success {
    border-color: var(--success-500);
}

/* Disabled input */
.form-input:disabled {
    background: var(--surface-muted);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Input sizes */
.form-input-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
}

.form-input-lg {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-lg);
}

/* Search input */
.form-search {
    padding-right: var(--space-10);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.3-4.3'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
}

/* Select */
.form-select {
    appearance: none;
    padding-left: var(--space-10);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left var(--space-3) center;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--brand-blue-500);
    box-shadow: var(--shadow-focus);
}

/* Textarea */
.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Form help text */
.form-help {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* Form error message */
.form-error {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--error-600);
}


/* ============================================
   6. CARD COMPONENT
   ============================================ */

.card {
    background: var(--surface-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--duration-normal) var(--ease-default),
                transform var(--duration-normal) var(--ease-default);
}

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

.card-interactive {
    cursor: pointer;
}

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

.card-header {
    padding: var(--space-4) var(--space-5);
    background: var(--surface-muted);
    color: var(--text-primary);
    font-weight: var(--font-semibold);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

.card-header-blue {
    background: var(--brand-blue-500);
    color: var(--text-inverse);
    border-bottom: none;
}

.card-header::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--brand-blue-500);
    border-radius: 2px;
    flex-shrink: 0;
}

.card-header-blue::before {
    background: var(--brand-copper-500);
}

.card-header-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
}

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

.card-footer {
    padding: var(--space-4) var(--space-5);
    background: var(--surface-muted);
    border-top: 1px solid var(--border-light);
}

/* Stat Card */
.stat-card {
    background: var(--surface-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    text-align: center;
    transition: all var(--duration-normal) var(--ease-default);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--brand-blue-500);
    opacity: 0;
    transition: opacity var(--duration-normal);
}

.stat-card:hover {
    border-color: var(--brand-blue-300);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card-value {
    font-family: var(--font-mono);
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    color: var(--brand-blue-600);
    line-height: 1.2;
}

.stat-card-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    margin-top: var(--space-2);
}

/* Stat card colors */
.stat-card-success .stat-card-value { color: var(--success-600); }
.stat-card-success::before { background: var(--success-500); }

.stat-card-warning .stat-card-value { color: var(--warning-600); }
.stat-card-warning::before { background: var(--warning-500); }

.stat-card-error .stat-card-value { color: var(--error-600); }
.stat-card-error::before { background: var(--error-500); }

.stat-card-copper .stat-card-value { color: var(--brand-copper-600); }
.stat-card-copper::before { background: var(--brand-copper-500); }


/* ============================================
   7. TABLE COMPONENT
   ============================================ */

.table-container {
    background: var(--surface-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: right;
    border-bottom: 1px solid var(--border-light);
}

.table th {
    background: var(--surface-muted);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    white-space: nowrap;
}

.table tbody tr {
    transition: background var(--duration-fast) var(--ease-default);
}

.table tbody tr:hover {
    background: var(--brand-blue-50);
}

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

/* Table with clickable rows */
.table-clickable tbody tr {
    cursor: pointer;
}

.table-clickable tbody tr:active {
    background: var(--brand-blue-100);
}

/* Table sizes */
.table-compact th,
.table-compact td {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
}

.table-comfortable th,
.table-comfortable td {
    padding: var(--space-4) var(--space-5);
}

/* Sortable table header */
.table th.sortable {
    cursor: pointer;
    user-select: none;
}

.table th.sortable:hover {
    background: var(--surface-hover);
}

.table th.sortable::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-right: var(--space-2);
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

.table th.sortable.asc::after {
    border-bottom: 4px solid var(--text-secondary);
}

.table th.sortable.desc::after {
    border-top: 4px solid var(--text-secondary);
}

/* Numeric cells */
.table td.numeric {
    font-family: var(--font-mono);
    direction: ltr;
    text-align: left;
}

/* Status badges in tables */
.table .badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
}


/* ============================================
   8. NAVIGATION COMPONENTS
   ============================================ */

/* Tab Navigation */
.tabs {
    display: flex;
    gap: var(--space-1);
    background: var(--surface-muted);
    padding: var(--space-1);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.tab {
    flex: 1;
    min-width: fit-content;
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.tab.active {
    color: var(--brand-blue-600);
    background: var(--surface-card);
    box-shadow: var(--shadow-sm);
}

/* Underline tabs variant */
.tabs-underline {
    background: transparent;
    padding: 0;
    border-bottom: 2px solid var(--border-light);
    gap: var(--space-6);
}

.tabs-underline .tab {
    border-radius: 0;
    padding: var(--space-3) var(--space-1);
    margin-bottom: -2px;
    border-bottom: 2px solid transparent;
}

.tabs-underline .tab.active {
    background: transparent;
    box-shadow: none;
    border-bottom-color: var(--brand-blue-500);
}


/* ============================================
   9. MODAL COMPONENT
   ============================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-default);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--surface-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-default);
}

.modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.modal-close:hover {
    background: var(--surface-muted);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    justify-content: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    background: var(--surface-muted);
    border-top: 1px solid var(--border-light);
}

/* Modal sizes */
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }
.modal-fullscreen {
    width: 95%;
    max-width: 95%;
    height: 95%;
    max-height: 95%;
}


/* ============================================
   10. FEEDBACK COMPONENTS
   ============================================ */

/* Toast notifications */
.toast {
    position: fixed;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    z-index: var(--z-toast);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-slow) var(--ease-out);
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    border-right: 4px solid var(--success-500);
}

.toast-error {
    border-right: 4px solid var(--error-500);
}

.toast-warning {
    border-right: 4px solid var(--warning-500);
}

.toast-info {
    border-right: 4px solid var(--info-500);
}

/* Alert boxes */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-success {
    background: var(--success-50);
    border-color: var(--success-500);
    color: var(--success-700);
}

.alert-error {
    background: var(--error-50);
    border-color: var(--error-500);
    color: var(--error-700);
}

.alert-warning {
    background: var(--warning-50);
    border-color: var(--warning-500);
    color: var(--warning-700);
}

.alert-info {
    background: var(--info-50);
    border-color: var(--info-500);
    color: var(--info-700);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-sm);
    max-width: 300px;
    margin: 0 auto;
}


/* ============================================
   11. LOADING STATES
   ============================================ */

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-muted) 25%,
        var(--surface-hover) 50%,
        var(--surface-muted) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

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

.skeleton-text {
    height: 1em;
    width: 100%;
}

.skeleton-text-sm {
    height: 0.875em;
    width: 60%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-top-color: var(--brand-blue-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

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

/* Loading overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-fixed);
}


/* ============================================
   12. BADGES & TAGS
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    line-height: 1;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: var(--brand-blue-100);
    color: var(--brand-blue-700);
}

.badge-accent {
    background: var(--brand-copper-100);
    color: var(--brand-copper-700);
}

.badge-success {
    background: var(--success-100);
    color: var(--success-700);
}

.badge-warning {
    background: var(--warning-100);
    color: var(--warning-700);
}

.badge-error {
    background: var(--error-100);
    color: var(--error-700);
}

.badge-info {
    background: var(--info-100);
    color: var(--info-700);
}

.badge-neutral {
    background: var(--surface-muted);
    color: var(--text-secondary);
}

/* Tag with close button */
.tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--surface-muted);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.tag-close {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
}

.tag-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}


/* ============================================
   13. PAGINATION
   ============================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-4);
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--brand-blue-50);
    border-color: var(--brand-blue-300);
    color: var(--brand-blue-600);
}

.pagination-btn.active {
    background: var(--brand-blue-500);
    border-color: var(--brand-blue-500);
    color: var(--text-inverse);
}

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

.pagination-info {
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-muted);
}


/* ============================================
   14. LAYOUT UTILITIES
   ============================================ */

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

.container-sm { max-width: 800px; }
.container-lg { max-width: 1600px; }
.container-fluid { max-width: none; }

/* Flexbox utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Grid utilities */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Spacing utilities */
.m-0 { margin: 0; }
.m-4 { margin: var(--space-4); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mr-4 { margin-right: var(--space-4); }
.ml-4 { margin-left: var(--space-4); }

.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.pt-4 { padding-top: var(--space-4); }
.pb-4 { padding-bottom: var(--space-4); }
.pr-4 { padding-right: var(--space-4); }
.pl-4 { padding-left: var(--space-4); }

/* Display utilities */
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

/* Text alignment */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

/* Width utilities */
.w-full { width: 100%; }
.w-auto { width: auto; }


/* ============================================
   15. RESPONSIVE BREAKPOINTS
   ============================================ */

/* Mobile first responsive design */
@media (max-width: 640px) {
    :root {
        --text-4xl: 1.875rem;
        --text-3xl: 1.5rem;
    }

    .container {
        padding: 0 var(--space-4);
    }

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

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        flex: none;
        min-width: auto;
    }

    .modal {
        width: 95%;
        max-height: 95vh;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .hide-tablet { display: none; }
}

@media (min-width: 1024px) {
    .show-tablet { display: none; }
}


/* ============================================
   16. PRINT STYLES
   ============================================ */

@media print {
    body {
        background: white;
        font-size: 12pt;
    }

    .no-print {
        display: none !important;
    }

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

    a {
        color: inherit;
        text-decoration: underline;
    }
}


/* ============================================
   17. ACCESSIBILITY
   ============================================ */

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--brand-blue-600);
    color: var(--text-inverse);
    padding: var(--space-2) var(--space-4);
    z-index: var(--z-tooltip);
    transition: top var(--duration-fast);
}

.skip-link:focus {
    top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-light: #000;
        --border-default: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
