/**
 * CBX RFQ Form Styles
 * Validation states, toast notifications, and product preview
 * 
 * @package CBX Theme
 * @version 2.0.0
 */

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.rfq-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 0.9375rem;
    font-weight: 500;
    max-width: 90vw;
    min-width: 320px;
    opacity: 1;
    animation: toastSlideIn 0.4s ease-out;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastSlideOut {
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}


.rfq-toast.hiding {
    animation: toastSlideOut 0.3s ease-in forwards;
}

.rfq-toast__icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rfq-toast__message {
    flex: 1;
    color: #333;
}

.rfq-toast__close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 50%;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rfq-toast__close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

/* Toast Types */
.rfq-toast--success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
}

.rfq-toast--success .rfq-toast__icon {
    color: #059669;
}

.rfq-toast--success .rfq-toast__message {
    color: #065f46;
}

.rfq-toast--error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
}

.rfq-toast--error .rfq-toast__icon {
    color: #dc2626;
}

.rfq-toast--error .rfq-toast__message {
    color: #991b1b;
}

.rfq-toast--warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
}

.rfq-toast--warning .rfq-toast__icon {
    color: #d97706;
}

.rfq-toast--warning .rfq-toast__message {
    color: #92400e;
}

.rfq-toast--info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
}

.rfq-toast--info .rfq-toast__icon {
    color: #2563eb;
}

.rfq-toast--info .rfq-toast__message {
    color: #1e40af;
}

/* Mobile toast positioning */
@media (max-width: 575.98px) {
    .rfq-toast {
        left: 16px;
        right: 16px;
        transform: none !important;
        min-width: auto;
        max-width: none;
        padding: 14px 16px;
        font-size: 0.875rem;
        gap: 10px;
    }
    
    @keyframes toastSlideIn {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .rfq-toast.hiding {
        animation: toastSlideOutMobile 0.3s ease-in forwards;
    }
    
    @keyframes toastSlideOutMobile {
        to {
            opacity: 0;
            transform: translateY(-20px);
        }
    }
    
    .rfq-toast__icon {
        width: 20px;
        height: 20px;
    }
    
    .rfq-toast__close {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   FORM VALIDATION STATES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Invalid State */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='12' cy='12' r='10'%3e%3c/circle%3e%3cline x1='15' y1='9' x2='9' y2='15'%3e%3c/line%3e%3cline x1='9' y1='9' x2='15' y2='15'%3e%3c/line%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px !important;
}

/* Valid State */
.form-control.is-valid,
.form-select.is-valid {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'%3e%3c/path%3e%3cpolyline points='22 4 12 14.01 9 11.01'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px !important;
}

/* Checkbox validation */
.form-check-input.is-invalid {
    border-color: #ef4444 !important;
}

.form-check-input.is-invalid ~ .form-check-label {
    color: #dc2626;
}

.form-check-input.is-valid {
    border-color: #10b981 !important;
    background-color: #10b981;
}

/* Error message */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 6px;
    font-size: 0.8125rem;
    color: #dc2626;
    animation: slideDown 0.25s ease-out;
}

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

/* Fix for select with validation icon */
.form-select.is-valid,
.form-select.is-invalid {
    background-position: right 12px center, right 36px center;
}


/* ═══════════════════════════════════════════════════════════════════════════
   PRODUCT PREVIEW CARD
   ═══════════════════════════════════════════════════════════════════════════ */

.product-preview {
    display: none;
    margin-top: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

.product-preview__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.product-preview__grade {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a1a1a;
}

.product-preview__link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent-gold-dark, #FF9800);
    text-decoration: none;
}

.product-preview__link:hover {
    text-decoration: underline;
}

.product-preview__specs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.product-preview__spec {
    text-align: center;
    padding: 0.75rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eee;
}

.product-preview__spec-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
}

.product-preview__spec-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    margin-top: 0.25rem;
}

.product-preview__apps {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.5;
}

.product-preview__apps strong {
    color: #333;
}

@media (max-width: 575.98px) {
    .product-preview__specs {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   FORM SECTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.rfq-form-section {
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.rfq-form-section__title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.rfq-form-section__title svg {
    width: 20px;
    height: 20px;
    color: var(--accent-gold, #FFB74D);
}

.rfq-form-section__icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-gold, #FFB74D) 0%, var(--accent-gold-dark, #FF9800) 100%);
    border-radius: 8px;
    color: #fff;
}


/* ═══════════════════════════════════════════════════════════════════════════
   FILE INPUT STYLING
   ═══════════════════════════════════════════════════════════════════════════ */

.file-input-wrapper {
    position: relative;
}

.file-input-wrapper .form-control {
    cursor: pointer;
}

.file-input-wrapper::after {
    content: 'Browse...';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 12px;
    background: #f0f0f0;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #666;
    pointer-events: none;
}

.file-input-info {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.5rem;
}

.file-input-info svg {
    width: 14px;
    height: 14px;
    margin-right: 0.25rem;
    vertical-align: -2px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   SUBMIT BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */

.rfq-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--accent-gold, #FFB74D) 0%, var(--accent-gold-dark, #FF9800) 100%);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 183, 77, 0.3);
}

.rfq-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 183, 77, 0.4);
}

.rfq-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.rfq-submit-btn .spinner-border {
    width: 18px;
    height: 18px;
    border-width: 2px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   SUCCESS STATE
   ═══════════════════════════════════════════════════════════════════════════ */

.rfq-success {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 16px;
}

.rfq-success__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #10b981;
    border-radius: 50%;
    color: #fff;
}

.rfq-success__icon svg {
    width: 40px;
    height: 40px;
}

.rfq-success__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #065f46;
    margin-bottom: 0.5rem;
}

.rfq-success__message {
    font-size: 1rem;
    color: #047857;
    margin-bottom: 0.5rem;
}

.rfq-success__ref {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #065f46;
    margin-bottom: 1.5rem;
}


/* ═══════════════════════════════════════════════════════════════════════════
   ERROR ALERT
   ═══════════════════════════════════════════════════════════════════════════ */

.rfq-error-alert {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.rfq-error-alert__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #991b1b;
    margin-bottom: 0.5rem;
}

.rfq-error-alert__list {
    margin: 0;
    padding-left: 1.25rem;
    color: #b91c1c;
    font-size: 0.875rem;
}

.rfq-error-alert__list li {
    margin-bottom: 0.25rem;
}


/* ═══════════════════════════════════════════════════════════════════════════
   QUICK SELECT BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.quick-select-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.quick-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-select-btn:hover {
    border-color: var(--accent-gold, #FFB74D);
    color: var(--accent-gold-dark, #FF9800);
    background: rgba(255, 183, 77, 0.05);
}

.quick-select-btn.active {
    background: var(--accent-gold, #FFB74D);
    border-color: var(--accent-gold, #FFB74D);
    color: #1a1a1a;
}


/* ═══════════════════════════════════════════════════════════════════════════
   RTL SUPPORT
   ═══════════════════════════════════════════════════════════════════════════ */

[dir="rtl"] .form-control.is-invalid,
[dir="rtl"] .form-control.is-valid,
[dir="rtl"] .form-select.is-invalid,
[dir="rtl"] .form-select.is-valid {
    background-position: left 12px center;
    padding-right: 1rem !important;
    padding-left: 40px !important;
}

[dir="rtl"] .form-select.is-valid,
[dir="rtl"] .form-select.is-invalid {
    background-position: left 12px center, left 36px center;
}

[dir="rtl"] .file-input-wrapper::after {
    right: auto;
    left: 8px;
}

[dir="rtl"] .invalid-feedback {
    text-align: right;
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 767.98px) {
    .rfq-form-section {
        padding: 1rem;
    }
    
    .rfq-form-section__title {
        font-size: 0.9375rem;
    }
    
    .rfq-submit-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.9375rem;
    }
    
    .rfq-success {
        padding: 2rem 1.5rem;
    }
    
    .rfq-success__icon {
        width: 64px;
        height: 64px;
    }
    
    .rfq-success__icon svg {
        width: 32px;
        height: 32px;
    }
}