/* Supplier Storefront Management - Mobile Optimized */
:root {
    --primary: #0B4F6C;
    --primary-dark: #083b4f;
    --primary-light: #1a6b8a;
    --secondary: #10B981;
    --accent: #F59E0B;
    --danger: #EF4444;
    --warning: #F59E0B;
    --dark: #1F2937;
    --gray-800: #1F2937;
    --gray-700: #374151;
    --gray-600: #4B5563;
    --gray-500: #6B7280;
    --gray-400: #9CA3AF;
    --gray-300: #D1D5DB;
    --gray-200: #E5E7EB;
    --gray-100: #F3F4F6;
    --white: #FFFFFF;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-xl: 0 8px 24px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--gray-100);
    color: var(--dark);
    line-height: 1.5;
}

/* Dashboard Container */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    z-index: 100;
}

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

.sidebar-header h2 {
    color: var(--primary);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.sidebar-header p {
    color: var(--gray-500);
    font-size: 13px;
}

.sidebar-nav {
    padding: 16px 12px;
}

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

.nav-item:hover {
    background: var(--gray-100);
    color: var(--primary);
}

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

.nav-item i {
    width: 20px;
    font-size: 16px;
}

hr {
    margin: 16px 0;
    border: none;
    border-top: 1px solid var(--gray-200);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 24px;
    max-width: calc(100vw - 280px);
}

/* Content Header */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    background: var(--white);
    padding: 20px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.header-title h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.header-title p {
    color: var(--gray-500);
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

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

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-600);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

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

/* Dashboard Tabs */
.dashboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--white);
    padding: 12px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    scrollbar-width: none;
}

.dashboard-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 8px 16px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--gray-200);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Section Cards */
.section-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.section-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-card h3 i {
    color: var(--primary);
}

.section-card h4 {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 12px;
}

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

.card-header h3, .card-header h4 {
    margin-bottom: 0;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 79, 108, 0.1);
}

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

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

/* Image Upload */
.image-upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
    background: var(--gray-50);
}

.image-upload-area:hover {
    border-color: var(--primary);
    background: var(--gray-100);
}

.image-upload-area i {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 8px;
}

.image-upload-area p {
    color: var(--gray-700);
    margin-bottom: 4px;
}

.image-upload-area small {
    color: var(--gray-500);
    font-size: 11px;
}

.upload-preview {
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

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

/* Compression Note */
.compression-note {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--gray-500);
    font-style: italic;
}

/* Stats List */
.stats-list, .categories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-item, .category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}

.stat-item:hover, .category-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.stat-drag, .category-drag {
    color: var(--gray-400);
    cursor: move;
    font-size: 16px;
    flex-shrink: 0;
}

.stat-content, .category-content {
    flex: 1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stat-content input, .category-content input {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    min-width: 0;
    flex: 1;
}

.stat-value-input { 
    min-width: 80px;
    max-width: 100px;
}

.stat-label-input { 
    min-width: 100px;
    max-width: 150px;
}

.stat-sublabel-input { 
    min-width: 80px;
    max-width: 120px;
}

.category-name-input { 
    min-width: 150px;
    flex: 2;
}

.category-icon-select {
    padding: 8px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    min-width: 100px;
    background: white;
}

.stat-actions, .category-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Product Selection */
.product-selection-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
    max-height: 300px;
    overflow-y: auto;
}

.product-selection-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}

.product-selection-item:hover {
    border-color: var(--primary);
}

.product-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--gray-200);
    flex-shrink: 0;
}

.product-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s ease;
}

.modal-content.modal-lg {
    max-width: 800px;
}

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

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--danger);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    position: sticky;
    bottom: 0;
    background: white;
}

/* Search Box in Modal */
.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.search-box input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid var(--gray-300);
    border-radius: 30px;
    font-size: 14px;
}

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

/* Product Grid in Modal */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 16px;
    padding-right: 4px;
}

.product-grid::-webkit-scrollbar {
    width: 6px;
}

.product-grid::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 10px;
}

.product-grid::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 10px;
}

.product-grid::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

.product-select-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.product-select-card:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.product-select-card.selected {
    border-color: var(--primary);
    background: #EFF6FF;
}

.product-select-card img {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.product-select-info {
    flex: 1;
    min-width: 0;
}

.product-select-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-select-price {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
}

.product-select-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 14px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-xl);
    max-width: 400px;
    pointer-events: none;
}

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

.toast.success { 
    background: var(--secondary); 
}

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

.toast.info { 
    background: var(--primary); 
}

.toast.warning { 
    background: var(--accent); 
    color: var(--dark);
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Text Utilities */
.text-muted {
    color: var(--gray-500);
    font-size: 14px;
    padding: 20px;
    text-align: center;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

/* Responsive - Mobile First */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 240px;
        max-width: calc(100vw - 240px);
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 12px;
        gap: 4px;
    }
    
    .sidebar-nav .nav-item {
        white-space: nowrap;
        padding: 10px 16px;
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 16px;
    }
    
    .content-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stat-item, .category-item {
        flex-wrap: wrap;
    }
    
    .stat-content {
        width: 100%;
        order: 2;
    }
    
    .stat-actions {
        width: 100%;
        justify-content: flex-end;
        order: 3;
        margin-top: 8px;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .toast {
        left: 16px;
        right: 16px;
        max-width: none;
        text-align: center;
        bottom: 80px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 12px;
    }
    
    .section-card {
        padding: 16px;
    }
    
    .dashboard-tabs {
        padding: 8px 12px;
    }
    
    .tab-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .stat-content {
        flex-direction: column;
    }
    
    .stat-content input {
        width: 100% !important;
        max-width: none !important;
    }
    
    .category-content {
        flex-direction: column;
    }
    
    .category-name-input,
    .category-icon-select {
        width: 100% !important;
    }
    
    .product-select-card {
        flex-wrap: wrap;
    }
    
    .product-select-checkbox {
        position: absolute;
        right: 12px;
        top: 12px;
    }
    
    .product-select-card {
        position: relative;
        padding-right: 40px;
    }
    
    .header-title h1 {
        font-size: 20px;
    }
}

/* Tablet Specific */
@media (min-width: 769px) and (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-content {
        flex-wrap: wrap;
    }
    
    .stat-value-input {
        width: 80px;
    }
    
    .stat-label-input {
        width: 120px;
    }
    
    .stat-sublabel-input {
        width: 100px;
    }
}

/* Drag and Drop Visual Feedback */
.stat-item.dragging,
.category-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: var(--shadow-lg);
}

/* Empty States */
.empty-state-mini {
    text-align: center;
    padding: 30px 20px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px dashed var(--gray-300);
}

.empty-state-mini i {
    font-size: 32px;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.empty-state-mini p {
    color: var(--gray-500);
    font-size: 13px;
}

/* Color Picker Styles */
.color-picker-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker-group input[type="color"] {
    width: 50px;
    height: 40px;
    padding: 2px;
    cursor: pointer;
}

.color-picker-group input[type="text"] {
    flex: 1;
}

/* Icon Selector */
.icon-selector {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
}

.icon-option {
    aspect-ratio: 1;
    background: var(--gray-100);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.icon-option:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.icon-option.selected {
    background: var(--primary);
    color: white;
    border: 2px solid var(--accent);
}

/* Preview Card */
.preview-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid var(--primary);
    position: relative;
}

.preview-card::before {
    content: 'Preview';
    position: absolute;
    top: -10px;
    left: 20px;
    background: var(--primary);
    color: white;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.preview-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    color: white;
}

.preview-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.preview-content {
    flex: 1;
}

.preview-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
}

.preview-tagline {
    font-size: 13px;
    opacity: 0.9;
}

/* Stats Preview */
.stats-preview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.stat-preview-card {
    background: var(--gray-100);
    padding: 12px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-preview-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}

.stat-preview-label {
    font-size: 11px;
    color: var(--gray-500);
}

/* Product Tags */
.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.product-tag {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 30px;
    padding: 6px 14px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.product-tag i {
    color: var(--primary);
}

/* Progress Bar */
.upload-progress {
    width: 100%;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

/* Animation Keyframes */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.slide-down {
    animation: slideDown 0.3s ease;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}