/* Product Configuration Page Styles */

.product-config-page {
    min-height: 100vh;
    background-color: #f5f5f5;
    padding: 0;
}

/* Header */
.config-header {
    background-color: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Content Container */
.config-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px 40px;
}

/* Product Header */
.product-header {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.product-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.product-details h2 {
    font-size: 18px;
    color: #2c3e50;
    margin: 0;
}

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

/* Config Sections */
.config-section {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.config-section h3 {
    font-size: 16px;
    color: #2c3e50;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* Tables */
.config-table thead th {
    background-color: #f8f9fa;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.config-table tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    font-size: 14px;
}

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

/* Responsive wrapper for wide tables: allow horizontal scrolling */
.config-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}


.config-table input[type="text"],
.config-table input[type="number"],
.config-table select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
}

/* Image Upload Cell */
.image-upload-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.preview-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.upload-label {
    padding: 4px 12px;
    background-color: white;
    /* border: 1px solid #ced4da; */
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.upload-label:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.upload-label input[type="file"] {
    display: none;
}

/* Section Header with Actions */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.section-actions select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

/* Recommended Products */
.recommended-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recommended-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.recommended-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.recommended-item-info {
    flex: 1;
}

.recommended-item-actions {
    display: flex;
    gap: 5px;
}

/* Editor Access Checkboxes */
.editor-access-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.checkbox-item label {
    cursor: pointer;
    user-select: none;
}

/* Add Product Page Styles */
.add-product-page {
    min-height: 100vh;
    background-color: #f5f5f5;
    padding: 0;
}

.page-header {
    background-color: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.add-product-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px 40px;
}

.form-section {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-section h3 {
    font-size: 16px;
    color: #2c3e50;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.data-table thead th {
    background-color: #f8f9fa;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.data-table tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.data-table input[type="text"],
.data-table select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
}

/* Add these styles to your main CSS file */
.loading-categories {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f0f8ff;
    border-radius: 4px;
    margin-bottom: 15px;
    color: #0066cc;
    font-size: 14px;
    font-weight: 500;
}

.mini-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.categories-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    border-left: 4px solid #4CAF50;
}

.info-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.info-warning {
    color: #f57c00;
    font-size: 12px;
    font-style: italic;
}

.refresh-group {
    display: flex;
    gap: 8px;
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
}

.material-stats {
    display: flex;
    gap: 15px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #666;
}

.stat-label {
    font-weight: 500;
}

.stat-value {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    color: #333;
}

.filter-card-info {
    font-size: 11px;
    color: #666;
    margin-top: 5px;
    display: flex;
    justify-content: space-between;
}

/* Responsive */
@media (max-width: 768px) {
    .config-content {
        padding: 0 15px 30px;
    }
    
    .product-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .product-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .product-actions button {
        flex: 1;
    }
    
    .editor-access-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .config-table {
        font-size: 12px;
    }
    
    .config-table th,
    .config-table td {
        padding: 8px 5px;
    }

    /* Make Calculate row wrap and align left on small screens */
    .calculate-row {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .calculate-row .calculate-inputs {
        display: flex;
        gap: 8px;
        align-items: center;
        width: 100%;
        flex-wrap: wrap;
    }

    /* Ensure table headers retain table layout and styling on small screens */
    .config-table thead {
        display: table-header-group;
    }
    .config-table tbody {
        display: table-row-group;
    }
    .config-table thead th {
        background-color: #f8f9fa;
        color: #495057;
        font-weight: 600;
        display: table-cell;
        white-space: nowrap;
    }
}

/* Readonly/disabled look for table inputs (used for non-first rows) */
.readonly-input {
    background: #f5f5f5 !important;
    color: #666 !important;
    border: 1px solid #ddd !important;
}

/* Add this CSS to your stylesheet */
.thumbnail-container { position: relative; display: inline-block; }

.remove-thumbnail-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    z-index: 9999;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    transition: background-color 0.15s;
    pointer-events: auto;
}

.remove-thumbnail-btn:hover {
    background: #cc0000;
}

.thumbnail-container:hover .remove-thumbnail-btn,
.file-preview-container:hover .remove-thumbnail-btn {
    display: flex;
}

/* Optional: hide remove button until hover */
.remove-thumbnail-btn {
    display: none;
}

.thumbnail-container:hover .remove-thumbnail-btn,
.file-preview-container:hover .remove-thumbnail-btn {
    display: flex;
}

/* Or always show it (recommended for usability) */
.remove-thumbnail-btn {
    display: flex;
}