/* Global Vars */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 240px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    min-height: 100vh;
    color: var(--gray-700);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    padding: 24px 0;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
}

.sidebar-logo {
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 24px;
}

.sidebar-logo h1 {
    color: white;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidebar-logo a {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 24px 8px;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 24px;
    margin-bottom: 16px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nav-item .nav-icon {
    width: 24px;
    height: 24px;
    margin-right: 0;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: none;
    /* Remove previous bg if any or rely on text emoji */
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.breadcrumb {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

/* Card */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    padding: 0 24px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.tab {
    padding: 16px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}


/* Status Tabs */
.status-tabs {
    display: flex;
    gap: 8px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
}

.status-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--gray-100);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.status-tab:hover {
    background: var(--gray-200);
}

.status-tab.active {
    background: var(--primary);
    color: white;
}

.status-tab .count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 6px;
}

.status-tab.active .count {
    background: rgba(255, 255, 255, 0.2);
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    gap: 12px;
    flex: 1;
    flex-wrap: wrap;
}

.search-input {
    position: relative;
    flex: 0 0 280px;
}

.search-input input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: var(--gray-50);
}

.search-input input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-input .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    padding: 10px 40px 10px 16px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    background: var(--gray-50);
    cursor: pointer;
    appearance: none;
    min-width: 140px;
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.select-wrapper::after {
    content: "▼";
    font-size: 10px;
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.dropdown-btn {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 10;
    overflow: hidden;
    margin-top: 4px;
}

.dropdown-btn:hover .dropdown-content {
    display: block;
}

.dropdown-item {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: var(--gray-50);
    color: var(--primary);
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
}

th,
td {
    text-align: left;
    padding: 16px 20px;
    font-size: 14px;
}

th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

th:first-child {
    padding-left: 24px;
}

td:first-child {
    padding-left: 24px;
}

tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: var(--gray-50);
}

.checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
    transition: all 0.15s ease;
}

.checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox:checked::after {
    content: "✓";
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Common Components */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #059669;
}

.badge-warning {
    background: #fef3c7;
    color: #d97706;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-primary {
    background: #e0e7ff;
    color: var(--primary);
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.action-btn-edit {
    background: var(--gray-100);
    color: var(--gray-700);
}

.action-btn-edit:hover {
    background: var(--primary);
    color: white;
}

.action-btn-delete {
    background: transparent;
    color: var(--gray-400);
}

.action-btn-delete:hover {
    background: #fee2e2;
    color: var(--danger);
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-top: 1px solid var(--gray-100);
}

.pagination-info {
    font-size: 14px;
    color: var(--gray-500);
}

.pagination-info strong {
    color: var(--gray-800);
}

.pagination {
    display: flex;
    gap: 4px;
}

.page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: white;
    color: var(--gray-700);
}

.page-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Stats Cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 20px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.purple {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.stat-icon.green {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.stat-icon.red {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

.stat-icon.blue {
    background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Product Representation */
.product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-image {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.product-info {
    min-width: 0;
}

.product-name {
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.product-sku {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

/* Channel Tags */
.channel-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.channel-tag {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.channel-tag.prize {
    background: #fce7f3;
    color: #db2777;
}

.channel-tag.points {
    background: #dbeafe;
    color: #2563eb;
}

.channel-tag.only-stock {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* Stock Indicator */
.stock-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stock-bar {
    width: 60px;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.stock-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.stock-bar-fill.high {
    background: linear-gradient(90deg, var(--success), #34d399);
}

.stock-bar-fill.medium {
    background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.stock-bar-fill.low {
    background: linear-gradient(90deg, var(--danger), #f87171);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active,
.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    padding: 32px;
    border-radius: 16px;
    width: 600px;
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--gray-100);
    padding-bottom: 16px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
}

/* Basic Form Styles */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.form-control,
.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.form-control:focus,
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}


/* Responsive utility */
@media (max-width: 1280px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }
}

/* Tooltips */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: var(--gray-800);
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}