/* ============================================================================
   MF AGENCY — Premium Design System
   A comprehensive glassmorphism-based design system for the agency platform.
   ============================================================================ */

/* ── CSS Custom Properties (Design Tokens) ─────────────────────────────────── */
:root {
    /* Brand Colors */
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-200: #bfdbfe;
    --brand-300: #93c5fd;
    --brand-400: #60a5fa;
    --brand-500: #3b82f6;
    --brand-600: #2563eb;
    --brand-700: #1d4ed8;
    --brand-800: #1e40af;
    --brand-900: #1e3a8a;

    /* Neutral Palette */
    --slate-25: #FAFAFC;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    /* Semantic Colors */
    --success-50: #f0fdf4;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --info-50: #eff6ff;
    --info-500: #3b82f6;
    --info-600: #2563eb;

    /* Portal Accent Colors */
    --admin-accent: #2563eb;
    --admin-accent-light: #eff6ff;
    --client-accent: #7c3aed;
    --client-accent-light: #f5f3ff;
    --team-accent: #0d9488;
    --team-accent-light: #f0fdfa;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;

    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

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

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-brand: 0 4px 14px rgba(37, 99, 235, 0.25);
    --shadow-success: 0 4px 14px rgba(34, 197, 94, 0.25);
    --shadow-danger: 0 4px 14px rgba(239, 68, 68, 0.25);

    /* Glass Effects */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-bg-solid: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: 16px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 64px;
}


/* ── Global Reset & Base ───────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

body {
    font-family: var(--font-sans);
    background-color: var(--slate-25);
    color: var(--slate-800);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

::selection {
    background: var(--brand-100);
    color: var(--brand-900);
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

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

button {
    cursor: pointer;
    font-family: inherit;
}

input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
}


/* ── Glass Panel System ────────────────────────────────────────────────────── */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
}

.glass-solid {
    background: var(--glass-bg-solid);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
}

.glass-card {
    background: var(--glass-bg-solid);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

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

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


/* ── Typography ────────────────────────────────────────────────────────────── */
.heading-1 {
    font-size: var(--text-4xl);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.025em;
    color: var(--slate-900);
}

.heading-2 {
    font-size: var(--text-3xl);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--slate-900);
}

.heading-3 {
    font-size: var(--text-2xl);
    font-weight: 700;
    line-height: 1.3;
    color: var(--slate-900);
}

.heading-4 {
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: 1.4;
    color: var(--slate-800);
}

.heading-5 {
    font-size: var(--text-lg);
    font-weight: 600;
    line-height: 1.5;
    color: var(--slate-800);
}

.text-body {
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--slate-600);
}

.text-small {
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--slate-500);
}

.text-caption {
    font-size: var(--text-xs);
    line-height: 1.5;
    color: var(--slate-400);
    letter-spacing: 0.01em;
}

.text-label {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slate-400);
}


/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    transition: all var(--transition-base);
    white-space: nowrap;
    line-height: 1.25;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

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

/* Primary */
.btn-primary {
    background: var(--brand-600);
    color: #fff;
    box-shadow: var(--shadow-brand);
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-700);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

/* Secondary */
.btn-secondary {
    background: var(--slate-100);
    color: var(--slate-700);
    border-color: var(--slate-200);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--slate-200);
    border-color: var(--slate-300);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--slate-600);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--slate-100);
    color: var(--slate-800);
}

/* Danger */
.btn-danger {
    background: var(--danger-500);
    color: #fff;
    box-shadow: var(--shadow-danger);
}

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

/* Success */
.btn-success {
    background: var(--success-500);
    color: #fff;
    box-shadow: var(--shadow-success);
}

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

/* Outline */
.btn-outline {
    background: transparent;
    color: var(--brand-600);
    border-color: var(--brand-200);
}

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

/* Sizes */
.btn-xs {
    padding: 0.375rem 0.75rem;
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: var(--text-base);
}

.btn-icon {
    padding: 0.5rem;
    width: 2.25rem;
    height: 2.25rem;
}


/* ── Form Controls ─────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: var(--space-1);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--slate-400);
    margin-top: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: var(--text-sm);
    color: var(--slate-800);
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--slate-300);
}

.form-input.is-error,
.form-textarea.is-error {
    border-color: var(--danger-500);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.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 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

.form-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: var(--brand-600);
    cursor: pointer;
}

.form-input-icon {
    position: relative;
}

.form-input-icon .icon-left {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--slate-400);
    pointer-events: none;
}

.form-input-icon .form-input {
    padding-left: 2.5rem;
}


/* ── Badge / Tag System ────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
    white-space: nowrap;
}

.badge-primary { background: var(--brand-100); color: var(--brand-700); }
.badge-success { background: var(--success-50); color: var(--success-600); }
.badge-warning { background: var(--warning-50); color: var(--warning-600); }
.badge-danger  { background: var(--danger-50); color: var(--danger-600); }
.badge-info    { background: var(--info-50); color: var(--info-600); }
.badge-neutral { background: var(--slate-100); color: var(--slate-600); }

.badge-dot::before {
    content: '';
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}


/* ── Stat / KPI Cards ──────────────────────────────────────────────────────── */
.stat-card {
    padding: var(--space-5) var(--space-6);
    border-radius: var(--radius-xl);
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-base);
}

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

.stat-card .stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--slate-900);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: var(--text-xs);
    color: var(--slate-400);
    font-weight: 500;
}

.stat-card .stat-trend {
    font-size: var(--text-xs);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
}

.stat-trend.up { color: var(--success-600); }
.stat-trend.down { color: var(--danger-600); }


/* ── Table System ──────────────────────────────────────────────────────────── */
.data-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(226, 232, 240, 0.6);
    background: #fff;
    box-shadow: var(--shadow-xs);
}

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

.data-table thead {
    background: var(--slate-50);
    border-bottom: 1px solid var(--slate-200);
}

.data-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slate-400);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--slate-100);
    transition: background var(--transition-fast);
}

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

.data-table tbody tr:hover {
    background: var(--slate-50);
}

.data-table tbody td {
    padding: 0.75rem 1rem;
    color: var(--slate-700);
    vertical-align: middle;
}


/* ── Modal / Dialog ────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-panel {
    background: #fff;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-spring);
}

.modal-overlay.active .modal-panel {
    transform: scale(1) translateY(0);
}

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

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
}


/* ── Toast / Alert System ──────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-xl);
    background: #fff;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--slate-200);
    min-width: 320px;
    max-width: 420px;
    pointer-events: auto;
    transform: translateX(120%);
    transition: transform var(--transition-spring);
}

.toast.show {
    transform: translateX(0);
}

.toast-success { border-left: 3px solid var(--success-500); }
.toast-error   { border-left: 3px solid var(--danger-500); }
.toast-warning { border-left: 3px solid var(--warning-500); }
.toast-info    { border-left: 3px solid var(--info-500); }

.alert {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-success { background: var(--success-50); color: var(--success-600); border: 1px solid rgba(34, 197, 94, 0.2); }
.alert-error   { background: var(--danger-50); color: var(--danger-600); border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-warning { background: var(--warning-50); color: var(--warning-600); border: 1px solid rgba(245, 158, 11, 0.2); }
.alert-info    { background: var(--info-50); color: var(--info-600); border: 1px solid rgba(59, 130, 246, 0.2); }


/* ── Sidebar Layout ────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: #fff;
    border-right: 1px solid var(--slate-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: var(--space-5) var(--space-5);
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

.sidebar-logo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.sidebar-logo.admin { background: linear-gradient(135deg, var(--brand-600), var(--brand-700)); }
.sidebar-logo.client { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.sidebar-logo.team { background: linear-gradient(135deg, #0d9488, #0f766e); }

.sidebar-brand {
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--slate-900);
    line-height: 1.2;
}

.sidebar-brand small {
    display: block;
    font-size: var(--text-xs);
    font-weight: 400;
    color: var(--slate-400);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-3) var(--space-3);
    overflow-y: auto;
}

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

.sidebar-section-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-300);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--slate-600);
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
}

.sidebar-link:hover {
    background: var(--slate-50);
    color: var(--slate-900);
}

.sidebar-link.active {
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}

.sidebar-link.active.client-active {
    background: var(--client-accent-light);
    color: var(--client-accent);
}

.sidebar-link.active.team-active {
    background: var(--team-accent-light);
    color: var(--team-accent);
}

.sidebar-link .link-icon {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active .link-icon {
    opacity: 1;
}

.sidebar-link .link-badge {
    margin-left: auto;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--danger-500);
    color: #fff;
    line-height: 1.4;
}

.sidebar-footer {
    padding: var(--space-4) var(--space-4);
    border-top: 1px solid var(--slate-100);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    transition: background var(--transition-fast);
}

.sidebar-user:hover {
    background: var(--slate-50);
}

.sidebar-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    background: var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--slate-600);
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--slate-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--text-xs);
    color: var(--slate-400);
}


/* ── Main Content Area ─────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--slate-900);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--slate-400);
}

.topbar-breadcrumb a {
    color: var(--slate-400);
    transition: color var(--transition-fast);
}

.topbar-breadcrumb a:hover {
    color: var(--brand-600);
}

.topbar-breadcrumb .separator {
    color: var(--slate-300);
}

.topbar-breadcrumb .current {
    color: var(--slate-700);
    font-weight: 500;
}

.page-content {
    flex: 1;
    padding: var(--space-6);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.page-header-left {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}


/* ── Notification Bell ─────────────────────────────────────────────────────── */
.notification-bell {
    position: relative;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--slate-500);
    transition: all var(--transition-fast);
}

.notification-bell:hover {
    background: var(--slate-100);
    color: var(--slate-700);
}

.notification-bell .bell-count {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--danger-500);
    color: #fff;
    font-size: 0.5625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}


/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.pagination-btn {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--slate-600);
    background: transparent;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.pagination-btn:hover {
    background: var(--slate-100);
}

.pagination-btn.active {
    background: var(--brand-600);
    color: #fff;
    border-color: var(--brand-600);
}


/* ── Dropdown ──────────────────────────────────────────────────────────────── */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    min-width: 12rem;
    padding: var(--space-1);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.5rem 0.75rem;
    font-size: var(--text-sm);
    color: var(--slate-600);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--slate-50);
    color: var(--slate-900);
}

.dropdown-divider {
    height: 1px;
    background: var(--slate-100);
    margin: var(--space-1) 0;
}


/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--slate-200);
    gap: 0;
    overflow-x: auto;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--slate-500);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
    cursor: pointer;
    background: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--slate-700);
}

.tab.active {
    color: var(--brand-600);
    border-bottom-color: var(--brand-600);
    font-weight: 600;
}


/* ── Avatar ────────────────────────────────────────────────────────────────── */
.avatar {
    border-radius: var(--radius-full);
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.avatar-xs { width: 1.5rem; height: 1.5rem; font-size: 0.5rem; }
.avatar-sm { width: 2rem; height: 2rem; font-size: 0.625rem; }
.avatar-md { width: 2.5rem; height: 2.5rem; font-size: 0.75rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 0.875rem; }
.avatar-xl { width: 4rem; height: 4rem; font-size: 1rem; }

.avatar-stack {
    display: flex;
}

.avatar-stack .avatar {
    margin-left: -0.5rem;
    border: 2px solid #fff;
}

.avatar-stack .avatar:first-child {
    margin-left: 0;
}


/* ── Progress Bar ──────────────────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: var(--slate-100);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--brand-500), var(--brand-600));
    transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-fill.success { background: linear-gradient(90deg, var(--success-500), var(--success-600)); }
.progress-bar-fill.warning { background: linear-gradient(90deg, var(--warning-500), var(--warning-600)); }
.progress-bar-fill.danger  { background: linear-gradient(90deg, var(--danger-500), var(--danger-600)); }


/* ── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-8);
}

.empty-state-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto var(--space-4);
    border-radius: var(--radius-full);
    background: var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slate-400);
}

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

.empty-state-text {
    font-size: var(--text-sm);
    color: var(--slate-400);
    max-width: 24rem;
    margin: 0 auto var(--space-6);
}


/* ── Loading States ────────────────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-200) 50%, var(--slate-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

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

.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--slate-200);
    border-top-color: var(--brand-600);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}

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

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}


/* ── HTMX Loading Indicator ───────────────────────────────────────────────── */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-flex;
}

.htmx-request .htmx-hide {
    display: none;
}


/* ── Mobile Sidebar Toggle ─────────────────────────────────────────────────── */
.sidebar-toggle {
    display: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-lg);
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--slate-600);
    cursor: pointer;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 90;
}


/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop.active {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: var(--space-4);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .heading-1 {
        font-size: var(--text-3xl);
    }

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

    .data-table-wrap {
        border-radius: var(--radius-lg);
    }

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

    .toast-container {
        left: var(--space-4);
        right: var(--space-4);
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    .modal-panel {
        margin: var(--space-4);
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 0 var(--space-4);
    }

    .page-content {
        padding: var(--space-3);
    }
}


/* ── Utility Animations ────────────────────────────────────────────────────── */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

.slide-up {
    animation: slideUp 0.4s ease-out;
}

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

.scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}


/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
}


/* ── Print Styles ──────────────────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .sidebar-toggle, .sidebar-backdrop {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
    }

    .glass-card, .stat-card, .data-table-wrap {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ── Apple-Inspired Glass & Visual Utility Additions ──────────────────────── */
.apple-glass-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dark .apple-glass-card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 35px -10px rgba(0, 0, 0, 0.5);
}

.apple-glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.1), 0 0 20px rgba(59, 130, 246, 0.15);
}

.apple-glass-nav {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.dark .apple-glass-nav {
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(30, 41, 59, 0.8);
}

/* Shimmer & Skeleton Effects */
.shimmer {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

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

.skeleton {
    background-color: rgba(226, 232, 240, 0.6);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.dark .skeleton {
    background-color: rgba(30, 41, 59, 0.6);
}

/* Dynamic Page Builder & Chat Styles */
.chat-scroll-area {
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.typing-dot {
    animation: typingPulse 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.page-block-card {
    transition: all 0.2s ease;
}
.page-block-card:hover {
    border-color: rgba(59, 130, 246, 0.5);
}

