/**
 * 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);
}



/* ============================================================
   AFFILIATE PRO 2026 — v3.0 ADDITIONS
   Appended to shared-styles.css
   ============================================================ */

/* ── Header Brand as Link ──────────────────────────────────── */
.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.header-brand-name {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.header-brand-version {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1;
}

/* ── Header Nav Improvements ───────────────────────────────── */
.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: auto;
}

.header-nav-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    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);
    text-decoration: none;
}

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

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

.header-nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-secondary);
}

/* ── Global Search ─────────────────────────────────────────── */
.header-search {
    position: relative;
    flex: 1;
    max-width: 360px;
    margin: 0 var(--space-lg);
}

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

.header-search-input {
    width: 100%;
    padding: 8px 14px 8px 34px;
    background: var(--bg-hover);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.header-search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-active);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.header-search-input::placeholder { color: var(--text-muted); }
.header-search-input::-webkit-search-cancel-button { display: none; }

/* Search Dropdown */
.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    z-index: 2100;
    max-height: 360px;
    overflow-y: auto;
}

.search-dropdown.active { display: block; animation: fadeIn 0.15s ease; }

.search-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 10px var(--space-lg);
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.search-result-item:hover { background: var(--bg-hover); }

.search-result-icon {
    width: 32px;
    height: 32px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.search-result-text { min-width: 0; }

.search-result-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-name mark {
    background: rgba(99, 102, 241, 0.25);
    color: var(--primary-light);
    border-radius: 2px;
    padding: 0 2px;
}

.search-no-results {
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

/* ── Sidebar Enhancements ──────────────────────────────────── */
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-nav a span { flex: 1; min-width: 0; }

.sidebar-nav a i {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

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

.sidebar-footer {
    margin-top: var(--space-xl);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-footer i { color: var(--primary-light); }

/* Sidebar scrollbar – thinner */
.sidebar::-webkit-scrollbar          { width: 4px; }
.sidebar::-webkit-scrollbar-track    { background: transparent; }
.sidebar::-webkit-scrollbar-thumb    { background: var(--border-secondary); border-radius: var(--radius-full); }

/* ── Subscription / Trial UI ─────────────────────────────── */

/* Header plan badge (the clickable pill in the top nav) */
.header-plan-status {
    display: none;
    align-items: center;
    text-decoration: none;
    margin-right: 4px;
}

#headerTrialBadge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .03em;
    background: rgba(99,102,241,.12);
    border: 1px solid rgba(99,102,241,.25);
    cursor: pointer;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    white-space: nowrap;
}

.header-plan-status:hover #headerTrialBadge {
    opacity: .8;
    transform: translateY(-1px);
}

/* Sidebar plan badge (day counter pill on the Billing link) */
.sidebar-plan-badge {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 18px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 800;
    color: #fff;
    margin-left: auto;
    flex-shrink: 0;
    letter-spacing: .02em;
}

/* Sidebar billing link — slight accent border when trial is active */
.sidebar-billing-link {
    position: relative;
}

/* Account section separator */
.sidebar-account-section {
    border-top: 1px solid var(--border-primary);
    padding-top: var(--space-md);
    margin-top: var(--space-sm);
}

/* Dashboard trial card */
.trial-status-card {
    background: linear-gradient(135deg, rgba(99,102,241,.12) 0%, rgba(139,92,246,.08) 100%);
    border: 1px solid rgba(99,102,241,.25);
    border-radius: var(--radius-xl);
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.trial-status-card.urgent {
    background: linear-gradient(135deg, rgba(239,68,68,.1) 0%, rgba(245,158,11,.08) 100%);
    border-color: rgba(239,68,68,.3);
}

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

.trial-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    background: rgba(99,102,241,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary-light);
    flex-shrink: 0;
}

.trial-status-card.urgent .trial-card-icon {
    background: rgba(239,68,68,.15);
    color: #f87171;
}

.trial-card-text h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 2px;
    color: var(--text-primary);
}

.trial-card-text p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

.trial-card-actions {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .trial-status-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .trial-card-actions {
        width: 100%;
    }
    .trial-card-actions .btn {
        flex: 1;
        justify-content: center;
    }
}

/* Active sidebar item pulse */
.sidebar-nav a.active {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-glow);
    position: relative;
}

/* ── Progress Bar ──────────────────────────────────────────── */
.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
    min-width: 4px;
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.error   { background: var(--error);   }
.progress-bar.info    { background: var(--info);    }

.progress-sm { height: 4px; }
.progress-lg { height: 12px; }

/* ── CSS-only Tooltips  (data-tooltip attribute) ─────────────*/
[data-tooltip] { position: relative; }

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-active);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-family: var(--font-sans);
    white-space: nowrap;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-secondary);
    box-shadow: var(--shadow-md);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 1200;
}

[data-tooltip]:hover::before { opacity: 1; }

/* ── Micro-animations ──────────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}

.skeleton {
    background: linear-gradient(90deg,
        var(--bg-hover) 25%,
        var(--bg-active) 50%,
        var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* Card hover lift (can add to any .card) */
.card-hover {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}
.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* ── Alert / Notice Boxes ──────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    margin-bottom: var(--space-lg);
}

.alert i { flex-shrink: 0; margin-top: 2px; }

.alert-info    { background: var(--info-bg);    border: 1px solid rgba(59,130,246,0.3);    color: var(--info-light); }
.alert-success { background: var(--success-bg); border: 1px solid rgba(16,185,129,0.3);   color: var(--success-light); }
.alert-warning { background: var(--warning-bg); border: 1px solid rgba(245,158,11,0.3);   color: var(--warning-light); }
.alert-error   { background: var(--error-bg);   border: 1px solid rgba(239,68,68,0.3);    color: var(--error-light); }

/* ── Dividers ──────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border-primary);
    margin: var(--space-xl) 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: var(--space-xl) 0;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border-primary);
}

/* ── Stat-card colour accents ─────────────────────────────── */
.stat-card.accent-blue::before   { background: #3b82f6; }
.stat-card.accent-green::before  { background: var(--success); }
.stat-card.accent-orange::before { background: var(--accent); }
.stat-card.accent-purple::before { background: #8b5cf6; }
.stat-card.accent-pink::before   { background: #ec4899; }
.stat-card.accent-cyan::before   { background: var(--secondary); }

.stat-card-icon.blue   { color: #3b82f6; background: rgba(59,130,246,0.1); }
.stat-card-icon.green  { color: var(--success); background: var(--success-bg); }
.stat-card-icon.orange { color: var(--accent);  background: var(--warning-bg); }
.stat-card-icon.purple { color: #8b5cf6; background: rgba(139,92,246,0.1); }
.stat-card-icon.pink   { color: #ec4899; background: rgba(236,72,153,0.1); }
.stat-card-icon.cyan   { color: var(--secondary); background: rgba(6,182,212,0.1); }

/* ── Light Theme Overrides ─────────────────────────────────── */
body.light-theme {
    --bg-primary:   #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card:      #ffffff;
    --bg-hover:     #f8fafc;
    --bg-active:    #e2e8f0;
    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;
    --border-primary:   rgba(15, 23, 42, 0.09);
    --border-secondary: rgba(15, 23, 42, 0.18);
}

body.light-theme .header {
    background: rgba(255, 255, 255, 0.96);
    border-bottom-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .sidebar {
    background: #ffffff;
    border-right-color: rgba(15, 23, 42, 0.08);
}

body.light-theme .sidebar-nav a:hover {
    background: var(--bg-hover);
}

body.light-theme .form-input,
body.light-theme .form-select,
body.light-theme .form-textarea {
    background: var(--bg-hover);
}

/* ── Mobile & Responsive Improvements ─────────────────────── */
@media (max-width: 1024px) {
    .header-search {
        max-width: 240px;
    }
    .header-nav-link span {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-search {
        display: none;   /* search hidden on small screens */
    }
    .header-nav {
        gap: 4px;
    }
}

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

/* ── Focus-visible ring (accessibility) ────────────────────── */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ── Print improvements ─────────────────────────────────────── */
@media print {
    .header,
    .sidebar,
    .sidebar-overlay,
    .btn,
    .modal { display: none !important; }
    .main-content { margin-left: 0 !important; padding-top: 0 !important; }
}


/* ============================================================
   PROFILE MENU  (app.js – header-profile)
   ============================================================ */

.header-profile {
  position: relative;
  margin-left: var(--space-sm, 8px);
  flex-shrink: 0;
}

.profile-avatar-btn {
  background: none;
  border: 2px solid var(--border-secondary);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.profile-avatar-btn:hover,
.profile-avatar-btn:focus-visible {
  border-color: var(--accent-primary, #6366f1);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
  outline: none;
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  user-select: none;
}

/* Dropdown */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: var(--bg-card, #1e2337);
  border: 1px solid var(--border-secondary, rgba(255,255,255,0.1));
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.profile-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.profile-dropdown-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-dropdown-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.profile-dropdown-email {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--border-primary);
  margin: 0;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.profile-dropdown-item:hover,
.profile-dropdown-item:focus-visible {
  background: var(--bg-hover);
  color: var(--text-primary);
  outline: none;
}
.profile-dropdown-item i {
  width: 16px;
  text-align: center;
  font-size: 13px;
  opacity: 0.75;
}
.profile-dropdown-signout {
  color: #f87171;
  border-radius: 0 0 12px 12px;
}
.profile-dropdown-signout:hover {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
}


/* ============================================================
   CHANGE PASSWORD MODAL
   ============================================================ */

.amp-modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 999999 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.amp-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.amp-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  margin: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: translateY(20px);
  transition: transform 0.2s ease;
}
.amp-modal-overlay.open .amp-modal {
  transform: translateY(0);
}

.amp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-primary);
}
.amp-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.amp-modal-header h3 i {
  color: var(--accent-primary, #6366f1);
}
.amp-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.amp-modal-close:hover { color: var(--text-primary); }

.amp-modal-body {
  padding: 20px;
}
.amp-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-primary);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.amp-form-group {
  margin-bottom: 16px;
}
.amp-form-group:last-child { margin-bottom: 0; }
.amp-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.amp-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.amp-input:focus {
  outline: none;
  border-color: var(--accent-primary, #6366f1);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.amp-modal-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
}
.amp-modal-msg--error   { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.amp-modal-msg--success { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }

.amp-btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
}
.amp-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.amp-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}
.amp-btn-primary:hover:not(:disabled) { opacity: 0.9; }
.amp-btn-ghost {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-secondary);
}
.amp-btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-primary);
}

/* Mobile: profile avatar still visible on small screens */
@media (max-width: 640px) {
  .profile-dropdown { right: -8px; min-width: 210px; }
}


/* ============================================================
   SIDEBAR COLLAPSE  (desktop only, ≥1025 px)
   ============================================================ */

:root {
  --sidebar-collapsed-width: 64px;
}

/* ── Collapse button ── */
.sidebar-collapse-btn {
  display: flex; /* restored: collapse button visible on desktop */
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  background: transparent;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-collapse-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-secondary);
}
.sidebar-collapse-btn i {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}
.sidebar-collapse-label {
  transition: opacity 0.2s ease, width 0.25s ease;
}

/* Hide collapse button on mobile (mobile uses open/close overlay) */
@media (max-width: 1024px) {
  .sidebar-collapse-btn { display: none; }
}

/* ── Collapsed sidebar ── */
@media (min-width: 1025px) {
  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    padding: var(--space-md) var(--space-xs);
    overflow: visible; /* let tooltips escape */
  }

  body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }

  /* Hide text labels */
  body.sidebar-collapsed .sidebar-nav a span,
  body.sidebar-collapsed .sidebar-title,
  body.sidebar-collapsed .sidebar-footer span,
  body.sidebar-collapsed .sidebar-collapse-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
  }

  /* Center icons */
  body.sidebar-collapsed .sidebar-nav a {
    justify-content: center;
    padding: 10px;
    gap: 0;
  }
  body.sidebar-collapsed .sidebar-nav a i {
    width: auto;
    font-size: 1.05rem;
  }

  /* Collapse button: icon only */
  body.sidebar-collapsed .sidebar-collapse-btn {
    justify-content: center;
    padding: 10px;
    gap: 0;
  }
  body.sidebar-collapsed .sidebar-collapse-btn i {
    margin: 0;
  }

  /* Sidebar footer: icon only */
  body.sidebar-collapsed .sidebar-footer {
    justify-content: center;
    padding: var(--space-md) var(--space-xs);
    gap: 0;
  }

  /* Tooltip on hover */
  body.sidebar-collapsed .sidebar-nav a {
    position: relative;
  }
  body.sidebar-collapsed .sidebar-nav a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card, #1e2337);
    border: 1px solid var(--border-primary, rgba(255,255,255,0.1));
    color: var(--text-primary);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }
  body.sidebar-collapsed .sidebar-nav a:hover::after {
    opacity: 1;
  }

}


/* ============================================================
   FULLSCREEN MODE
   ============================================================ */

body.app-fullscreen .sidebar,
body.app-fullscreen #sidebarOverlay {
  display: none !important;
}

body.app-fullscreen .header {
  display: none !important;
}

body.app-fullscreen .main-content {
  margin-left: 0 !important;
  padding-top: var(--space-xl) !important;
  min-height: 100vh;
}

/* ── Floating exit button ── */
.fullscreen-exit-btn {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99990;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(30, 35, 55, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 32px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  opacity: 0.5;
}
.fullscreen-exit-btn:hover {
  background: rgba(99, 102, 241, 0.85);
  opacity: 1;
  transform: scale(1.04);
}
.fullscreen-exit-btn i {
  font-size: 0.9rem;
}

body.app-fullscreen .fullscreen-exit-btn {
  display: flex !important;
}

/* Light theme adjustments */
body.light-theme.sidebar-collapsed .sidebar-nav a::after {
  background: #fff;
  border-color: rgba(0,0,0,0.12);
  color: #1a1d2e;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
body.light-theme .fullscreen-exit-btn {
  background: rgba(255,255,255,0.92);
  border-color: rgba(0,0,0,0.1);
  color: #1a1d2e;
}
body.light-theme .fullscreen-exit-btn:hover {
  background: rgba(99, 102, 241, 0.9);
  color: #fff;
}

/* Print / no-js safe */
@media print {
  .sidebar-collapse-btn, .fullscreen-exit-btn { display: none !important; }
}


/* ============================================================
   SIDEBAR COLLAPSE — BASE TRANSITIONS
   (defined at base level so they always apply on desktop)
   ============================================================ */
@media (min-width: 1025px) {
  /* Smooth collapse / expand animation */
  .sidebar {
    transition: width 0.28s cubic-bezier(.4,0,.2,1),
                padding 0.28s cubic-bezier(.4,0,.2,1);
  }

  .main-content {
    transition: margin-left 0.28s cubic-bezier(.4,0,.2,1);
  }

  /* Suppress animation on initial page load (no flash from expanded→collapsed) */
  body.amp-no-transition .sidebar,
  body.amp-no-transition .main-content {
    transition: none !important;
  }

  /* Sidebar overflow: auto normally (scrollable), visible when collapsed (tooltips) */
  body:not(.sidebar-collapsed) .sidebar {
    overflow-y: auto;
    overflow-x: hidden;
  }
  body.sidebar-collapsed .sidebar {
    overflow: visible;
  }
}

/* ============================================================
   PAGE HEADER  —  Standardised tool-page banner
   ──────────────────────────────────────────────────────────
   Usage:
     <div class="page-header">
       <div class="page-header-icon"><i class="fas fa-icon"></i></div>
       <div>
         <h1><i class="fas fa-icon"></i> Tool Name</h1>
         <p>Short description.</p>
         <!-- optional actions -->
         <div class="page-header-actions">
           <button class="btn btn-secondary">…</button>
         </div>
       </div>
     </div>

   Replaces: .cro-header (Conversion_Optimization_Playground.html),
             .page-intro  (traffic-split-test-tracker.html, others)
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  background: linear-gradient(135deg, rgba(99,102,241,.12) 0%, rgba(139,92,246,.06) 100%);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.page-header-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--primary-light);
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: var(--radius-xl);
}

.page-header h1 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  margin: 0 0 var(--space-xs);
  color: var(--text-primary);
  line-height: 1.2;
}

.page-header h1 i {
  color: var(--primary-light);
  margin-right: var(--space-xs);
}

.page-header p {
  color: var(--text-muted);
  font-size: .9375rem;
  margin: 0;
  line-height: 1.6;
}

.page-header-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--space-md);
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    text-align: center;
    padding: var(--space-xl);
    gap: var(--space-lg);
  }
  .page-header-icon {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }
  .page-header h1 {
    font-size: 1.5rem;
  }
  .page-header-actions {
    justify-content: center;
  }
}


/* ================================================================
   MOBILE RESPONSIVE ADDITIONS — v4
   All rules below are additive. Desktop styles are untouched.
   ================================================================ */

/* ── 1. Prevent any element from causing horizontal page scroll ── */
/* Applied globally — fixes any page that has wide tables or grids */

/* ── 2. Mobile menu toggle (hamburger) ─────────────────────────── */
/* Desktop: hidden because sidebar is always visible */
.mobile-menu-toggle {
  display: none;
}

@media (max-width: 1024px) {
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.1rem;
    margin-right: var(--space-sm);
    order: -1; /* ensure it appears before logo */
  }
  .mobile-menu-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
  }
}

/* ── 3. Sidebar overlay backdrop ────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active {
  display: block;
}

/* ── 4. Upgrade / Trial Banner ──────────────────────────────────── */
#ampUpgradeBanner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100; /* above header z-index:1000 */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: 10px var(--space-xl);
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  flex-wrap: wrap;
  min-height: 40px;
}
#ampUpgradeBanner a,
#ampUpgradeBanner button {
  color: #fff;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast);
}
#ampUpgradeBanner a:hover,
#ampUpgradeBanner button:hover {
  background: rgba(255,255,255,0.35);
}

/* When the banner is visible, push the header + sidebar down */
body.has-upgrade-bar .header {
  top: 40px;
}
body.has-upgrade-bar .sidebar {
  top: calc(var(--header-height, 60px) + 40px);
  height: calc(100vh - var(--header-height, 60px) - 40px);
}
body.has-upgrade-bar .main-content,
body.has-upgrade-bar .content-wrapper {
  padding-top: calc(var(--header-height, 60px) + 40px + var(--space-md, 16px));
}

@media (max-width: 768px) {
  #ampUpgradeBanner {
    font-size: 0.75rem;
    padding: 8px var(--space-md);
    gap: var(--space-sm);
    min-height: 36px;
  }
  #ampUpgradeBanner a,
  #ampUpgradeBanner button {
    font-size: 0.72rem;
    padding: 3px 8px;
  }
  body.has-upgrade-bar .header {
    top: 36px;
  }
  body.has-upgrade-bar .sidebar {
    top: calc(var(--header-height, 60px) + 36px);
    height: calc(100vh - var(--header-height, 60px) - 36px);
  }
  body.has-upgrade-bar .main-content,
  body.has-upgrade-bar .content-wrapper {
    padding-top: calc(var(--header-height, 60px) + 36px + var(--space-sm, 8px));
  }
}

/* ── 5. Global table overflow ───────────────────────────────────── */
@media (max-width: 768px) {
  .table-container,
  .data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Naked tables not wrapped in a container also scroll */
  .content-body table,
  .tool-content table,
  .page-content table,
  .card table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 100%;
  }
}

/* ── 6. Global body overflow guard ─────────────────────────────── */
body {
  overflow-x: hidden;
}

/* ── 7. Header: shrink padding on small screens ─────────────────── */
@media (max-width: 768px) {
  .header {
    padding: 0 var(--space-md);
  }
  .header-search {
    display: none;
  }
  .header-right {
    gap: var(--space-sm);
  }
}

/* ── 8. Sidebar: slide in on mobile ─────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper,
  .app-container {
    margin-left: 0 !important;
  }
  .main-content,
  .content-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* ── 9. Collapsed sidebar: hide on mobile (use overlay instead) ─── */
@media (max-width: 1024px) {
  .sidebar-collapse-btn {
    display: none !important;
  }
}

/* ── 10. Content calendar: 7-col → 3-col → 1-col ───────────────── */
@media (max-width: 768px) {
  .calendar-grid,
  .week-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}
@media (max-width: 480px) {
  .calendar-grid,
  .week-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── 11. 4-column grids → 2-col → 1-col ────────────────────────── */
@media (max-width: 768px) {
  .stats-grid,
  .metrics-grid,
  .cards-grid,
  .tools-grid,
  .features-grid,
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 480px) {
  .stats-grid,
  .metrics-grid,
  .cards-grid,
  .tools-grid,
  .features-grid,
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── 12. Two-panel layouts (sidebar + main) collapse on mobile ──── */
@media (max-width: 768px) {
  .tool-layout,
  .split-layout,
  .panel-layout {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }
  .tool-sidebar,
  .panel-sidebar,
  .right-panel,
  .left-panel {
    width: 100% !important;
    min-width: unset !important;
    max-width: unset !important;
  }
}

/* ── 13. Forms: full-width inputs on mobile ─────────────────────── */
@media (max-width: 768px) {
  .form-row,
  .form-grid {
    grid-template-columns: 1fr !important;
    flex-direction: column;
  }
  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100%;
    box-sizing: border-box;
  }
}

/* ── 14. Buttons: stack on very small screens ───────────────────── */
@media (max-width: 480px) {
  .btn-group,
  .button-row,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-group .btn,
  .button-row .btn,
  .action-row .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

/* ── 15. Page header: wrap on mobile ────────────────────────────── */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
  .page-header .page-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ── 16. Cards full-width on mobile ─────────────────────────────── */
@media (max-width: 480px) {
  .card {
    padding: var(--space-md) !important;
  }
  .card-header {
    flex-direction: column;
    gap: var(--space-xs);
  }
}

/* ── 17. Pricing grid: 3-col → 1-col ───────────────────────────── */
@media (max-width: 768px) {
  .pricing-grid,
  .plans-grid {
    grid-template-columns: 1fr !important;
    max-width: 420px;
    margin: 0 auto;
  }
}

/* ── 18. Tabs: scroll horizontally ─────────────────────────────── */
@media (max-width: 768px) {
  .tabs,
  .tab-list,
  .nav-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
}

/* ── 19. Modal: full-screen on mobile ───────────────────────────── */
@media (max-width: 640px) {
  .modal-content,
  .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
}

/* ── 20. Compliance checker 2-panel fix ─────────────────────────── */
@media (max-width: 768px) {
  .compliance-layout,
  .checker-layout {
    grid-template-columns: 1fr !important;
  }
}

