/* ===========================
   MARKET INTELLIGENCE AI
   Dark Mode Professional CSS
   v5.0.3
   =========================== */

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

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #111827;
    --bg-card: #1a1f2e;
    --bg-card-hover: #1e2537;
    --bg-input: #0f1117;
    --border: #2d3748;
    --border-light: #374151;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --curve-a: #10b981;
    --curve-b: #f59e0b;
    --curve-c: #ef4444;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.6;
}

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: var(--transition);
}

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

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.logo-version {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: var(--transition);
}

.sidebar-close:hover { color: var(--text-primary); background: var(--bg-card); }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0 8px;
    display: block;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    transition: var(--transition);
    position: relative;
    margin-bottom: 2px;
}

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

.nav-item.active {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--border-light);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.nav-item.active .nav-badge {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent);
}

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

.sidebar-footer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 199;
    backdrop-filter: blur(2px);
}

/* ===========================
   MAIN WRAPPER
   =========================== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* ===========================
   TOP HEADER
   =========================== */
.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

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

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.hamburger:hover { color: var(--text-primary); background: var(--bg-card); }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

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

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

.header-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.header-badge i { font-size: 11px; animation: pulse 2s infinite; }

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

.header-time {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ===========================
   PAGES
   =========================== */
.page {
    display: none;
    flex: 1;
    padding: 28px 28px 40px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.page.active { display: block; }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

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

/* ===========================
   BUTTONS
   =========================== */
.btn-primary, .btn-secondary, .btn-danger, .btn-warning, .btn-success, .btn-ai {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
    color: white;
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4); }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-light); }

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.btn-warning:hover { background: rgba(245, 158, 11, 0.2); }

.btn-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.btn-success:hover { background: rgba(16, 185, 129, 0.2); }

.btn-ai {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color: white;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.3);
}
.btn-ai:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(139, 92, 246, 0.45); }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: var(--transition);
    color: var(--text-secondary);
}
.btn-icon:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-icon.btn-icon-danger:hover { color: var(--danger); }
.btn-icon.btn-icon-green { color: var(--accent); }
.btn-icon.btn-icon-green:hover { background: rgba(16,185,129,0.1); }

/* ===========================
   HEALTH CARD
   =========================== */
.health-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.health-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.health-chart-wrap {
    position: relative;
    width: 110px;
    height: 110px;
}

.health-score-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.health-score-center span {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.health-score-center small {
    font-size: 11px;
    color: var(--text-muted);
}

.health-info h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.health-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.health-right { flex: 1; }

.health-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.health-metric {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.health-metric i {
    font-size: 18px;
    color: var(--accent);
    width: 24px;
    text-align: center;
}

.health-metric div { display: flex; flex-direction: column; }
.health-metric strong { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.health-metric small { font-size: 11px; color: var(--text-muted); }

/* ===========================
   KPI CARDS
   =========================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.kpi-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.kpi-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.kpi-blue { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); }
.kpi-green { background: rgba(16, 185, 129, 0.12); color: var(--accent); }
.kpi-purple { background: rgba(139, 92, 246, 0.12); color: var(--accent-purple); }
.kpi-orange { background: rgba(245, 158, 11, 0.12); color: var(--warning); }

.kpi-info { display: flex; flex-direction: column; }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 20px; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.kpi-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ===========================
   CHARTS GRID
   =========================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.chart-card.chart-large {
    grid-column: span 2;
}

.chart-header {
    margin-bottom: 16px;
}

.chart-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-header h3 i { color: var(--accent); font-size: 12px; }

.chart-body {
    position: relative;
    height: 200px;
}

/* ===========================
   INSIGHTS
   =========================== */
.insights-section {
    margin-top: 8px;
}

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

.section-header h2 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header h2 i { color: var(--accent); }

.insights-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 20px;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
    border-left: 3px solid var(--accent);
}

.insight-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.insight-card.insight-warning { border-left-color: var(--warning); }
.insight-card.insight-danger { border-left-color: var(--danger); }
.insight-card.insight-info { border-left-color: var(--info); }

.insight-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.insight-icon {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent);
}

.insight-card.insight-warning .insight-icon { background: rgba(245,158,11,0.12); color: var(--warning); }
.insight-card.insight-danger .insight-icon { background: rgba(239,68,68,0.12); color: var(--danger); }
.insight-card.insight-info .insight-icon { background: rgba(6,182,212,0.12); color: var(--info); }

.insight-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.insight-text {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.insight-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent);
    margin-top: 8px;
}

.insight-card.insight-warning .insight-value { color: var(--warning); }
.insight-card.insight-danger .insight-value { color: var(--danger); }
.insight-card.insight-info .insight-value { color: var(--info); }

.insight-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

.insight-empty i { font-size: 40px; margin-bottom: 12px; display: block; opacity: 0.4; }

/* ===========================
   FILTERS BAR
   =========================== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-wrap {
    flex: 1;
    min-width: 220px;
    position: relative;
}

.search-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}

.search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    outline: none;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.filters-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 9px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

.filter-select:focus { border-color: var(--accent); }
.filter-select option { background: var(--bg-secondary); }

.products-info {
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 12.5px;
}

/* ===========================
   PRODUCTS GRID
   =========================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.product-card-header {
    padding: 16px 16px 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.product-title-wrap { flex: 1; min-width: 0; }

.product-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 3px;
}

.product-brand {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-badges {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-a { background: rgba(16, 185, 129, 0.15); color: var(--curve-a); border: 1px solid rgba(16,185,129,0.3); }
.badge-b { background: rgba(245, 158, 11, 0.15); color: var(--curve-b); border: 1px solid rgba(245,158,11,0.3); }
.badge-c { background: rgba(239, 68, 68, 0.15); color: var(--curve-c); border: 1px solid rgba(239,68,68,0.3); }

.score-badge {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
    border: 1px solid rgba(139,92,246,0.2);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.product-card-meta {
    padding: 0 16px 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-secondary);
}

.meta-item i { font-size: 11px; color: var(--text-muted); width: 12px; }

.product-card-prices {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.price-real {
    display: flex;
    flex-direction: column;
}

.price-real-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.price-real-value { font-size: 18px; font-weight: 800; color: var(--text-primary); }

.price-ai {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.price-ai-label {
    font-size: 10px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.price-ai-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
}

.product-card-footer {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.audience-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--info);
    border: 1px solid rgba(6,182,212,0.2);
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.product-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.products-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}

.products-empty i { font-size: 52px; margin-bottom: 16px; display: block; opacity: 0.3; }
.products-empty h3 { font-size: 16px; margin-bottom: 8px; color: var(--text-secondary); }
.products-empty p { margin-bottom: 20px; }

/* ===========================
   ABC PAGE
   =========================== */
.abc-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.abc-sum-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.abc-sum-a { border-left: 4px solid var(--curve-a); }
.abc-sum-b { border-left: 4px solid var(--curve-b); }
.abc-sum-c { border-left: 4px solid var(--curve-c); }

.abc-sum-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.abc-sum-a .abc-sum-icon { background: rgba(16,185,129,0.12); color: var(--curve-a); }
.abc-sum-b .abc-sum-icon { background: rgba(245,158,11,0.12); color: var(--curve-b); }
.abc-sum-c .abc-sum-icon { background: rgba(239,68,68,0.12); color: var(--curve-c); }

.abc-sum-card div strong { font-size: 20px; font-weight: 800; display: block; }
.abc-sum-card div small { font-size: 12px; color: var(--text-secondary); }

.abc-filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.abc-tab {
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}

.abc-tab.active { background: var(--bg-secondary); color: var(--text-primary); }
.abc-tab.tab-a.active { background: rgba(16,185,129,0.15); color: var(--curve-a); }
.abc-tab.tab-b.active { background: rgba(245,158,11,0.15); color: var(--curve-b); }
.abc-tab.tab-c.active { background: rgba(239,68,68,0.15); color: var(--curve-c); }

/* TABLE */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-responsive {
    overflow-x: auto;
}

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

.data-table thead tr {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.data-table th {
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(45, 55, 72, 0.5);
    vertical-align: middle;
}

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

.data-table tbody tr:hover td {
    background: rgba(255,255,255,0.02);
    color: var(--text-primary);
}

.table-product-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.table-product-brand {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.table-empty {
    text-align: center;
    padding: 48px !important;
    color: var(--text-muted);
}

.table-empty i { font-size: 32px; margin-bottom: 10px; display: block; opacity: 0.4; }

.table-price-ai {
    color: var(--accent);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.table-audience {
    color: var(--info);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===========================
   SETTINGS
   =========================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}

.alert i { margin-top: 1px; flex-shrink: 0; font-size: 15px; }
.alert strong { display: block; margin-bottom: 3px; font-weight: 600; }
.alert p { color: var(--text-secondary); margin: 0; }

.alert-warning { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); color: var(--warning); }
.alert-info { background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.2); color: var(--info); }

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.settings-card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
}

.settings-card-header i { color: var(--accent); font-size: 16px; }
.settings-card-header h3 { font-size: 14px; font-weight: 700; }

.settings-card-body { padding: 20px; }

.settings-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 10px;
}

.settings-input-group {
    display: flex;
    gap: 10px;
}

.settings-input {
    flex: 1;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition);
}

.settings-input:focus { border-color: var(--accent); }

.settings-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.data-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.data-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

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

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-actions button { justify-content: flex-start; }

.system-info-list { display: flex; flex-direction: column; gap: 0; }

.system-info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(45, 55, 72, 0.5);
    font-size: 13px;
}

.system-info-item:last-child { border-bottom: none; }
.system-info-item span { color: var(--text-muted); }
.system-info-item strong { color: var(--text-primary); font-weight: 600; }

.status-active {
    color: var(--accent) !important;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-active i { font-size: 8px; animation: pulse 1.5s infinite; }

/* ===========================
   MODAL
   =========================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay[style*="none"] { display: none !important; }

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-large { max-width: 820px; }
.modal-small { max-width: 420px; }

.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: var(--transition);
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-card); }

.modal-body {
    padding: 22px;
    overflow-y: auto;
    flex: 1;
}

/* AI EXTRACT SECTION */
.ai-extract-section {
    background: linear-gradient(135deg, rgba(139,92,246,0.06), rgba(6,182,212,0.06));
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.ai-extract-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.ai-extract-header i {
    font-size: 20px;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 2px;
}

.ai-extract-header strong { font-size: 14px; font-weight: 700; display: block; }
.ai-extract-header small { font-size: 12px; color: var(--text-muted); }

.ai-extract-input {
    display: flex;
    gap: 10px;
}

.ai-extract-input .form-input { flex: 1; }

/* AI RESULT */
.ai-result {
    background: rgba(16, 185, 129, 0.04);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.ai-result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}

.ai-result-header i { font-size: 16px; }

.ai-result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.ai-result-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.ai-result-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.ai-result-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-result-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

/* COMPETITORS */
.competitors-section {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.competitors-section h4 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
}

.competitors-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.competitor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.competitor-icon {
    width: 32px; height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--accent);
    flex-shrink: 0;
}

.competitor-info { flex: 1; min-width: 0; }
.competitor-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.competitor-price { font-size: 12px; color: var(--accent); font-weight: 700; }
.competitor-share { font-size: 11px; color: var(--text-muted); }

.competitor-link {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.competitor-link:hover { color: var(--accent); background: rgba(16,185,129,0.1); }

/* RECOMMENDATIONS */
.recommendations-section {
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.recommendations-section h4 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
}

.recommendations-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recommendation-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.rec-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rec-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.rec-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rec-item-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.rec-item-value {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* FORM */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.required { color: var(--danger); }

.form-input, .form-select {
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--transition);
}

.form-input:focus, .form-select:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-secondary); }

.field-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* CONFIRM MODAL */
.confirm-message {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow);
    pointer-events: all;
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast-exit {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to { transform: translateX(100%); opacity: 0; }
}

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

.toast-icon { font-size: 15px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--accent); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }

/* ===========================
   LOADING STATE
   =========================== */
.loading-spin {
    animation: spin 1s linear infinite;
}

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

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

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

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1100px) {
    .health-metrics { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-card.chart-large { grid-column: span 1; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .insights-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .ai-result-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-close { display: flex; }
    .sidebar-overlay.open { display: block; }

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

    .hamburger { display: flex; }
    .header-time { display: none; }

    .page {
        padding: 20px 16px 40px;
    }

    .page-title { font-size: 18px; }

    .health-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .health-metrics { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .products-grid { grid-template-columns: 1fr; }
    .abc-summary { grid-template-columns: 1fr; }
    .insights-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .competitors-grid { grid-template-columns: 1fr; }
    .rec-grid { grid-template-columns: 1fr; }
    .ai-result-grid { grid-template-columns: 1fr; }

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

    .header-actions { width: 100%; }
    .abc-filter-tabs { flex-wrap: wrap; }

    .modal-container { margin: 0; border-radius: var(--radius) var(--radius) 0 0; }
    .modal-overlay { padding: 0; align-items: flex-end; }

    .ai-extract-input { flex-direction: column; }

    .toast-container { left: 16px; right: 16px; bottom: 16px; }
    .toast { min-width: auto; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .health-metrics { grid-template-columns: 1fr; }
    .filters-right { width: 100%; }
    .filter-select { flex: 1; }
}
