/* ==========================================================================
   URBAN VISION GROWTH - PREMIUM DEMO STYLES (STRIPE/LINEAR LEVEL)
   ========================================================================== */

/* --- 1. CSS VARIABLES (THEMING) --- */
:root[data-theme="light"] {
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --primary-color: #0f172a;
    --primary-hover: #1e293b;
    --accent-color: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.2);
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

:root[data-theme="dark"] {
    --bg-body: #020617;
    --bg-surface: #0f172a;
    --bg-surface-hover: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --accent-color: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --sidebar-bg: #0f172a;
    --sidebar-border: #1e293b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.7);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-bg: rgba(15, 23, 42, 0.7);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

/* --- 2. RESET & TYPOGRAPHY --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', 'Inter', sans-serif;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    overflow: hidden; /* Prevent body scroll, handle inside main */
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* --- 3. LAYOUT (SIDEBAR & MAIN) --- */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-left: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-color), #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.brand-name {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

/* Industry Switcher */
.industry-switcher {
    padding: 16px 20px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.current-industry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: var(--bg-surface-hover);
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.current-industry:hover {
    border-color: var(--accent-color);
}

.ind-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ind-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.ind-name {
    font-size: 0.9rem;
    font-weight: 700;
}

.industry-dropdown {
    position: absolute;
    top: 100%;
    left: 20px;
    right: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.industry-switcher.open .industry-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ind-option {
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.ind-option:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.ind-option.active {
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.nav-group {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
    margin-top: 24px;
    padding-right: 12px;
}

.nav-group:first-child { margin-top: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    position: relative;
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

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

.nav-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
}

.ai-highlight {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.1), transparent);
    color: #8b5cf6;
    border-right: 3px solid #8b5cf6;
}

.badge {
    margin-right: auto;
    background: #8b5cf6;
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
}

/* User Profile */
.user-profile {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name { font-weight: 700; font-size: 0.9rem; }
.user-role { font-size: 0.75rem; color: var(--text-secondary); }

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Topbar */
.topbar {
    height: 64px;
    background-color: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 50;
    flex-shrink: 0;
    gap: 12px;
    overflow: hidden;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.topbar-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

.mobile-toggle {
    display: none;
    font-size: 1.1rem;
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.demo-badge {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
    animation: gentlePulse 3s infinite;
}

@keyframes gentlePulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; box-shadow: 0 0 8px rgba(239, 68, 68, 0.25); }
    100% { opacity: 0.8; }
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    width: 300px;
}

.search-bar i { color: var(--text-secondary); }
.search-bar input {
    border: none;
    background: none;
    outline: none;
    color: var(--text-primary);
    flex: 1;
    font-family: inherit;
    font-size: 0.9rem;
}
.shortcut {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--bg-body);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

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

.pulse-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

/* Views Container */
.views-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    position: relative;
}

/* Page Transitions */
.view {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* --- 4. REUSABLE UI COMPONENTS --- */

/* Grid System */
.grid-cols-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 32px; }
.grid-cols-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 32px; }

/* Stat Cards */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

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

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.stat-trend {
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* Panels */
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.btn-primary {
    background: var(--accent-color);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-secondary {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

/* Remove old duplicate data-table panel styles - handled by new module CSS below */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Dashboard inline table (not wrapped) uses lighter styling */
.panel .data-table th {
    text-align: right;
    padding: 12px 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    background: transparent;
}

.panel .data-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    vertical-align: middle;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}
.status-completed { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status-cancelled { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Activity Feed */
.activity-list {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.activity-item {
    display: flex;
    gap: 16px;
    position: relative;
}

.activity-item::before {
    content: '';
    position: absolute;
    right: 15px; /* RTL fix for timeline */
    top: 32px;
    bottom: -20px;
    width: 2px;
    background: var(--border-color);
}
.activity-item:last-child::before { display: none; }

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    z-index: 1;
    border: 2px solid var(--bg-surface);
}

.activity-content { flex: 1; }
.activity-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.activity-time { font-size: 0.8rem; color: var(--text-secondary); }

/* Floating AI Widget */
.ai-widget-trigger {
    position: fixed;
    bottom: 32px;
    left: 32px; /* RTL left placement */
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-widget-trigger:hover {
    transform: scale(1.1);
}

/* Empty States / Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface-hover) 25%, var(--border-color) 50%, var(--bg-surface-hover) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}
@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   PREMIUM USER JOURNEY (WELCOME -> SELECTOR -> LOADER -> DASHBOARD)
   ========================================================================== */

.journey-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    background-color: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    transform: scale(1);
    overflow: hidden;
}

.hidden-screen {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    z-index: -1;
    display: none !important;
}

.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.fade-in {
    animation: scaleFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scaleFadeIn {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

/* --- 1. WELCOME SCREEN --- */
#welcome-screen {
    background: radial-gradient(circle at 50% 50%, var(--bg-surface-hover), var(--bg-body));
    flex-direction: column;
}

.welcome-bg-glow {
    position: absolute;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
    border-radius: 50%;
    animation: pulseGlow 8s ease-in-out infinite alternate;
    z-index: 1;
}

@keyframes pulseGlow {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.2); opacity: 0.8; }
}

.welcome-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    padding: 40px;
}

.huge-logo {
    width: 80px;
    height: 80px;
    font-size: 2.5rem;
    margin: 0 auto 32px;
    box-shadow: 0 10px 30px var(--accent-glow);
}

.welcome-title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-desc {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 48px;
    line-height: 1.6;
}

.btn-premium {
    background: var(--primary-color);
    color: var(--bg-surface);
    font-size: 1.2rem;
    font-weight: 700;
    padding: 16px 48px;
    border-radius: 100px;
    display: inline-flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-premium:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.btn-premium i {
    transition: transform 0.3s ease;
}

.btn-premium:hover i {
    transform: translateX(-5px); /* RTL */
}

/* --- 2. INDUSTRY SELECTOR --- */
#industry-selector {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 80px 40px;
    overflow-y: auto;
}

.selector-header {
    text-align: center;
    margin-bottom: 64px;
    width: 100%;
}

.selector-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.selector-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.industry-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.ind-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.ind-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent, var(--bg-surface-hover));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.ind-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg), 0 20px 40px -10px var(--card-color, var(--accent-glow));
    border-color: var(--card-color, var(--accent-color));
}

.ind-card:hover::after {
    opacity: 1;
}

.ind-card-icon {
    width: 64px;
    height: 64px;
    background: var(--bg-surface-hover);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--text-primary);
    margin: 0 auto 24px;
    transition: all 0.4s ease;
    position: relative;
    z-index: 2;
}

.ind-card:hover .ind-card-icon {
    background: var(--card-color, var(--accent-color));
    color: white;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 10px 20px -5px var(--card-color, var(--accent-color));
}

.ind-card h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}

.ind-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

.ind-features {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 12px;
    border-radius: 100px;
    display: inline-block;
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
}

.explore-btn {
    position: relative;
    z-index: 2;
    background: var(--primary-color);
    color: var(--bg-surface);
    padding: 10px 24px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.ind-card:hover .explore-btn {
    opacity: 1;
    transform: translateY(0);
}

/* --- 3. LOADING EXPERIENCE --- */
#loading-screen {
    background: var(--bg-surface);
}

.loader-content {
    max-width: 400px;
    width: 100%;
}

.loader-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 32px;
    text-align: center;
}

.loader-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}

.load-step {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.load-step i {
    font-size: 1.2rem;
}

.load-step.pending {
    color: var(--text-secondary);
    opacity: 0.5;
}

.load-step.completed i {
    color: var(--success);
}
.load-step.completed i::before {
    content: "\f058"; /* fa-circle-check */
    font-weight: 900;
}

.loader-progress-bar {
    height: 4px;
    background: var(--bg-surface-hover);
    border-radius: 4px;
    overflow: hidden;
}

.loader-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

/* --- 4. TOPBAR OVERRIDES FOR NEW FLOW --- */
.btn-change-industry {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 7px 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
}

.btn-change-industry:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 8px;
}

.industry-indicator {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}


/* Responsive Design */
@media (max-width: 1200px) {
    .industry-grid { grid-template-columns: repeat(3, 1fr); }
}

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

@media (max-width: 768px) {
    /* Welcome Screen */
    .welcome-title { font-size: 2rem; }
    .welcome-desc { font-size: 1rem; padding: 0 16px; }
    .huge-logo { width: 60px; height: 60px; font-size: 1.8rem; margin-bottom: 20px; }
    .welcome-bg-glow { width: 100vw; height: 100vw; }
    .btn-premium { font-size: 1rem; padding: 14px 32px; }

    /* Selector Screen */
    #industry-selector { padding: 32px 16px; }
    .selector-header { margin-bottom: 24px; }
    .selector-header h2 { font-size: 1.5rem; }
    .industry-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .ind-card { padding: 20px 12px; }
    .ind-card h3 { font-size: 0.9rem; }
    .ind-card p { font-size: 0.73rem; }
    .ind-card-icon { width: 48px; height: 48px; font-size: 1.3rem; margin-bottom: 10px; }

    /* Sidebar */
    .app-layout { flex-direction: column; }
    .sidebar {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 75%;
        max-width: 280px;
        z-index: 500;
        transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .sidebar.open { right: 0; box-shadow: -8px 0 40px rgba(0,0,0,0.25); }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 499; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
    .sidebar-overlay.active { display: block; }

    /* --- TOPBAR MOBILE FIX --- */
    .mobile-toggle { display: flex !important; }
    .search-bar { display: none; }
    .divider { display: none; }

    .topbar {
        height: 56px;
        padding: 0 12px;
        gap: 8px;
    }
    /* Left side: [☰] [Title  [badge]] */
    .topbar-left {
        flex: 1;
        gap: 8px;
        min-width: 0;
        overflow: hidden;
    }
    .topbar-title-group {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        overflow: hidden;
    }
    .page-title {
        font-size: 0.95rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 140px;
    }
    .demo-badge {
        font-size: 0.58rem;
        padding: 2px 7px;
        gap: 3px;
        border-radius: 100px;
    }
    /* Right side: compact icon buttons only */
    .topbar-right {
        gap: 6px;
        flex-shrink: 0;
    }
    .icon-btn {
        width: 34px;
        height: 34px;
        border-radius: 8px;
    }
    .btn-change-industry {
        width: 34px;
        height: 34px;
        padding: 0;
        border-radius: 8px;
        justify-content: center;
    }
    .btn-change-industry .btn-label { display: none; }

    /* Views */
    .views-container { padding: 14px 12px; }

    /* Grids */
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
    .grid-cols-2 { grid-template-columns: 1fr; gap: 12px; margin-bottom: 14px; }

    /* Stat Cards */
    .stat-card { padding: 14px; }
    .stat-value { font-size: 1.3rem; }
    .stat-title { font-size: 0.8rem; }

    /* Panel */
    .panel-header { padding: 12px 14px; }
    .panel-title { font-size: 0.9rem; }

    /* AI Widget */
    .ai-widget-trigger { width: 48px; height: 48px; font-size: 1.1rem; bottom: 16px; left: 12px; }
    .ai-chat-window { width: calc(100vw - 24px); left: 12px; bottom: 78px; }
}

@media (max-width: 400px) {
    .page-title { max-width: 100px; font-size: 0.88rem; }
    .grid-cols-4 { grid-template-columns: 1fr; }
    .btn-premium { width: 100%; justify-content: center; font-size: 0.95rem; }
    .industry-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* ==========================================================================
   NOTIFICATION PANEL
   ========================================================================== */

.notif-panel {
    position: fixed;
    z-index: 3000;
    width: 360px;
    max-height: 520px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-2xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.notif-panel.notif-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.notif-title {
    font-size: 1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-count {
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 100px;
    min-width: 20px;
    text-align: center;
}

.notif-clear-btn {
    font-size: 0.78rem;
    color: var(--accent-color);
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
    white-space: nowrap;
}
.notif-clear-btn:hover { background: rgba(59, 130, 246, 0.08); }

.notif-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease;
}
.notif-item:hover { background: var(--bg-surface-hover); }
.notif-item.unread { background: rgba(59, 130, 246, 0.04); }
.notif-item.unread:hover { background: rgba(59, 130, 246, 0.08); }

.notif-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.notif-content { flex: 1; min-width: 0; }

.notif-item-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.notif-item-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-time {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 600;
    opacity: 0.7;
}

.notif-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.notif-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.notif-footer button {
    width: 100%;
    padding: 10px;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.notif-footer button:hover {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

@media (max-width: 768px) {
    .notif-panel {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px !important;
    }
}

/* --- 5. AI CHAT WINDOW --- */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    left: 32px;
    width: 380px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-glass);
    display: flex;
    flex-direction: column;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom left;
}

.ai-chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ai-chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(139, 92, 246, 0.05);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--accent-color);
}

.online-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ==========================================================================
   NEW MODULES CSS (CRM, Appointments, AI, Marketing, Automation)
   ========================================================================== */

/* CRM & Tables */
.data-table-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    padding: 16px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

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

.client-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.client-avatar {
    width: 40px;
    height: 40px;
    background: rgba(var(--accent-color-rgb, 139,92,246), 0.1);
    color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 8px;
    border-radius: 8px;
}
.action-btn:hover { background: var(--bg-surface-hover); color: var(--accent-color); }

/* Modals */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-content {
    background: var(--bg-surface); border-radius: 24px; width: 90%; max-width: 600px;
    transform: translateY(20px) scale(0.95); transition: all 0.3s ease;
    box-shadow: var(--shadow-2xl);
    max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal-content { transform: translateY(0) scale(1); }
.modal-header { padding: 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 24px; }

/* AI Simulator */
.ai-sim-container {
    background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 20px;
    height: 400px; display: flex; flex-direction: column; overflow: hidden;
}
.ai-sim-messages { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.sim-bubble { max-width: 80%; padding: 16px; border-radius: 20px; font-size: 0.95rem; line-height: 1.5; animation: slideUp 0.3s ease forwards; }
.sim-bubble.client { background: var(--bg-surface-hover); align-self: flex-end; border-bottom-right-radius: 4px; }
.sim-bubble.ai { background: rgba(var(--accent-color-rgb, 139,92,246), 0.1); color: var(--accent-color); align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid rgba(var(--accent-color-rgb, 139,92,246), 0.2); }

/* Campaign Cards */
.campaign-card {
    background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px;
    transition: all 0.3s ease;
}
.campaign-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--accent-color); }
.campaign-stat { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; }

/* Workflows */
.workflow-item {
    background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; margin-bottom: 16px;
}
.wf-visual { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.wf-node { background: var(--bg-surface-hover); padding: 8px 16px; border-radius: 100px; font-size: 0.85rem; font-weight: 600; color: var(--text-primary); border: 1px solid var(--border-color); }
.wf-arrow { color: var(--text-secondary); font-size: 0.8rem; }

/* Mobile Adaptations */
@media (max-width: 768px) {
    .data-table thead { display: none; }
    .data-table tbody tr { display: flex; flex-direction: column; padding: 16px; gap: 8px; background: var(--bg-surface); margin-bottom: 16px; border-radius: 16px; border: 1px solid var(--border-color); }
    .data-table td { padding: 0; border: none; display: flex; justify-content: space-between; align-items: center; text-align: right; }
    .data-table td::before { content: attr(data-label); font-weight: 700; color: var(--text-secondary); font-size: 0.8rem; margin-left: 16px; }
}

.ai-chat-body {
    padding: 20px;
    height: 350px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-chat-body::-webkit-scrollbar { width: 4px; }
.ai-chat-body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.ai-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 85%;
}

.ai-msg.received { align-self: flex-start; }
.ai-msg.sent { align-self: flex-end; }

.msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.received .msg-bubble {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-bottom-right-radius: 4px; /* RTL fix */
}

.sent .msg-bubble {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border-bottom-left-radius: 4px; /* RTL fix */
}

.msg-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-right: 4px;
}
.sent .msg-time { text-align: left; margin-left: 4px; margin-right: 0; }

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.ai-sug-btn {
    background: var(--bg-surface);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.ai-sug-btn:hover {
    background: var(--accent-color);
    color: white;
}

.ai-chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-input-area input {
    flex: 1;
    background: var(--bg-surface-hover);
    border: 1px solid transparent;
    padding: 10px 16px;
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.ai-chat-input-area input:focus { border-color: var(--accent-color); }

.ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-send-btn:hover { transform: scale(1.05); }

@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100% - 40px);
        left: 20px;
        bottom: 90px;
    }
}
