/* ========== Root Variables ========== */
:root {
    --primary: #ee4d2d;
    --primary-hover: #d9421f;
    --primary-light: #fff3f0;
    --accent-green: #059669;
    --accent-blue: #0284c7;
    --accent-purple: #6366f1;
    --bg-color: #f0f2f5;
    --text-color: #1a1a2e;
    --text-muted: #6b7280;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --sidebar-bg: #fafbfc;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c4c8cf; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #a0a5af; }

/* ========== Upload Overlay ========== */
.upload-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    z-index: 1000;
    animation: fadeInOverlay 0.5s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.upload-container {
    text-align: center;
    max-width: 520px;
    padding: 48px 40px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.1);
    animation: slideUp 0.6s ease;
}

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

.upload-icon-wrap {
    position: relative;
    display: inline-flex;
    margin-bottom: 20px;
}

.upload-icon-bg {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    filter: blur(25px);
    opacity: 0.4;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.6; }
}

.upload-icon {
    font-size: 56px;
    position: relative;
    z-index: 1;
}

.upload-title {
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.upload-title span {
    background: linear-gradient(90deg, var(--primary), #ff6b35);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.upload-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    line-height: 1.6;
    margin-bottom: 32px;
}

.upload-dropzone {
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255,255,255,0.03);
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--primary);
    background: rgba(238, 77, 45, 0.08);
    transform: scale(1.02);
}

.dropzone-icon { font-size: 36px; margin-bottom: 12px; }
.dropzone-text { color: rgba(255,255,255,0.8); font-weight: 600; font-size: 15px; }
.dropzone-hint { color: rgba(255,255,255,0.35); font-size: 13px; margin: 8px 0 12px; }

.btn-upload-file {
    display: inline-block;
    padding: 10px 28px;
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    color: #fff;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-upload-file:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(238, 77, 45, 0.35);
}

.upload-footer {
    margin-top: 20px;
    font-size: 12px;
    color: rgba(255,255,255,0.3);
}

/* ========== Dashboard Layout ========== */
.dashboard-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ========== Sidebar ========== */
.sidebar {
    width: 290px;
    min-width: 290px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.sidebar.collapsed {
    margin-left: -290px;
}

.logo-area {
    padding: 22px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #fff3f0, #fff);
}

.logo-emoji { font-size: 30px; }

.logo-area h1 {
    font-size: 17px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1.2;
    letter-spacing: -0.3px;
}

.filters-container {
    padding: 16px 18px;
    flex: 1;
    overflow-y: auto;
}

.filter-group { margin-bottom: 16px; }

.filter-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.filter-select, .filter-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
    background-color: #fff;
    transition: var(--transition);
    color: var(--text-color);
    appearance: auto;
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(238, 77, 45, 0.1);
}

.filter-row {
    display: flex;
    gap: 8px;
}

.btn-reset {
    width: 100%;
    padding: 11px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
    font-family: 'Inter', sans-serif;
}
.btn-reset:hover { background: #e2e8f0; color: #1e293b; }

.btn-new-upload {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
    font-family: 'Inter', sans-serif;
}
.btn-new-upload:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(238, 77, 45, 0.3);
}

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

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

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

.btn-toggle-sidebar {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}
.btn-toggle-sidebar:hover { background: #f1f5f9; color: var(--text-color); }

.header h2 {
    font-size: 18px;
    font-weight: 800;
    white-space: nowrap;
}

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

.stats-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

.btn-export {
    padding: 7px 14px;
    background: var(--accent-green);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}
.btn-export:hover {
    background: #047857;
    transform: translateY(-1px);
}

/* ========== Summary Section ========== */
.summary-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding: 24px 28px 0;
    flex-shrink: 0;
}

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

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

.sc-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sc-total .sc-icon { background: #ede9fe; }
.sc-sold .sc-icon { background: #fef3c7; }
.sc-commission .sc-icon { background: #dcfce7; }
.sc-price .sc-icon { background: #fff3f0; }
.sc-rating .sc-icon { background: #fef9c3; }
.sc-omzet .sc-icon { background: #e0f2fe; }

.sc-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sc-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

/* ========== Charts Section ========== */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    padding: 16px 28px;
    flex-shrink: 0;
}

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

.chart-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 14px;
}

.chart-canvas {
    min-height: 120px;
}

/* Chart Bar */
.chart-bar-wrap { margin-bottom: 10px; }

.chart-bar-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-color);
}

.chart-bar-label .count {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 11px;
}

.chart-bar-track {
    width: 100%;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-green { background: linear-gradient(90deg, #34d399, #059669); }
.bar-yellow { background: linear-gradient(90deg, #fbbf24, #d97706); }
.bar-red { background: linear-gradient(90deg, #f87171, #dc2626); }
.bar-blue { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.bar-purple { background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.bar-orange { background: linear-gradient(90deg, #fb923c, #ea580c); }
.bar-teal { background: linear-gradient(90deg, #2dd4bf, #0d9488); }

/* Top commission list */
.commission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 12px;
}

.commission-item:last-child { border-bottom: none; }

.commission-rank {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.commission-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: var(--text-color);
}

.commission-pct {
    font-weight: 800;
    color: var(--accent-green);
    white-space: nowrap;
}

/* ========== Content Area / Product Grid ========== */
.content-area {
    flex: 1;
    padding: 16px 28px 28px;
    overflow-y: auto;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 20px;
}

/* ========== Product Card ========== */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: #ffc9bd;
}

.card-image-wrapper {
    position: relative;
    height: 180px;
    background: #f8f9fa;
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .card-image {
    transform: scale(1.06);
}

.card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #FFD700, #FDB931);
    color: #7a5600;
    padding: 3px 9px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 2;
}

.card-badge.badge-none { display: none; }

.card-discount-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc2626;
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 10px;
    z-index: 2;
}

.card-video-indicator {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.card-body {
    padding: 14px 16px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 8px 0;
    color: var(--text-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 37px;
}

.price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.price {
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
}

.price-original {
    font-size: 11px;
    color: #9ca3af;
    text-decoration: line-through;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 10px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.metric-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
}

.metric-value {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-color);
}

.metric-value.highlight { color: var(--accent-green); }
.metric-value.text-orange { color: #ea580c; }
.metric-value.text-blue { color: var(--accent-blue); }
.metric-value.text-green { color: #16a34a; }
.metric-value.text-primary { color: var(--primary); }

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.tag {
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 4px;
    font-weight: 700;
    white-space: nowrap;
}

.tag.trend-high { background: #dcfce7; color: #166534; }
.tag.trend-mid { background: #fef9c3; color: #854d0e; }
.tag.trend-low { background: #fee2e2; color: #991b1b; }
.tag.comp-low { border: 1px solid #166534; color: #166534; }
.tag.comp-mid { border: 1px solid #854d0e; color: #854d0e; }
.tag.comp-high { border: 1px solid #991b1b; color: #991b1b; }
.tag.tag-ongkir { background: #dbeafe; color: #1d4ed8; }
.tag.tag-cod { background: #f0fdf4; color: #15803d; }
.tag.tag-affiliate { background: #ede9fe; color: #6d28d9; }

.card-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.btn-action {
    padding: 9px 8px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-shopee {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-shopee:hover { background: var(--primary-light); }

.btn-affiliate {
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    color: #fff;
}
.btn-affiliate:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(238, 77, 45, 0.3);
}

.btn-toko {
    background: #f1f5f9;
    color: #475569;
}
.btn-toko:hover { background: #e2e8f0; color: #1e293b; }

/* ========== Empty State ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.empty-state span { font-size: 52px; margin-bottom: 12px; }

.empty-state h3 {
    font-size: 16px;
    color: var(--text-color);
    font-weight: 700;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        box-shadow: var(--shadow-xl);
    }

    .sidebar.collapsed {
        margin-left: -290px;
    }

    .summary-section {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        padding: 16px 16px 0;
        gap: 10px;
    }

    .charts-section {
        grid-template-columns: 1fr;
        padding: 12px 16px;
    }

    .content-area {
        padding: 12px 16px 20px;
    }

    .grid-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .header {
        padding: 12px 16px;
    }
}

/* ========== Animations ========== */
@keyframes fadeInCard {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-card {
    animation: fadeInCard 0.4s ease forwards;
}

.product-card:nth-child(2) { animation-delay: 0.05s; }
.product-card:nth-child(3) { animation-delay: 0.1s; }
.product-card:nth-child(4) { animation-delay: 0.15s; }
.product-card:nth-child(5) { animation-delay: 0.2s; }
.product-card:nth-child(6) { animation-delay: 0.25s; }

/* Fade overlay transition */
.upload-overlay.fade-out {
    animation: fadeOutOverlay 0.4s ease forwards;
}

@keyframes fadeOutOverlay {
    to { opacity: 0; pointer-events: none; }
}
