:root {
    /* Color Palette */
    --bg-dark: #0a0a0c;
    --bg-panel: rgba(22, 22, 26, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f0f0f5;
    --text-muted: #9aa0a6;
    
    /* Accents */
    --accent-primary: #7c3aed; /* Deep Purple */
    --accent-glow: rgba(124, 58, 237, 0.5);
    --color-green: #10b981; /* Success / Money */
    --color-green-glow: rgba(16, 185, 129, 0.2);
    --color-red: #ef4444; /* Warning / Loss */
    --color-red-glow: rgba(239, 68, 68, 0.2);
    --color-blue: #3b82f6;
    
    /* Variables */
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Typography */
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    /* Subtle background glow effect */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(124, 58, 237, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
}

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

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(10, 10, 12, 0.8);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    z-index: 100;
    transition: var(--transition);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
    border-radius: 10px;
    box-shadow: 0 0 15px var(--accent-glow);
}

.logo-text {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text .accent {
    color: var(--color-green);
}

.main-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.1) 0%, transparent 100%);
    border-left: 3px solid var(--accent-primary);
}

.nav-item ion-icon {
    font-size: 20px;
}

.alert-indicator .badge {
    background: var(--color-red);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.user-profile .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

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

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.top-header {
    height: 80px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    background: rgba(10,10,12,0.4);
    backdrop-filter: blur(10px);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    width: 320px;
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    outline: none;
    font-size: 14px;
}

.search-bar ion-icon {
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn, .action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 20px;
}

.action-btn:hover {
    background: rgba(255,255,255,0.1);
}

.action-btn.active {
    position: relative;
}
.action-btn.active::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 12px;
    width: 8px;
    height: 8px;
    background: var(--color-red);
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

/* Dashboard Scroll Area */
.dashboard-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

.dashboard-scroll::-webkit-scrollbar {
    width: 8px;
}
.dashboard-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.dashboard-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

/* Welcome Section */
.welcome-section {
    margin-bottom: 32px;
}

.welcome-section h1 {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-section h1 span {
    color: var(--accent-primary);
}

.welcome-section p {
    color: var(--text-muted);
    font-size: 15px;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
}

.highlight-card {
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, rgba(22, 22, 26, 0.6) 100%);
    border-color: rgba(16, 185, 129, 0.2);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-title {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.kpi-icon {
    font-size: 24px;
    padding: 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
}

.var-blue { color: var(--color-blue); background: rgba(59, 130, 246, 0.1); }
.var-green { color: var(--color-green); background: var(--color-green-glow); }
.var-red { color: var(--color-red); background: var(--color-red-glow); }

.kpi-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
}

.warning-text { color: var(--color-red); }

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.kpi-trend.positive { color: var(--color-green); }
.kpi-trend.negative { color: var(--color-red); }

.kpi-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--color-green);
    border-radius: 10px;
    box-shadow: 0 0 10px var(--color-green);
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    align-self: flex-end;
}

/* Middle Section */
.middle-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

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

.panel-header h2 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-sparkle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.chart-container {
    padding: 24px;
}

.chart-wrapper {
    height: 300px;
    width: 100%;
}

.actions-container {
    padding: 24px;
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.action-item {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: var(--transition);
}

.action-item:hover {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.1);
}

.action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.bump-layout { background: rgba(59, 130, 246, 0.1); color: var(--color-blue); }
.bump-promo { background: rgba(124, 58, 237, 0.1); color: var(--accent-primary); }
.bump-vision { background: var(--color-red-glow); color: var(--color-red); }

.action-details {
    flex: 1;
}

.action-details h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.action-details p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.4;
}

.roi-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--color-green-glow);
    color: var(--color-green);
}

.roi-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.apply-btn {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.apply-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-urgent {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-red);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-urgent:hover {
    background: var(--color-red);
    color: white;
}

.spin {
    animation: spin 1s linear infinite;
}

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

.pulse-glow {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 var(--accent-glow); }
    70% { box-shadow: 0 0 0 10px rgba(124, 58, 237, 0); }
    100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

.d-lg-none { display: none; }

/* Responsive tweaks */
@media (max-width: 1024px) {
    .middle-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100vh;
    }
    .sidebar.active {
        left: 0;
    }
    .d-lg-none {
        display: flex;
    }
    .top-header {
        padding: 0 20px;
    }
    .dashboard-scroll {
        padding: 20px;
    }
    .search-bar { width: 40px; padding: 10px; border-color: transparent; background: transparent; }
    .search-bar input { display: none; }
}
