:root {
    --bg-main: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --border: #334155;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.5);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5);
    --radius-md: 8px;
    --radius-lg: 12px;
}

body.light-theme {
    --bg-main: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    transition: background 0.3s ease;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}
.logo-box {
    background: var(--accent);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.sidebar-header h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}
.nav-item:hover, .nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
}
.nav-divider { height: 1px; background: var(--border); margin: 16px 0; }

.api-status-card {
    background: var(--bg-main);
    padding: 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
}
.status-indicator { width: 10px; height: 10px; border-radius: 50%; }
.status-indicator.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-text p { font-size: 13px; font-weight: 600; }
.status-text span { font-size: 12px; color: var(--text-secondary); }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}
.topbar {
    height: 70px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}
.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-main);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    width: 300px;
}
.topbar-search input {
    background: transparent; border: none; outline: none; color: var(--text-primary); width: 100%;
}
.topbar-search i { color: var(--text-secondary); }

.topbar-actions { display: flex; align-items: center; gap: 16px; }
.theme-toggle {
    background: transparent; border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer;
}
.theme-toggle:hover { color: var(--text-primary); }
.user-profile img { width: 36px; height: 36px; border-radius: 50%; }

.dashboard-container {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}
.page-header h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.page-header p { color: var(--text-secondary); font-size: 14px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    padding: 10px 20px; border-radius: var(--radius-md); font-weight: 600; font-size: 14px;
    cursor: pointer; transition: all 0.2s; border: none; font-family: inherit;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }
.btn-secondary { background: var(--bg-main); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-icon { padding: 8px; background: transparent; color: var(--text-secondary); font-size: 18px; }
.btn-icon:hover { color: var(--text-primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Stats Grid */
.stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: rgba(59, 130, 246, 0.1); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.stat-info h3 { font-size: 13px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-info p { font-size: 24px; font-weight: 700; color: var(--text-primary); }

/* Content Grid */
.content-grid {
    display: grid; grid-template-columns: 350px 1fr; gap: 24px;
}

/* Cards */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; overflow: hidden;
}
.card-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.card-header h2 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 24px; flex: 1; position: relative; }
.card-body.p-0 { padding: 0; }

/* Forms */
.form-group-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select {
    width: 100%; padding: 10px 12px; border-radius: var(--radius-md);
    background: var(--bg-main); border: 1px solid var(--border);
    color: var(--text-primary); font-family: inherit; font-size: 14px; transition: border 0.2s;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.form-divider { height: 1px; background: var(--border); margin: 24px 0; }
h4 { color: var(--text-primary); font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
small.hint { display: block; font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* Table */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th {
    padding: 16px 20px; font-size: 12px; font-weight: 600; text-transform: uppercase;
    color: var(--text-secondary); border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.02);
}
.data-table td { padding: 16px 20px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover { background: rgba(255,255,255,0.02); }

.product-img { width: 40px; height: 40px; border-radius: 6px; object-fit: contain; background: white; border: 1px solid var(--border); }
.product-info { font-weight: 500; max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.product-asin { font-size: 12px; color: var(--text-secondary); font-family: monospace; display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.badge { padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }

.empty-state { text-align: center; }
.empty-content { padding: 60px 20px; color: var(--text-secondary); }
.empty-content i { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-content p { font-size: 16px; font-weight: 600; color: var(--text-primary); }

/* Loader */
.loader-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(30, 41, 59, 0.8); backdrop-filter: blur(4px);
    display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10;
}
.spinner {
    width: 40px; height: 40px; border: 3px solid rgba(59, 130, 246, 0.3);
    border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Light Theme Overrides Loader */
body.light-theme .loader-overlay { background: rgba(255, 255, 255, 0.8); }

@media (max-width: 1024px) {
    .content-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
}
