/**
 * Quote Modal Styles
 */

/* Modal Container */
.quote-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.quote-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.quote-modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Modal Header */
.quote-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.quote-modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.quote-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.quote-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* Form Styles */
.quote-form {
    padding: 24px;
}

.form-section {
    margin-bottom: 24px;
}

.form-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--primary-dark);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
    width: 100%;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.radio-group input[type="radio"] {
    margin-right: 6px;
    cursor: pointer;
}

/* Total Display */
.total-display {
    background: var(--primary-light);
    padding: 16px;
    border-radius: 4px;
    text-align: center;
    font-size: 1.2rem;
    margin-top: 16px;
}

.total-display strong {
    margin-right: 8px;
}

.total-display span {
    color: var(--primary-dark);
    font-weight: 600;
}

/* Textarea */
textarea {
    resize: vertical;
    min-height: 80px;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

/* Loading State */
.quote-loading {
    padding: 60px;
    text-align: center;
}

.quote-loading .spinner {
    margin: 0 auto 20px;
}

.quote-loading p {
    color: #666;
    font-size: 1.1rem;
}

/* Success State */
.quote-success {
    padding: 60px 24px;
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto 20px;
}

.quote-success h3 {
    color: var(--success-color);
    margin-bottom: 12px;
}

.quote-success p {
    color: #666;
    margin-bottom: 24px;
}

/* Error State */
.quote-error {
    padding: 60px 24px;
    text-align: center;
}

.error-icon {
    width: 80px;
    height: 80px;
    background: var(--error-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto 20px;
}

.quote-error h3 {
    color: var(--error-color);
    margin-bottom: 12px;
}

.quote-error p {
    color: #666;
    margin-bottom: 24px;
}

/* Send Quote Button */
.send-quote-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: var(--spacing-md);
}

.send-quote-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.send-quote-btn i {
    font-size: 1.1rem;
}

/* Multi-Product Styles */
.products-container {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Custom scrollbar for products container */
.products-container::-webkit-scrollbar {
    width: 8px;
}

.products-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.products-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.products-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.product-line {
    background: #f9f9f9;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: visible;
}

.product-line-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.product-line-header h4 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 1.1rem;
}

.btn-remove-product {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-remove-product:hover {
    background: #fee;
    color: var(--error-color);
}

.btn-change-product {
    background: #f0f0f0;
    border: 1px solid #ddd;
    color: #666;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-change-product:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary-color);
}

.product-line-content {
    padding: 20px;
    overflow: visible;
}

/* Product Search Container */
.product-search-container {
    position: relative;
    margin-bottom: 20px;
    overflow: visible !important;
}

.product-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.product-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.product-search-input[readonly] {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Product Info Row */
.product-info-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.product-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.product-details {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.6;
}

.product-details strong {
    color: var(--primary-dark);
}

/* Product Subtotal */
.product-subtotal {
    background: var(--primary-light);
    padding: 12px 16px;
    border-radius: 4px;
    text-align: right;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-top: 16px;
}

/* Add Product Button */
.btn-add-product {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: white;
    border: 2px dashed var(--primary-color);
    border-radius: 4px;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    justify-content: center;
}

.btn-add-product:hover {
    background: var(--primary-light);
    border-style: solid;
}

/* Quote Summary */
.quote-summary {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.summary-table tbody tr:last-child td {
    border-bottom: none;
}

.summary-table .text-center {
    text-align: center;
}

.summary-table .text-right {
    text-align: right;
}

.grand-total-row {
    background: var(--primary-light);
    font-size: 1.2rem;
}

.grand-total-row td {
    padding: 16px 10px;
    border-top: 2px solid var(--primary-color);
}

/* Color Select */
.color-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
}

/* Search Results Override for Product Search */
.product-search-container .search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 2100;
}

/* Preview Modal Styles */
.quote-preview-content {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.quote-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.quote-preview-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.quote-preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f9f9f9;
}

.quote-preview-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: white;
    flex-shrink: 0;
}

/* Email Preview Container Styles */
.email-preview-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: Arial, sans-serif;
}

.email-header {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 30px 20px;
}

.email-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 1px;
    color: white;
}

.email-header p {
    margin: 10px 0 0;
    font-size: 16px;
    opacity: 0.9;
    color: white;
}

/* Customer info at top of preview */
.customer-info-preview {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.customer-info-preview h3 {
    color: #333;
    margin: 0 0 12px;
    font-size: 18px;
}

.customer-info-preview p {
    margin: 6px 0;
    color: #555;
    font-size: 16px;
}

.customer-info-preview strong {
    color: #333;
}

.email-content {
    padding: 30px;
}

/* Preview Card Styles */
.preview-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
}

.preview-card h2 {
    color: var(--primary-color);
    font-size: 20px;
    margin: 0 0 16px;
}

.preview-card h3 {
    color: #333;
    font-size: 18px;
    margin: 0 0 16px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 8px;
}

.preview-card p {
    margin: 8px 0;
    color: #555;
    line-height: 1.6;
}

.preview-card strong {
    color: #333;
}

/* Product Image and Brand Logo in Preview */
.brand-logo-preview {
    max-height: 60px;
    max-width: 150px;
    object-fit: contain;
    margin-bottom: 16px;
    display: block;
}

.product-image-preview {
    max-width: 300px;
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 16px;
    display: block;
}

/* Preview Description */
.preview-description {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* Preview Table */
.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.preview-table td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.preview-table tr:last-child td {
    border-bottom: none;
}

.preview-total-row {
    background: var(--primary-light);
    font-size: 18px;
}

.preview-total-row td {
    padding: 14px 10px;
}

/* Notes Preview */
.notes-preview {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
}

.notes-preview h3 {
    color: var(--primary-color);
    margin-bottom: 12px;
}

.notes-preview p {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Preview Footer */
.preview-footer {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.preview-footer p {
    margin: 6px 0;
}

.preview-footer hr {
    margin: 20px 0;
    border: none;
    border-top: 1px solid #e0e0e0;
}

/* Color Swatches Preview */
.color-swatches-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.color-swatches-preview p {
    margin-bottom: 12px;
    font-weight: bold;
    color: #333;
}

.swatches-grid-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.swatch-item-preview {
    text-align: center;
    flex: 0 0 auto;
}

.swatch-item-preview.selected {
    position: relative;
}

.swatch-item-preview img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 2px solid #ddd;
    display: block;
    object-fit: cover;
}

.swatch-item-preview.selected img {
    border-color: var(--primary-color);
    border-width: 3px;
}

.swatch-item-preview span {
    display: block;
    font-size: 11px;
    margin-top: 4px;
    color: #666;
}

.swatch-item-preview.selected span {
    color: var(--primary-color);
    font-weight: bold;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .quote-modal-content {
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
    
    .quote-preview-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .quote-preview-body {
        padding: 16px;
    }
    
    .email-content {
        padding: 20px;
    }
    
    .product-image-preview {
        max-width: 100%;
    }
}