:root {
    --bg-color: #0f172a;               /* Dark tailwind slate */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;                 /* Brilliant Blue */
    --accent-hover: #2563eb;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --glass-bg: rgba(30, 41, 59, 0.7); /* Translucent slate */
    --glass-border: rgba(255, 255, 255, 0.1);
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden; /* Stop whole page scroll, control inner scroll */
    min-height: 100vh;
}

/* ---------------------------------
   Animated Background
--------------------------------- */
.background-anim {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.6;
    animation: float 20s infinite alternate;
}

.blob1 {
    width: 400px;
    height: 400px;
    background: #4338ca;
    top: -100px;
    left: 10%;
    animation-delay: 0s;
}

.blob2 {
    width: 500px;
    height: 500px;
    background: #0ea5e9;
    bottom: -150px;
    right: 5%;
    animation-delay: -5s;
}

.blob3 {
    width: 300px;
    height: 300px;
    background: #8b5cf6;
    top: 30%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, -50px) scale(1.1); }
    100% { transform: translate(-30px, 80px) scale(0.9); }
}

/* ---------------------------------
   Glassmorphism Globals
--------------------------------- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none !important;
}

/* ---------------------------------
   Layout Structure
--------------------------------- */
.dashboard-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    z-index: 10;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
}

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

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1.5rem 0 0.5rem 0.75rem;
}

.nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.nav-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
}

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

.topbar {
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    z-index: 5;
}

.topbar h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* API Status Indicator */
.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.2);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-muted);
}
.status-indicator.ok { background-color: #10b981; box-shadow: 0 0 8px #10b981; }
.status-indicator.error { background-color: var(--accent-danger); box-shadow: 0 0 8px var(--accent-danger); }
.status-indicator.loading { 
    background-color: var(--accent-warning); 
    animation: pulse 1s infinite alternate; 
}

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

/* Views */
.content-wrapper {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    position: relative;
}

.view-section {
    animation: fadeIn 0.4s ease-out;
}

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

/* Grid Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.stat-card.interactive {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card.interactive:hover {
    transform: translateY(-4px);
    background: rgba(255,255,255,0.1);
    box-shadow: 0 12px 24px rgba(0,0,0,0.4);
}

.card-icon {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.stat-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.stat-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Controls & Inputs */
.controls {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

input, select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: white;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0,0,0,0.4);
}

select option {
    background-color: var(--bg-color);
    color: var(--text-main);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn.primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}

/* Charts */
.chart-container {
    padding: 1.5rem;
    border-radius: 12px;
    min-height: 400px;
    position: relative;
}

/* Tables */
.table-container {
    border-radius: 12px;
    overflow: hidden; /* Hide border collapse weirdness */
}

.scrollable {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

th {
    background: rgba(0,0,0,0.3);
    font-weight: 600;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 2;
}

tbody tr:hover {
    background: rgba(255,255,255,0.05);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.critical { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.5); }
.status-badge.low { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.5); }
.status-badge.healthy { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.5); }
.status-badge.no_sales { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.5); }

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    padding: 2rem;
    border-radius: 16px;
    width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-content h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}
