/* ================================================
   PIXELMART — Pixel Design System
   One console for every channel.
   Palette: Black / White / Gray + Pixel Gold #d4af37
   Warnings: subtle red #c2564a. No other colors.
   Icons: lucide line icons only. Zero emoji.
   ================================================ */

/* ================================================
   CSS VARIABLES
   ================================================ */
:root {
    /* Brand / Gold */
    --gold: #d4af37;
    --gold-text: #b8932e;
    --gold-soft: #f3e9cc;
    --gold-tint: #fbf6e8;

    /* Core neutrals */
    --primary-color: #111111;
    --secondary-color: #333333;
    --accent-color: #666666;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f6f6f7;
    --bg-white: #ffffff;
    --bg-light: #fafafa;
    --bg-dark: #111111;

    /* Text Colors */
    --text-primary: #111111;
    --text-secondary: #5e5e63;
    --text-tertiary: #9a9aa0;
    --text-white: #ffffff;

    /* Border & Divider */
    --border-color: #ececee;
    --border-dark: #d8d8db;

    /* Status Colors — monochrome + gold + warning red only */
    --success-color: #1f7a4d;
    --success-light: #e3f3ea;
    --error-color: #c2564a;
    --error-light: #f7e6e4;
    --warning-color: #c2564a;
    --warning-light: #f7e6e4;
    --info-color: #5e5e63;
    --info-light: #f0f0f1;

    /* Platform accents — all neutral, gold for the hero/active state */
    --amazon-color: #b8932e;
    --flipkart-color: #5e5e63;
    --meesho-color: #5e5e63;
    --shopify-color: #5e5e63;
    --pixelbuy-color: #b8932e;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 50%;

    /* Shadows — soft */
    --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.04);
    --shadow-md: 0 2px 8px rgba(17, 17, 17, 0.06);
    --shadow-lg: 0 8px 24px rgba(17, 17, 17, 0.08);
    --shadow-xl: 0 18px 40px rgba(17, 17, 17, 0.12);
    --shadow-gold: 0 6px 20px rgba(212, 175, 55, 0.22);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Layout */
    --sidebar-width: 248px;
    --header-height: 68px;
}

/* ================================================
   RESET & BASE STYLES
   ================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

::selection {
    background: var(--gold-soft);
    color: var(--text-primary);
}

/* ================================================
   DASHBOARD LAYOUT
   ================================================ */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* ================================================
   SIDEBAR  (most pages use the injected ems-nav.js sidebar)
   ================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform var(--transition-normal);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo svg {
    width: 26px;
    height: 26px;
    color: var(--gold);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1.25rem;
}

.nav-section-title {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    padding: 0.5rem 1.5rem;
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

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

.nav-link.active {
    background: var(--gold-tint);
    color: var(--text-primary);
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gold);
}

/* ================================================
   MAIN CONTENT
   ================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ================================================
   HEADER
   ================================================ */
.header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
    stroke: var(--text-primary);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    padding: 0.55rem 1rem;
    border-radius: var(--radius-md);
    width: 320px;
    transition: all var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
}

.search-box svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-tertiary);
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    color: var(--text-primary);
}

.icon-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-dark);
}

.icon-btn svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--gold);
    color: #111;
    font-size: 0.625rem;
    font-weight: 800;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
    cursor: pointer;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #1a1a1a, #333);
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.875rem;
    border: 1px solid var(--gold-soft);
}

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

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.user-role {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* ================================================
   PAGE CONTENT
   ================================================ */
.page-content {
    flex: 1;
    padding: 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.page-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.page-actions {
    display: flex;
    gap: 0.75rem;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.15rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
}

.btn svg {
    width: 17px;
    height: 17px;
}

.btn-primary {
    background: var(--gold);
    color: #111;
    border-color: var(--gold);
}

.btn-primary:hover {
    background: #c8a233;
    box-shadow: var(--shadow-gold);
}

.btn-dark {
    background: #111;
    color: #fff;
    border-color: #111;
}

.btn-dark:hover {
    background: #000;
}

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

.btn-secondary:hover {
    background: var(--bg-light);
    border-color: var(--border-dark);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-dark);
}

.btn-outline:hover {
    background: var(--bg-light);
}

/* ================================================
   CARDS
   ================================================ */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ================================================
   STATS CARDS
   ================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

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

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.9rem;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gold-tint);
    color: var(--gold-text);
}

.stat-icon svg {
    width: 21px;
    height: 21px;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.15rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.stat-change.up {
    color: var(--success-color);
}

.stat-change.down {
    color: var(--error-color);
}

/* ================================================
   FORMS
   ================================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-soft);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ================================================
   TABLES
   ================================================ */
.table-container {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--bg-light);
}

.table th {
    text-align: left;
    padding: 0.85rem 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

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

.table tbody tr:hover {
    background: var(--gold-tint);
}

/* ================================================
   BADGES
   ================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid transparent;
}

.badge-success {
    background: var(--success-light);
    color: var(--success-color);
}

.badge-error {
    background: var(--error-light);
    color: var(--error-color);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning-color);
}

.badge-info {
    background: var(--info-light);
    color: var(--text-secondary);
}

.badge-gold {
    background: var(--gold-tint);
    color: var(--gold-text);
    border-color: var(--gold-soft);
}

/* Platform Badges — neutral chips with gold accent */
.badge-amazon,
.badge-flipkart,
.badge-meesho,
.badge-pixelbuy,
.badge-shopify {
    background: var(--bg-light);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.badge-amazon {
    background: var(--gold-tint);
    color: var(--gold-text);
    border-color: var(--gold-soft);
}

/* ================================================
   TOAST NOTIFICATIONS
   ================================================ */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition-normal);
    z-index: 9999;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid var(--gold);
}

.toast-error {
    border-left: 4px solid var(--error-color);
}

.toast-info {
    border-left: 4px solid var(--text-secondary);
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

    .menu-toggle {
        display: block;
    }

    .search-box {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .search-box {
        display: none;
    }

    .user-info {
        display: none;
    }

    .header {
        padding: 0 1rem;
    }
}
