/**
 * Affiliate Marketing Pro 2026 - Premium Edition
 * Unified Design System
 * Version: 2.0.0
 */

/* ============================================
   CSS VARIABLES - Premium Dark Theme
   ============================================ */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --primary-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    
    /* Secondary Colors */
    --secondary: #06b6d4;
    --secondary-light: #22d3ee;
    --secondary-dark: #0891b2;
    
    /* Accent Colors */
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --accent-dark: #d97706;
    
    /* Success Colors */
    --success: #10b981;
    --success-light: #34d399;
    --success-dark: #059669;
    --success-bg: rgba(16, 185, 129, 0.1);
    
    /* Warning Colors */
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --warning-dark: #d97706;
    --warning-bg: rgba(245, 158, 11, 0.1);
    
    /* Error Colors */
    --error: #ef4444;
    --error-light: #f87171;
    --error-dark: #dc2626;
    --error-bg: rgba(239, 68, 68, 0.1);
    
    /* Info Colors */
    --info: #3b82f6;
    --info-light: #60a5fa;
    --info-dark: #2563eb;
    --info-bg: rgba(59, 130, 246, 0.1);
    
    /* Background Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-hover: #1e1e2a;
    --bg-active: #252532;
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    /* Border Colors */
    --border-primary: rgba(148, 163, 184, 0.1);
    --border-secondary: rgba(148, 163, 184, 0.2);
    --border-focus: rgba(99, 102, 241, 0.5);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --shadow-glow-lg: 0 0 40px rgba(99, 102, 241, 0.4);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Layout */
    --header-height: 70px;
    --sidebar-width: 280px;
    --max-content-width: 1600px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

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

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

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

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

/* ============================================
   LAYOUT
   ============================================ */
.container {
    width: 100%;
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

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

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--space-xl);
    padding-top: calc(var(--header-height) + var(--space-xl));
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
        padding-top: calc(var(--header-height) + var(--space-md));
    }
}

/* ============================================
   HEADER
   ============================================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(10, 10, 15, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-primary);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 var(--space-xl);
}

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

.header-brand-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.header-brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.header-brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: auto;
}

.header-nav a {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.header-nav a:hover,
.header-nav a.active {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    overflow-y: auto;
    z-index: 900;
    padding: var(--space-lg);
}

.sidebar-section {
    margin-bottom: var(--space-xl);
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
    padding-left: var(--space-md);
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: var(--space-xs);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

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

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

.sidebar-nav a.active {
    color: var(--text-primary);
    background: var(--primary-gradient);
    box-shadow: var(--shadow-glow);
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--border-secondary);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1.125rem;
    margin: 0;
}

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

.card-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-md);
}

/* Stat Card */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-hover);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary-light);
    margin-bottom: var(--space-md);
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

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

.stat-card-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: var(--space-sm);
}

.stat-card-change.positive { color: var(--success); }
.stat-card-change.negative { color: var(--error); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-gradient-hover);
    box-shadow: var(--shadow-glow-lg);
    transform: translateY(-1px);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-active);
    border-color: var(--border-focus);
}

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

.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
}

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

.btn-danger:hover:not(:disabled) {
    background: var(--error-dark);
}

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

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.75rem;
}

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

.btn-icon {
    padding: var(--space-sm);
    width: 40px;
    height: 40px;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.form-label.required::after {
    content: ' *';
    color: var(--error);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-hover);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

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

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.form-error {
    font-size: 0.75rem;
    color: var(--error);
    margin-top: var(--space-xs);
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-primary);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
}

.table th {
    background: var(--bg-hover);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table th.sortable {
    cursor: pointer;
    user-select: none;
}

.table th.sortable:hover {
    color: var(--text-primary);
}

.table th.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: var(--space-sm);
    opacity: 0.5;
    font-size: 0.625rem;
}

.table th.sort-asc::after { content: '\f0de'; opacity: 1; }
.table th.sort-desc::after { content: '\f0dd'; opacity: 1; }

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

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

.table-empty {
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-muted);
}

.table-empty i {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

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

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

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

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

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

.badge-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

.modal-container.modal-lg {
    max-width: 900px;
}

.modal-container.modal-sm {
    max-width: 400px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-header h3 {
    font-size: 1.125rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: var(--space-xl);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-md);
}

/* ============================================
   TOASTS
   ============================================ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    animation: toastSlideIn 0.3s ease;
}

.toast.fade-out {
    animation: toastFadeOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastFadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

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

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

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

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

.toast i {
    font-size: 1.25rem;
}

.toast-success i { color: var(--success); }
.toast-error i { color: var(--error); }
.toast-warning i { color: var(--warning); }
.toast-info i { color: var(--info); }

/* ============================================
   CSV IMPORT STYLES
   ============================================ */
.csv-import-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.csv-import-steps .step {
    display: flex;
    gap: var(--space-lg);
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 1rem;
    margin-bottom: var(--space-xs);
}

.step-content p {
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.file-upload-area {
    border: 2px dashed var(--border-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    transition: all var(--transition-fast);
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.file-upload-area i {
    font-size: 3rem;
    color: var(--primary-light);
    margin-bottom: var(--space-md);
}

.file-upload-area p {
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.file-upload-area span {
    display: block;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.csv-preview {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-primary);
}

.csv-preview h4 {
    font-size: 1rem;
    margin-bottom: var(--space-md);
}

.preview-table-container {
    max-height: 300px;
    overflow: auto;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.preview-table {
    width: 100%;
    font-size: 0.75rem;
}

.preview-table th,
.preview-table td {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-primary);
    white-space: nowrap;
}

.preview-table th {
    background: var(--bg-hover);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.csv-errors {
    background: var(--error-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: none;
}

.csv-errors h5 {
    color: var(--error);
    margin-bottom: var(--space-sm);
}

.csv-errors ul {
    margin: 0;
    padding-left: var(--space-lg);
    color: var(--error-light);
    font-size: 0.875rem;
}

.csv-errors li {
    margin-bottom: var(--space-xs);
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: var(--space-xs);
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: var(--space-xl);
}

.tab {
    padding: var(--space-md) var(--space-lg);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   SEARCH & FILTER BAR
   ============================================ */
.search-filter-bar {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-input-wrapper i {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-wrapper input {
    width: 100%;
    padding: var(--space-sm) var(--space-md) var(--space-sm) 40px;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-xl);
}

.page-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-active);
    color: var(--text-primary);
}

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

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

.page-ellipsis {
    color: var(--text-muted);
    padding: 0 var(--space-sm);
}

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

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
}

.empty-state-icon i {
    font-size: 2.5rem;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

/* ============================================
   LOADING
   ============================================ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

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

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* ============================================
   TOOLTIP
   ============================================ */
.tooltip {
    position: absolute;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
    z-index: 1500;
    pointer-events: none;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.5s ease;
}

.animate-slideUp {
    animation: slideUp 0.5s ease;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-md);
    }
    
    .main-content {
        padding: var(--space-md);
        padding-top: calc(var(--header-height) + var(--space-md));
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .header-nav {
        display: none;
    }
    
    .search-filter-bar {
        flex-direction: column;
    }
    
    .search-input-wrapper {
        min-width: 100%;
    }
    
    .card-header {
        flex-direction: column;
        gap: var(--space-md);
        align-items: flex-start;
    }
    
    .modal-container {
        margin: var(--space-md);
        max-height: calc(100vh - var(--space-lg));
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .header,
    .sidebar,
    .btn,
    .modal {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0;
    }
    
    .card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   SELECTION
   ============================================ */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: var(--text-primary);
}


/* ============================================================
   ENHANCED MOBILE RESPONSIVENESS v2 — Affiliate Pro 2026
   ============================================================ */

/* ─── Sidebar: always fixed, collapsible on mobile ─── */
.sidebar {
    position: fixed;
    top: var(--header-height, 70px); left: 0;
    height: calc(100vh - var(--header-height, 70px));
    width: var(--sidebar-width, 280px);
    background: var(--bg-secondary, #111118);
    border-right: 1px solid var(--border-primary, rgba(148,163,184,.1));
    z-index: 900;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
}

/* Desktop: sidebar always visible */
@media (min-width: 1025px) {
    .sidebar { transform: translateX(0) !important; }
    .main-content { margin-left: var(--sidebar-width, 280px) !important; }
    .mobile-menu-toggle, #mobileMenuBtn { display: none !important; }
}

/* Mobile: sidebar hidden by default, toggled open — slides over the full viewport */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        top: 0 !important;
        height: 100vh !important;
        z-index: 1001; /* above header (1000) so it overlays properly */
    }
    .sidebar.open, .sidebar.snav-open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .mobile-menu-toggle, #mobileMenuBtn { display: flex !important; }
}

/* Overlay sits between page content and the open sidebar */
@media (max-width: 1024px) {
    .sidebar-overlay { z-index: 1000; }
}

/* ─── Overlay ─── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 899;
}
.sidebar-overlay.active { display: block; }

/* ─── Mobile toggle button ─── */
.mobile-menu-toggle, #mobileMenuBtn {
    background: none;
    border: none;
    color: var(--text-primary, #f8fafc);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 6px;
    margin-right: 6px;
    align-items: center;
    justify-content: center;
}
.mobile-menu-toggle:hover, #mobileMenuBtn:hover {
    background: var(--bg-hover, #1e1e2a);
}

/* ─── Stats cards grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-md, 1rem);
}

/* ─── Tools grid ─── */
.tools-grid, .cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-lg, 1.5rem);
}

/* ─── Ensure images/iframes are responsive ─── */
img, video, iframe { max-width: 100%; height: auto; }

@media (max-width: 768px) {
    /* Page title */
    .page-header { flex-wrap: wrap; gap: .75rem; }
    .page-header h1 { font-size: 1.4rem !important; }
    .page-header-actions { flex-wrap: wrap; gap: .5rem; width: 100%; }
    .page-header-actions .btn { flex: 1; min-width: 120px; justify-content: center; }

    /* Card headers */
    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: .75rem;
    }
    .card-actions, .card-header-actions {
        display: flex; flex-wrap: wrap; gap: .5rem; width: 100%;
    }
    .card-actions .btn, .card-header-actions .btn {
        flex: 1; min-width: 0; justify-content: center;
    }

    /* Tables */
    .table-container, .table-responsive {
        width: 100%; overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table { min-width: 580px; }
    .table-container table { font-size: .8rem; }
    th, td { padding: 8px 10px; white-space: nowrap; }

    /* Filters */
    .filter-bar, .search-filter-bar {
        flex-direction: column; gap: .75rem;
    }
    .filter-bar > *, .search-filter-bar > * {
        width: 100% !important; min-width: 0 !important;
    }

    /* Charts */
    .chart-container { height: 220px !important; }
    canvas { max-width: 100% !important; }

    /* Upgrade banners */
    .upgrade-banner, .starter-top-banner {
        flex-direction: column; text-align: center; gap: .75rem;
    }
    .upgrade-banner-btn { width: 100%; text-align: center; justify-content: center; }

    /* Tabs */
    .tabs, .tab-nav {
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        scrollbar-width: none; flex-wrap: nowrap !important;
    }
    .tabs::-webkit-scrollbar, .tab-nav::-webkit-scrollbar { display: none; }
    .tab-btn, .tab-item { white-space: nowrap; flex-shrink: 0; }

    /* Modals */
    .modal-container {
        margin: 8px !important;
        max-height: calc(100dvh - 16px) !important;
        border-radius: 12px !important;
        width: calc(100vw - 16px) !important;
        max-width: none !important;
    }
    .modal-footer { flex-wrap: wrap; gap: .5rem; }
    .modal-footer .btn { flex: 1; min-width: 120px; }

    /* Stats */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }

    /* Two-column → single column */
    .two-col-grid, .checker-grid, .analyzer-grid {
        grid-template-columns: 1fr !important;
    }

    /* Calendar */
    .calendar-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
    /* Forms */
    .form-row { flex-direction: column; gap: var(--space-md, 1rem); }
    .form-group { width: 100%; }
    input[type="text"], input[type="email"], input[type="number"],
    input[type="url"], input[type="date"], select, textarea {
        font-size: 16px !important; /* Prevent iOS zoom */
    }

    /* Buttons: larger touch targets */
    .btn { min-height: 44px; padding: 12px 18px; }
    .btn-sm { min-height: 38px; }
    .btn-xs { min-height: 32px; }

    /* Quick actions */
    .quick-actions { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
    .quick-action-card { padding: 12px; font-size: .8rem; }

    /* Stats: 2 col on small screens */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 1.3rem !important; }

    /* Toasts: bottom on mobile */
    #toast-container {
        top: auto !important; bottom: 16px !important;
        left: 12px !important; right: 12px !important;
        width: auto !important;
    }
    .toast { width: 100% !important; }

    /* Tool cards */
    .tools-grid, .cards-grid { grid-template-columns: 1fr; gap: .75rem; }
}

/* ─── Comments Section Styles ─── */
#comments-section {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-primary, rgba(148,163,184,.1));
}

@media (max-width: 600px) {
    #comments-section { margin-top: 2rem; padding-top: 1rem; }
    .cs-form-row { flex-direction: column; gap: .75rem; }
    .cs-form-row > * { width: 100%; }
}
