/* Supplier Products Management - Mobile Optimized */
:root {
    --primary: #0B4F6C;
    --primary-dark: #083b4f;
    --primary-light: #1a6b8a;
    --secondary: #10B981;
    --accent: #F59E0B;
    --danger: #EF4444;
    --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-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-100);
}

.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);
}

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

.stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s;
}

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

.stat-info h3 {
    font-size: 14px;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 24px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    position: relative;
    min-width: 250px;
}

.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);
}

.filter-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: none;
}

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

.filter-btn {
    padding: 8px 16px;
    background: var(--white);
    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;
}

.filter-btn:hover {
    background: var(--gray-100);
}

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

.filter-btn-icon {
    width: 46px;
    height: 46px;
    border: 1px solid var(--gray-300);
    border-radius: 50%;
    background: var(--white);
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Filter Panel */
.filter-panel {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease;
}

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

.filter-section {
    margin-bottom: 20px;
}

.filter-section h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--dark);
}

.filter-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

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

.filter-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.price-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.price-range input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.price-range span {
    color: var(--gray-500);
}

.filter-section select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--white);
}

.filter-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.btn-apply, .btn-reset {
    flex: 1;
    padding: 12px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

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

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

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

.btn-reset:hover {
    background: var(--gray-100);
}

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

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

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

.product-card.draft {
    opacity: 0.8;
    border-left: 4px solid var(--gray-400);
}

.product-card.low-stock {
    border-left: 4px solid var(--danger);
}

.product-image {
    height: 160px;
    background: var(--gray-100);
    overflow: hidden;
    position: relative;
}

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

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

.product-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    z-index: 2;
}

.product-badge.draft {
    background: var(--gray-200);
    color: var(--gray-700);
}

.product-badge.low-stock {
    background: var(--danger);
    color: white;
}

.product-info {
    padding: 16px;
}

.product-category {
    display: inline-block;
    padding: 4px 10px;
    background: var(--gray-100);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 10px;
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.product-price small {
    font-size: 12px;
    font-weight: 400;
    color: var(--gray-500);
}

.product-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.product-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-stock {
    font-size: 13px;
    font-weight: 500;
}

.product-stock.in-stock {
    color: var(--secondary);
}

.product-stock.low-stock {
    color: var(--danger);
}

.product-stock.out-of-stock {
    color: var(--gray-500);
}

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

.product-views {
    font-size: 12px;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

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

/* Loading State */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.empty-state i {
    font-size: 48px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* Load More */
.load-more {
    text-align: center;
    margin-top: 20px;
}

.load-more-btn {
    padding: 12px 24px;
    background: var(--white);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* 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: 20px;
}

.modal.show {
    display: flex;
}

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

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

@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);
    padding: 4px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.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;
    gap: 12px;
    justify-content: flex-end;
    position: sticky;
    bottom: 0;
    background: white;
}

/* Form Sections */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.form-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section h4 i {
    color: var(--primary);
}

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

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

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

.form-group .required {
    color: var(--danger);
}

.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;
    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;
}

.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;
    background: var(--gray-50);
    margin-bottom: 16px;
}

.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;
}

.image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

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

.image-item .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

.image-item .remove-image:hover {
    background: var(--danger);
}

/* Bulk Pricing Tiers */
.bulk-tier-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
}

.bulk-tier-fields {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
}

.bulk-tier-fields input {
    padding: 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.remove-tier {
    flex-shrink: 0;
}

.text-muted {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Checkbox */
.form-check {
    margin: 12px 0;
}

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

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* View Product Modal */
.view-product-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.view-product-image {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

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

.view-product-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    margin: 16px 0;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
}

.meta-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.view-product-description {
    line-height: 1.8;
    color: var(--gray-700);
    margin: 20px 0;
    white-space: pre-line;
}

.bulk-tiers-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

.bulk-tiers-table th {
    text-align: left;
    padding: 10px;
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
}

.bulk-tiers-table td {
    padding: 10px;
    border-bottom: 1px solid var(--gray-200);
}

/* Delete Modal */
.delete-icon {
    text-align: center;
    margin-bottom: 20px;
}

.delete-icon i {
    font-size: 48px;
    color: var(--danger);
}

.delete-message {
    text-align: center;
    font-size: 16px;
    margin-bottom: 8px;
}

.delete-warning {
    text-align: center;
    font-size: 13px;
    color: var(--danger);
    margin-bottom: 20px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 14px 24px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 3000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}

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

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

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

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

/* Responsive */
@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;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        width: 100%;
    }
    
    .filter-tabs {
        width: 100%;
    }
    
    .filter-btn {
        flex: 1;
        text-align: center;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        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;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }
    
    .filter-options {
        grid-template-columns: 1fr;
    }
    
    .bulk-tier-fields {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .bulk-tier-item {
        flex-direction: column;
    }
    
    .remove-tier {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .product-actions {
        opacity: 1;
    }
    
    .view-product-meta {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}