/* ================================
   ManG Electronics Admin Dashboard
   Premium Dark Theme Styles
   ================================ */

:root {
    /* Colors */
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-hover: #2a2a2a;

    --accent-primary: #FF3B30;
    --accent-secondary: #FF6B5B;
    --accent-gradient: linear-gradient(135deg, #FF3B30, #FF6B5B);

    --text-primary: #ffffff;
    --text-secondary: #888888;
    --text-muted: #555555;

    --border-color: #2a2a2a;
    --border-light: #333333;

    --success: #34C759;
    --warning: #FF9500;
    --danger: #FF3B30;
    --info: #5AC8FA;

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

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

/* ================================
   Sidebar Styles
   ================================ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

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

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

.logo-icon {
    font-size: 28px;
}

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

.logo-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.logo-sub {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-primary);
    letter-spacing: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

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

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
}

.nav-item .material-icons-round {
    font-size: 20px;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ================================
   Main Content
   ================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 10px 16px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    width: 400px;
}

.search-container .material-icons-round {
    color: var(--text-secondary);
    font-size: 20px;
}

.search-container input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.search-container input::placeholder {
    color: var(--text-muted);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
}

/* ================================
   Page Content
   ================================ */

.page-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100%;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

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

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.blue {
    background: rgba(90, 200, 250, 0.15);
    color: var(--info);
}

.stat-icon.green {
    background: rgba(52, 199, 89, 0.15);
    color: var(--success);
}

.stat-icon.orange {
    background: rgba(255, 149, 0, 0.15);
    color: var(--warning);
}

.stat-icon.red {
    background: rgba(255, 59, 48, 0.15);
    color: var(--danger);
}

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

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
}

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

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

th,
td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

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

td {
    font-size: 14px;
}

tr:hover {
    background: var(--bg-hover);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.in-stock {
    background: rgba(52, 199, 89, 0.15);
    color: var(--success);
}

.status-badge.low-stock {
    background: rgba(255, 149, 0, 0.15);
    color: var(--warning);
}

.status-badge.out-of-stock {
    background: rgba(255, 59, 48, 0.15);
    color: var(--danger);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

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

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-accent {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

.btn-accent:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-accent:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--border-light);
}

.btn-icon.danger:hover {
    background: rgba(255, 59, 48, 0.15);
    color: var(--danger);
    border-color: var(--danger);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.2s ease;
}

.product-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.product-image {
    height: 180px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-image .placeholder {
    font-size: 48px;
    color: var(--text-muted);
}

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--accent-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.product-info {
    padding: 16px;
}

.product-category {
    font-size: 11px;
    color: var(--accent-primary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 12px;
}

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

.product-stock {
    font-size: 12px;
    color: var(--text-secondary);
}

.product-actions {
    display: flex;
    gap: 8px;
}

/* Filters */
.filters-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.filter-group select,
.filter-group input {
    padding: 10px 16px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 200px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.category-card:hover {
    border-color: var(--accent-primary);
}

.category-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.category-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.category-count {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal.modal-small {
    max-width: 400px;
}

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

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

.modal form {
    padding: 24px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row.checkboxes {
    display: flex;
    gap: 24px;
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Variant Toggle Rows */
.variant-toggle-row {
    margin-bottom: 8px;
}

.variant-toggle-row .checkbox-label {
    margin-bottom: 4px;
}

.variant-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 4px;
    transition: border-color 0.2s ease;
}

.variant-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.variant-input::placeholder {
    color: var(--text-muted);
    font-size: 12px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
}

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

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--danger);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info .toast-icon {
    color: #3b82f6;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Section Count Badge */
.section-count {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-hover);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Horizontal Products Scroll */
.horizontal-products-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 8px 4px 16px 4px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.horizontal-products-scroll::-webkit-scrollbar {
    height: 6px;
}

.horizontal-products-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.horizontal-products-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.horizontal-products-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Mini Product Card for horizontal scroll */
.mini-product-card {
    flex: 0 0 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
}

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

.mini-product-card .product-image {
    height: 120px;
    background: var(--bg-primary);
}

.mini-product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-product-card .product-info {
    padding: 12px;
}

.mini-product-card .product-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-product-card .product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0;
}

.mini-product-card .product-category {
    font-size: 10px;
    margin-bottom: 2px;
}

.mini-product-card .product-badge {
    font-size: 9px;
    padding: 2px 6px;
}

/* Trending badge variant */
.mini-product-card.trending .product-badge {
    background: linear-gradient(135deg, #FF9500, #FF6B00);
}

/* New Arrival badge variant */
.mini-product-card.new-arrival .product-badge {
    background: linear-gradient(135deg, #34C759, #30B94D);
}

/* Empty section state */
.section-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    color: var(--text-muted);
    font-size: 14px;
    width: 100%;
}

/* Responsive */
/* Consolidated responsive styles moved to the end of file */

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.post-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.post-card:hover {
    transform: translateY(-4px);
}

.post-image-container {
    height: 200px;
    width: 100%;
    overflow: hidden;
}

.post-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-content {
    padding: 16px;
}

.post-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.post-caption {
    font-size: 14px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.post-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.post-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-icon-red {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-icon-red:hover {
    background: #ef4444;
    color: white;
}

/* Image Upload Zone styles for Posts */
#postImageUploadZone {
    height: 150px;
    min-height: 120px;
}

#postPreviewImage {
    max-height: 130px;
}

/* ================================
   Image Upload Zone (R2 Storage)
   ================================ */

.image-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--bg-card);
}

.image-upload-zone:hover {
    border-color: var(--accent-primary);
    background: rgba(255, 59, 48, 0.05);
}

.image-upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(255, 59, 48, 0.1);
    transform: scale(1.01);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    font-size: 48px;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.image-upload-zone:hover .upload-icon {
    color: var(--accent-primary);
}

.upload-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

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

.upload-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
}

.upload-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
}

.btn-remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 59, 48, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.btn-remove-image:hover {
    background: var(--danger);
    transform: scale(1.1);
}

.upload-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px;
}

.progress-bar {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Upload zone in dark mode adjustments */
.image-upload-zone input[type="file"] {
    display: none;
}

/* R2 Storage indicator */
.r2-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.r2-indicator::before {
    content: "☁️";
}

/* ================================
   Banner Management Styles
   ================================ */

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

.banner-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.banner-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.banner-card .banner-image {
    height: 160px;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-card));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

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

.banner-card:hover .banner-image img {
    transform: scale(1.05);
}

.banner-card .banner-promo-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--accent-gradient);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
}

.banner-card .banner-type-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.banner-card .banner-type-badge.primary {
    background: linear-gradient(135deg, #FF9500, #FF6B00);
}

.banner-card .banner-type-badge.secondary {
    background: linear-gradient(135deg, #34C759, #30B94D);
}

.banner-card .banner-content {
    padding: 16px;
}

.banner-card .banner-product-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.banner-card .banner-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.banner-card .banner-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent-primary);
    margin-bottom: 12px;
}

.banner-card .banner-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-bottom: 12px;
}

.banner-card .banner-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.banner-card .banner-status .status-dot.inactive {
    background: var(--text-muted);
}

.banner-card .banner-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.banner-card .banner-actions .btn-icon {
    flex: 1;
}

/* Banner Product Preview in Modal */
.banner-product-preview {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.banner-product-preview .preview-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--accent-primary);
    border-radius: var(--border-radius);
    padding: 12px;
}

.banner-product-preview .preview-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    background: var(--bg-secondary);
}

.banner-product-preview .preview-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.banner-product-preview .preview-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.banner-product-preview .preview-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
}

/* Category Card with Actions */
.category-card {
    position: relative;
    cursor: pointer;
}

.category-card .category-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.category-card:hover .category-actions {
    opacity: 1;
}

.category-card .category-actions .btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 16px;
}

.category-card .category-status {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
}

.category-card .category-status.inactive {
    background: var(--text-muted);
}

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

.banners-empty .material-icons-round {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.banners-empty p {
    font-size: 14px;
    margin-bottom: 16px;
}

/* Banner Upload Zone specific */
#bannerImageUploadZone {
    min-height: 120px;
}

#bannerCustomPreviewImage {
    max-height: 100px;
}

/* ================================
   Settings Page Styles
   ================================ */

/* Toggle Group for Environment Selection */
.toggle-group {
    display: flex;
    gap: 8px;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.toggle-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-btn.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.3);
}

.toggle-btn.active:hover {
    transform: translateY(-1px);
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border-radius: 20px;
    font-size: 12px;
}

.status-indicator .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.status-indicator.configured .status-dot {
    background: var(--success);
}

.status-indicator.not-configured .status-dot {
    background: var(--warning);
    animation: none;
}

.status-indicator.disabled .status-dot {
    background: var(--text-muted);
    animation: none;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Password Visibility Toggle */
.form-group {
    position: relative;
}

.btn-show-password {
    position: absolute;
    right: 12px;
    top: 36px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-show-password:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.btn-show-password .material-icons-round {
    font-size: 20px;
}

/* Help Steps */
.help-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.help-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--accent-primary);
    transition: all 0.2s ease;
}

.help-step:hover {
    background: rgba(255, 59, 48, 0.05);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent-gradient);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.step-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Accent Button */
.btn-accent {
    background: linear-gradient(135deg, #FF9500, #FF6B00);
    color: white;
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
}

/* Section Count Badge */
.section-count {
    background: var(--bg-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Order Status Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-green {
    background: rgba(52, 199, 89, 0.2);
    color: #34C759;
}

.badge-orange {
    background: rgba(255, 149, 0, 0.2);
    color: #FF9500;
}

.badge-blue {
    background: rgba(90, 200, 250, 0.2);
    color: #5AC8FA;
}

.badge-purple {
    background: rgba(175, 82, 222, 0.2);
    color: #AF52DE;
}

.badge-red {
    background: rgba(255, 59, 48, 0.2);
    color: #FF3B30;
}

.badge-gray {
    background: rgba(142, 142, 147, 0.2);
    color: #8E8E93;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--accent-primary);
    color: white;
}

.btn-icon .material-icons-round {
    font-size: 18px;
}

/* Customer Info in Table */
.customer-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.customer-phone {
    font-weight: 500;
}

/* Empty State in Table */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state .material-icons-round {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
    max-width: 300px;
}

/* Empty row in table */
.empty-row td {
    padding: 0 !important;
}

/* ================================
   Mobile Hamburger Button
   ================================ */

.mobile-menu-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 200;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 59, 48, 0.4);
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-menu-btn:active {
    transform: scale(0.92);
}

.mobile-menu-btn .material-icons-round {
    font-size: 26px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

/* ================================
   Mobile Responsive (< 768px)
   ================================ */

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        width: 85vw;
        max-width: 280px;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

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

    .main-content {
        margin-left: 0;
        min-width: 100%;
    }

    .top-bar {
        padding: 0 16px;
        height: 60px;
    }

    .search-container {
        display: none; /* Hide global search on mobile to save space */
    }

    .user-profile {
        display: none;
    }

    .page-content {
        padding: 12px;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
        padding-bottom: 16px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
        gap: 8px;
    }

    .stat-icon {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    .stat-value {
        font-size: 16px;
    }

    /* Products Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-image {
        height: 120px;
    }

    .product-info {
        padding: 8px;
    }

    .product-name {
        font-size: 12px;
    }

    /* Modals */
    .modal {
        max-width: 92vw;
        max-height: 85vh;
        margin: auto;
    }

    .modal form {
        padding: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

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

    .modal-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Tables - Make them scrollable */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }

    table {
        min-width: 600px;
    }
}

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

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

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

/* ================================
   Authentication Overlay Styles
   ================================ */

#authOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    margin: auto;
}

.auth-card {
    padding: 40px;
    background: #111;
    border: 1px solid #222;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-radius: 16px;
    margin-bottom: 16px;
    font-size: 28px;
}

.auth-title {
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    font-family: 'Inter', sans-serif;
}

.auth-subtitle {
    color: #6b7280;
    font-size: 13px;
    margin-top: 4px;
    font-family: 'Inter', sans-serif;
}

.auth-form-title {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
    font-family: 'Inter', sans-serif;
}

.auth-input-group {
    margin-bottom: 16px;
    text-align: left;
}

.auth-label {
    display: block;
    color: #9ca3af;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
    font-family: 'Inter', sans-serif;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    background: #141414;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
}

.auth-input:focus {
    border-color: #f59e0b;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    border-radius: 12px;
    color: #000;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    font-family: 'Inter', sans-serif;
}

.auth-btn:active {
    transform: scale(0.98);
}

.auth-error {
    color: #ef4444;
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
    display: none;
    font-family: 'Inter', sans-serif;
}

.auth-setup-info {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: left;
}

.auth-setup-title {
    color: #f59e0b;
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 4px;
    font-family: 'Inter', sans-serif;
}

.auth-setup-text {
    color: #9ca3af;
    font-size: 12px;
    margin: 0;
    line-height: 1.5;
    font-family: 'Inter', sans-serif;
}

.auth-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #2a2a2a;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 24px 16px;
        background: transparent;
        border: none;
        box-shadow: none;
    }
    
    #authOverlay {
        padding: 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .auth-title {
        font-size: 20px;
    }
}