/**
 * ShopWorks Import Modal Styles
 *
 * Shared styles for the "Paste from ShopWorks" import feature
 * across all quote builders (DTG, DTF, Screenprint, Embroidery).
 *
 * @version 1.0.0
 * @date 2026-01-31
 */

/* Import Button */
.btn-import-shopworks {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
    white-space: nowrap;
    height: 42px;
}

.btn-import-shopworks:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-import-shopworks:active {
    transform: translateY(0);
}

.btn-import-shopworks i {
    font-size: 14px;
}

/* Modal Overlay */
.shopworks-import-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.shopworks-import-modal.active {
    display: flex;
}

/* Modal Content */
.shopworks-import-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: shopworksModalSlide 0.3s ease;
}

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

/* Modal Header */
.shopworks-import-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.shopworks-import-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shopworks-import-header h3 i {
    color: #6366f1;
}

.shopworks-import-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s ease;
}

.shopworks-import-close:hover {
    background: #e2e8f0;
    color: #334155;
}

/* Modal Body */
.shopworks-import-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.shopworks-import-hint {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shopworks-import-hint i {
    color: #6366f1;
}

/* Paste Area */
.shopworks-paste-area {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    background: #f8fafc;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.shopworks-paste-area:focus {
    outline: none;
    border-color: #6366f1;
    background: white;
}

.shopworks-paste-area::placeholder {
    color: #94a3b8;
}

/* Preview Section */
.shopworks-import-preview {
    display: none;
    margin-top: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.shopworks-import-preview.active {
    display: block;
}

.shopworks-import-preview h4 {
    margin: 0 0 16px 0;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shopworks-import-preview h4 i {
    color: #10b981;
}

/* Preview Grid */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.preview-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.preview-item-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.preview-item-value {
    font-size: 14px;
    color: #1e293b;
    font-weight: 500;
}

/* Preview Products List */
.preview-products {
    margin-top: 16px;
}

.preview-products h5 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.preview-products-list {
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.preview-product-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-product-item:last-child {
    border-bottom: none;
}

.preview-product-style {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    font-weight: 600;
    color: #6366f1;
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 80px;
}

.preview-product-desc {
    font-size: 13px;
    color: #475569;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-product-qty {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* Preview Services */
.preview-services {
    margin-top: 16px;
}

.preview-services-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-service-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    font-size: 12px;
    color: #166534;
    font-weight: 500;
}

.preview-service-badge i {
    font-size: 11px;
}

.preview-service-badge.warning {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

/* Preview Warnings */
.preview-warnings {
    margin-top: 16px;
    padding: 12px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
}

.preview-warnings h5 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-warnings ul {
    margin: 0;
    padding-left: 20px;
}

.preview-warnings li {
    font-size: 12px;
    color: #78350f;
    margin-bottom: 4px;
}

/* Modal Footer */
.shopworks-import-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
}

.btn-cancel-import {
    padding: 10px 20px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel-import:hover {
    background: #f1f5f9;
    color: #334155;
}

.btn-parse-import {
    padding: 10px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-parse-import:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-parse-import:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-parse-import .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* DECG Row Styling */
.product-row.decg-row {
    background: linear-gradient(90deg, #fef3c7 0%, #fffbeb 100%);
}

.product-row.decg-row .style-cell {
    position: relative;
}

.decg-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #92400e;
    background: #fde68a;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* Custom Product Row Styling */
.product-row.custom-row {
    background: linear-gradient(90deg, #e0e7ff 0%, #eef2ff 100%);
}

.custom-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #4338ca;
    background: #c7d2fe;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* Cost Input for Custom Products */
.cost-input-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cost-input {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid #c7d2fe;
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

.cost-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Non-SanMar $0 Price Warning */
.product-row.price-warning,
tr.price-warning {
    border-left: 4px solid #dc2626;
    background: linear-gradient(90deg, #fef2f2 0%, #fff 40%);
}

tr.price-warning .cell-price {
    color: #dc2626;
    font-weight: 600;
}

/* Import Progress Overlay */
.import-progress-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.import-progress-overlay.active {
    display: flex;
}

.import-progress-card {
    background: white;
    border-radius: 12px;
    padding: 32px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 360px;
    max-width: 480px;
}

.import-progress-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.import-progress-status {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
}

.import-progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.import-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #4f46e5);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.import-progress-detail {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
}

/* Responsive */
@media (max-width: 640px) {
    .shopworks-import-content {
        max-height: 95vh;
    }

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

    .shopworks-import-footer {
        flex-direction: column;
    }

    .shopworks-import-footer button {
        width: 100%;
    }
}
