/* ============================================================================
   SMARTCRM 360 - MODERN QUOTE FORM V20.0.1
   Professional quote creation/edit modal with unified modern design
   ============================================================================ */

/* Modern Modal Overlay */
#newQuoteModal .modal-overlay,
#editQuoteModal .modal-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

/* Modern Modal Container */
#newQuoteModal .modal-content,
#editQuoteModal .modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Modern Modal Header */
#newQuoteModal .modal-header,
#editQuoteModal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px 40px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
}

#newQuoteModal .modal-header h2,
#editQuoteModal .modal-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

#newQuoteModal .modal-header h2 i,
#editQuoteModal .modal-header h2 i {
    font-size: 32px;
}

/* Close Button */
#newQuoteModal .close,
#editQuoteModal .close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: all 0.2s ease;
    opacity: 1;
}

#newQuoteModal .close:hover,
#editQuoteModal .close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Modal Body */
#newQuoteModal .modal-body,
#editQuoteModal .modal-body {
    padding: 40px;
    overflow-y: auto;
    flex: 1;
    background: #f8fafc;
}

/* Form Sections */
.quote-form-section {
    background: white;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.quote-form-section:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.quote-form-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.quote-form-section-title i {
    color: #667eea;
    font-size: 20px;
}

/* Form Grid */
.quote-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.quote-form-grid-full {
    grid-column: 1 / -1;
}

/* Form Group */
.quote-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quote-form-label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quote-form-label i {
    color: #667eea;
    font-size: 14px;
}

.quote-form-label .required {
    color: #ef4444;
    margin-left: 4px;
}

.quote-form-control {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: white;
}

.quote-form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.quote-form-control::placeholder {
    color: #94a3b8;
}

/* Select Dropdown */
select.quote-form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* Textarea */
textarea.quote-form-control {
    resize: vertical;
    min-height: 100px;
}

/* Help Text */
.quote-form-help {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* Quote-Level Pricing Controls */
.pricing-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.pricing-control-item {
    background: #f8fafc;
    padding: 16px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    transition: all 0.2s ease;
}

.pricing-control-item:hover {
    border-color: #cbd5e1;
    background: white;
}

.pricing-control-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pricing-control-label i {
    color: #667eea;
}

.pricing-control-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
    transition: all 0.2s ease;
}

.pricing-control-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.pricing-control-suffix {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: #64748b;
    pointer-events: none;
}

/* V21.5.0: Enhanced Special Discount Section - Premium professional styling */
.special-discount-section {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    color: #0f172a;
    border: 2px solid #cbd5e1;
    box-shadow: 0 8px 24px rgba(71, 85, 105, 0.15), inset 0 1px 0 rgba(255,255,255,0.8);
    position: relative;
    overflow: hidden;
}

.special-discount-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
}

.special-discount-section .quote-form-section-title {
    color: #1e293b;
    border-bottom-color: #cbd5e1;
}

.special-discount-section .quote-form-section-title i {
    color: #3b82f6;
}

.special-discount-input {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #1e293b;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    padding: 16px;
}

.special-discount-input:focus {
    background: white;
    border-color: white;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3);
}

.special-discount-help {
    color: #64748b;
    text-align: center;
    margin-top: 8px;
}

/* Before/After Comparison */
.before-after-comparison {
    background: #f0f9ff;
    border: 2px solid #bae6fd;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.comparison-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}

.comparison-item {
    text-align: center;
}

.comparison-label {
    font-size: 12px;
    font-weight: 600;
    color: #0369a1;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.comparison-value {
    font-size: 20px;
    font-weight: 700;
    color: #0c4a6e;
}

/* V21.5.0: Enhanced Products Section - Premium professional styling */
.products-search-section {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    color: #0f172a;
    border: 2px solid #cbd5e1;
    box-shadow: 0 8px 24px rgba(71, 85, 105, 0.15), inset 0 1px 0 rgba(255,255,255,0.8);
    position: relative;
    overflow: hidden;
}

.products-search-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10b981, #06b6d4, #3b82f6);
}

.products-search-section .quote-form-section-title {
    color: #1e293b;
    border-bottom-color: #cbd5e1;
}

.products-search-section .quote-form-section-title i {
    color: #10b981;
}

.product-search-wrapper {
    position: relative;
}

.product-search-input {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 14px 50px 14px 16px;
    color: #1e293b;
}

.product-search-input:focus {
    background: white;
    border-color: white;
}

.product-search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 18px;
}

.product-add-button {
    background: white;
    color: #059669;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-add-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.product-add-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Selected Items Table */
.selected-items-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
}

/* Summary Cards */
.quote-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.summary-card-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.9;
    margin-bottom: 8px;
}

.summary-card-value {
    font-size: 24px;
    font-weight: 700;
}

/* Modal Footer */
#newQuoteModal .modal-footer,
#editQuoteModal .modal-footer {
    padding: 24px 40px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 0 0 20px 20px;
}

.modal-footer-left {
    display: flex;
    gap: 12px;
}

.modal-footer-right {
    display: flex;
    gap: 12px;
}

/* Buttons */
.quote-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.quote-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.quote-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.quote-btn-secondary {
    background: white;
    color: #64748b;
    border: 2px solid #e2e8f0;
}

.quote-btn-secondary:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.quote-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.quote-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .quote-form-grid {
        grid-template-columns: 1fr;
    }
    
    .pricing-controls-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #newQuoteModal .modal-content,
    #editQuoteModal .modal-content {
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
    }
    
    #newQuoteModal .modal-header,
    #editQuoteModal .modal-header {
        padding: 20px;
        border-radius: 0;
    }
    
    #newQuoteModal .modal-header h2,
    #editQuoteModal .modal-header h2 {
        font-size: 20px;
    }
    
    #newQuoteModal .modal-body,
    #editQuoteModal .modal-body {
        padding: 20px;
    }
    
    .quote-form-section {
        padding: 20px;
    }
    
    #newQuoteModal .modal-footer,
    #editQuoteModal .modal-footer {
        padding: 16px 20px;
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-footer-left,
    .modal-footer-right {
        width: 100%;
        flex-direction: column;
    }
    
    .quote-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Scrollbar Styling */
#newQuoteModal .modal-body::-webkit-scrollbar,
#editQuoteModal .modal-body::-webkit-scrollbar {
    width: 8px;
}

#newQuoteModal .modal-body::-webkit-scrollbar-track,
#editQuoteModal .modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#newQuoteModal .modal-body::-webkit-scrollbar-thumb,
#editQuoteModal .modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#newQuoteModal .modal-body::-webkit-scrollbar-thumb:hover,
#editQuoteModal .modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loading State */
.quote-btn.loading {
    position: relative;
    color: transparent;
}

.quote-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

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

/* Info Badge */
.info-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #ede9fe;
    color: #5b21b6;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.info-badge i {
    font-size: 14px;
}

/* Success Badge */
.success-badge {
    background: #dcfce7;
    color: #166534;
}

/* Warning Badge */
.warning-badge {
    background: #fef3c7;
    color: #92400e;
}
