/**
 * Product Picker v1.0 - Enhanced Product Selection UI
 * Beautiful grid with filtering, promotions, and multi-select
 */

/* Main Container */
.product-picker {
    background: #0c1015;
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    border: 1px solid #1b2731;
}

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

.product-picker-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-picker-title h3 {
    margin: 0;
    font-size: 18px;
    color: #e9eef4;
}

.product-picker-title .count-badge {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: white;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
}

/* Selection Mode Toggle */
.selection-mode-toggle {
    display: flex;
    background: #111923;
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
}

.mode-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #9fb0c3;
    cursor: pointer;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.mode-btn:hover {
    color: #e9eef4;
}

.mode-btn.active {
    background: linear-gradient(135deg, #16a34a, #0f7533);
    color: white;
}

/* Filter Bar */
.product-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.filter-search input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid #1b2731;
    border-radius: 10px;
    background: #111923;
    color: #e9eef4;
    font-size: 14px;
    transition: border-color 0.2s;
}

.filter-search input:focus {
    outline: none;
    border-color: #3b82f6;
}

.filter-search input::placeholder {
    color: #64748b;
}

.filter-search::before {
    content: "🔍";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.filter-select {
    min-width: 160px;
}

.filter-select select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #1b2731;
    border-radius: 10px;
    background: #111923;
    color: #e9eef4;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-select select:focus {
    outline: none;
    border-color: #3b82f6;
}

/* Quick Action Buttons */
.quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.quick-action-btn {
    padding: 8px 14px;
    border: 1px solid #2d3a47;
    background: #111923;
    color: #9fb0c3;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-action-btn:hover {
    background: #1b2731;
    color: #e9eef4;
    border-color: #3b82f6;
}

.quick-action-btn.danger:hover {
    border-color: #dc2626;
    color: #f87171;
}

/* Category Sections */
.product-categories-container {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 8px;
}

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

.product-categories-container::-webkit-scrollbar-track {
    background: #111923;
    border-radius: 3px;
}

.product-categories-container::-webkit-scrollbar-thumb {
    background: #2d3a47;
    border-radius: 3px;
}

.product-categories-container::-webkit-scrollbar-thumb:hover {
    background: #3b82f6;
}

.product-category-section {
    margin-bottom: 24px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #1b2731;
}

.category-name {
    font-size: 15px;
    font-weight: 600;
    color: #e9eef4;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-name .cat-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

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

.cat-select-all {
    padding: 4px 10px;
    font-size: 11px;
    background: transparent;
    border: 1px solid #2d3a47;
    color: #9fb0c3;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.cat-select-all:hover {
    background: #16a34a;
    border-color: #16a34a;
    color: white;
}

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

/* Product Card */
.product-card {
    background: #111923;
    border: 2px solid #1b2731;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.product-card:hover {
    border-color: #3b82f6;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

.product-card.selected {
    border-color: #16a34a;
    background: #0c1a13;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25);
}

.product-card.promoted {
    border-color: #f59e0b;
    background: #1a1708;
}

.product-card.promoted.selected {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

/* Product Image */
.product-image {
    width: 100%;
    height: 140px;
    background: #0c1015;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

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

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

.product-image .no-image {
    font-size: 48px;
    color: #2d3a47;
}

/* Selection Checkbox */
.product-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.product-checkbox input {
    display: none;
}

.product-checkbox .checkmark {
    width: 24px;
    height: 24px;
    background: #111923;
    border: 2px solid #2d3a47;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
    color: transparent;
}

.product-card.selected .checkmark {
    background: #16a34a;
    border-color: #16a34a;
    color: white;
}

/* Promotion Badge */
.promo-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.promo-badge.featured {
    background: linear-gradient(135deg, #ec4899, #be185d);
}

.promo-badge.bestseller {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

/* Product Info */
.product-info {
    padding: 14px;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    color: #e9eef4;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: #4ade80;
}

.product-brand {
    font-size: 11px;
    color: #64748b;
    background: #1b2731;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Product Actions */
.product-actions {
    display: flex;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #1b2731;
}

.product-action-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.product-action-btn.promote {
    background: #1a1708;
    color: #fbbf24;
    border: 1px solid #f59e0b30;
}

.product-action-btn.promote:hover {
    background: #f59e0b;
    color: #000;
}

.product-action-btn.promote.active {
    background: #f59e0b;
    color: #000;
}

.product-action-btn.link {
    background: #0f172a;
    color: #3b82f6;
    border: 1px solid #3b82f630;
}

.product-action-btn.link:hover {
    background: #3b82f6;
    color: white;
}

/* Selected Products Summary */
.selected-products-summary {
    background: linear-gradient(135deg, #0f2818, #0c1a13);
    border: 1px solid #16a34a40;
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
}

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

.summary-title {
    font-size: 14px;
    font-weight: 600;
    color: #4ade80;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-count {
    background: #16a34a;
    color: white;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
}

.summary-clear-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #dc262640;
    color: #f87171;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.summary-clear-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

/* Selected Products List */
.selected-products-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-product-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #111923;
    border: 1px solid #2d3a47;
    border-radius: 8px;
    padding: 6px 10px 6px 12px;
    font-size: 12px;
    color: #e9eef4;
}

.selected-product-tag.promoted {
    border-color: #f59e0b;
    background: #1a1708;
}

.selected-product-tag.promoted::before {
    content: "⭐";
    margin-right: 2px;
}

.tag-remove {
    width: 18px;
    height: 18px;
    border: none;
    background: #2d3a47;
    color: #9fb0c3;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    transition: all 0.2s;
}

.tag-remove:hover {
    background: #dc2626;
    color: white;
}

/* Promotion Options Panel */
.promotion-options {
    background: #111923;
    border: 1px solid #f59e0b30;
    border-radius: 10px;
    padding: 16px;
    margin-top: 16px;
}

.promotion-options h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 8px;
}

.promo-option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.promo-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #0c1015;
    border: 1px solid #2d3a47;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.promo-option:hover {
    border-color: #f59e0b;
}

.promo-option.selected {
    border-color: #f59e0b;
    background: #1a1708;
}

.promo-option input {
    display: none;
}

.promo-option .option-icon {
    font-size: 18px;
}

.promo-option .option-text {
    font-size: 12px;
    color: #e9eef4;
}

.promo-option .option-desc {
    font-size: 10px;
    color: #64748b;
}

/* Empty State */
.product-picker-empty {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.product-picker-empty .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.product-picker-empty h4 {
    color: #9fb0c3;
    margin: 0 0 8px 0;
}

.product-picker-empty p {
    margin: 0 0 20px 0;
    font-size: 14px;
}

.product-picker-empty .scan-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.product-picker-empty .scan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Loading State */
.product-picker-loading {
    text-align: center;
    padding: 60px 20px;
}

.product-picker-loading .loader {
    width: 48px;
    height: 48px;
    border: 4px solid #1b2731;
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.product-picker-loading p {
    color: #9fb0c3;
    font-size: 14px;
}

/* Manual Link Input */
.manual-link-input {
    margin-top: 20px;
    padding: 20px;
    background: #111923;
    border: 1px dashed #2d3a47;
    border-radius: 12px;
}

.manual-link-input h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #e9eef4;
    display: flex;
    align-items: center;
    gap: 8px;
}

.manual-link-input textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #1b2731;
    border-radius: 8px;
    background: #0c1015;
    color: #e9eef4;
    font-size: 13px;
    resize: vertical;
    min-height: 80px;
    font-family: monospace;
}

.manual-link-input textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.manual-link-input textarea::placeholder {
    color: #64748b;
}

.manual-link-input .hint {
    font-size: 11px;
    color: #64748b;
    margin-top: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-picker {
        padding: 16px;
    }
    
    .product-picker-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .product-filter-bar {
        flex-direction: column;
    }
    
    .filter-search {
        min-width: 100%;
    }
    
    .product-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .product-image {
        height: 100px;
    }
    
    .quick-actions {
        flex-wrap: wrap;
    }
}

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