/* ============================================
   FORMS & QUOTE DRAWER
   Crystal Facility Solutions
   ============================================ */

/* ─── Drawer Base ──────────────────────────────────────────── */
.quick-quote-drawer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.quick-quote-drawer.active {
    visibility: visible;
    opacity: 1;
}

.quick-quote-drawer .drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.quick-quote-drawer .drawer-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 560px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.quick-quote-drawer.active .drawer-panel {
    transform: translateX(0);
}

/* ─── Drawer Header ────────────────────────────────────────── */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    gap: 1rem;
}

.drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.drawer-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.drawer-title i {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #7cb342, #9ccc65);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.drawer-title h3 {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.selected-service {
    color: #9ccc65;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-change-service {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-change-service:hover {
    background: rgba(124, 179, 66, 0.2);
    border-color: rgba(124, 179, 66, 0.4);
    color: #ffffff;
}

.btn-close-drawer {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.btn-close-drawer:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: rotate(90deg);
}

/* ─── Drawer Body ──────────────────────────────────────────── */
.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    -webkit-overflow-scrolling: touch;
}

.drawer-body::-webkit-scrollbar {
    width: 6px;
}

.drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

.drawer-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ─── Form Steps ───────────────────────────────────────────── */
.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.form-step h4 {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(124, 179, 66, 0.3);
}

/* ─── Form Groups ──────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-group label .required {
    color: #ef4444;
    margin-left: 0.25rem;
}

/* ─── Inputs ───────────────────────────────────────────────── */
.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    z-index: 2;
    pointer-events: none;
    transition: color 0.3s ease;
}

.input-with-icon input,
.input-with-icon select,
.input-with-icon textarea {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #ffffff;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.input-with-icon input::placeholder,
.input-with-icon textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.input-with-icon input:focus,
.input-with-icon select:focus,
.input-with-icon textarea:focus {
    outline: none;
    border-color: #7cb342;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.2);
}

.input-with-icon input:focus ~ i,
.input-with-icon select:focus ~ i {
    color: #7cb342;
}

/* Input states */
.input-with-icon input.error,
.input-with-icon select.error,
.input-with-icon textarea.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

.input-with-icon input.error ~ i,
.input-with-icon select.error ~ i {
    color: #ef4444;
}

.input-with-icon input.valid,
.input-with-icon select.valid,
.input-with-icon textarea.valid {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
    background: rgba(16, 185, 129, 0.05) !important;
}

.input-with-icon input.valid ~ i,
.input-with-icon select.valid ~ i {
    color: #10b981;
}

.input-with-icon input.shake-error,
.input-with-icon select.shake-error,
.input-with-icon textarea.shake-error {
    animation: fieldShake 0.5s ease;
}

/* Textarea specific */
.input-with-icon textarea {
    padding-left: 1rem;
    padding-top: 0.875rem;
    min-height: 80px;
    resize: vertical;
}

.input-with-icon textarea ~ i {
    display: none !important;
}

/* ─── Select Styling ───────────────────────────────────────── */
.input-with-icon select {
    appearance: none;
    cursor: pointer;
    padding-right: 2.5rem;
}

.input-with-icon select option {
    background: #1a1f2e;
    color: #ffffff;
}

/* ─── Form Row ─────────────────────────────────────────────── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ─── Field Errors ─────────────────────────────────────────── */
.field-error {
    display: none;
    color: #ff6b6b;
    font-size: 0.82rem;
    margin-top: 0.5rem;
    padding-left: 0.5rem;
    font-weight: 500;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.field-error.visible,
.field-error[style*="block"] {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
}

.field-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin-top: 0.375rem;
    display: block;
}

/* ─── Size Selector ────────────────────────────────────────── */
.size-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.size-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-align: center;
}

.size-option i {
    font-size: 1.5rem;
    color: #7cb342;
}

.size-option span {
    font-weight: 600;
    font-size: 0.9rem;
}

.size-option small {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.size-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(124, 179, 66, 0.5);
}

.size-option.selected {
    background: rgba(124, 179, 66, 0.15);
    border-color: #7cb342;
    color: #ffffff;
}

.size-option:focus-visible {
    outline: 2px solid #7cb342;
    outline-offset: 2px;
}

.size-selector.has-error {
    animation: fieldShake 0.5s ease;
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 12px;
    padding: 0.25rem;
}

/* ─── Bundle Checkboxes ────────────────────────────────────── */
.bundle-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.bundle-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bundle-checkbox:hover {
    background: rgba(124, 179, 66, 0.1);
    border-color: rgba(124, 179, 66, 0.3);
}

.bundle-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.bundle-checkbox .checkmark {
    position: relative;
    width: 24px;
    height: 24px;
    min-width: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bundle-checkbox input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, #7cb342, #9ccc65);
    border-color: #7cb342;
}

.bundle-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: block;
}

.bundle-checkbox .checkbox-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
}

.bundle-checkbox .checkbox-content i {
    font-size: 1.1rem;
    color: #7cb342;
    width: 20px;
    text-align: center;
}

.bundle-checkbox input[type="checkbox"]:focus-visible + .checkmark {
    outline: 2px solid #7cb342;
    outline-offset: 2px;
}

/* ─── Service Selector ─────────────────────────────────────── */
.service-selector-group {
    margin-bottom: 2rem;
}

.service-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 0.75rem;
}

.service-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-align: center;
}

.service-option i {
    font-size: 1.5rem;
    color: #7cb342;
    transition: all 0.3s ease;
}

.service-option:hover {
    background: rgba(124, 179, 66, 0.1);
    border-color: rgba(124, 179, 66, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(124, 179, 66, 0.15);
}

.service-option.selected,
.service-option[aria-checked="true"] {
    background: rgba(124, 179, 66, 0.2);
    border-color: #7cb342;
    color: #ffffff;
    box-shadow: 0 0 20px rgba(124, 179, 66, 0.3);
}

.service-option.selected i,
.service-option[aria-checked="true"] i {
    transform: scale(1.15);
}

.service-option:focus-visible {
    outline: 2px solid #7cb342;
    outline-offset: 2px;
}

/* ─── Trip Type Toggle ─────────────────────────────────────── */
.trip-type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    position: relative;
    z-index: 5;
}

.trip-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    position: relative;
    z-index: 6;
    pointer-events: auto;
}

.trip-toggle-btn i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.trip-toggle-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}

.trip-toggle-btn.active {
    background: linear-gradient(135deg, #7cb342, #9ccc65);
    border-color: #7cb342;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(124, 179, 66, 0.35);
}

.trip-toggle-btn.active i {
    transform: scale(1.1);
}

.trip-toggle-btn:focus-visible {
    outline: 2px solid #7cb342;
    outline-offset: 2px;
}

/* ─── Return Fields ────────────────────────────────────────── */
.return-fields {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease,
                margin 0.4s ease,
                gap 0.4s ease;
    margin: 0;
    gap: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.return-fields.visible {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

/* ─── Field Check Animation ────────────────────────────────── */
.input-with-check {
    position: relative;
}

.input-with-check .field-check {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 3;
    pointer-events: none;
}

.input-with-check input.valid ~ .field-check,
.input-with-check select.valid ~ .field-check {
    transform: translateY(-50%) scale(1);
}

.input-with-check input.valid,
.input-with-check select.valid {
    padding-right: 3rem;
}

/* ─── Number Input Spinners ───────────────────────────────── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 0.6;
    cursor: pointer;
}

/* ─── Date/Time Input Styling ─────────────────────────────── */
input[type="date"],
input[type="time"] {
    color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* ─── Estimate Preview ─────────────────────────────────────── */
.estimate-preview {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(124, 179, 66, 0.1);
    border: 1px solid rgba(124, 179, 66, 0.2);
    border-radius: 12px;
    margin-top: 1.5rem;
}

.estimate-icon {
    width: 40px;
    height: 40px;
    background: rgba(124, 179, 66, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7cb342;
    font-size: 1rem;
    flex-shrink: 0;
}

.estimate-text strong {
    color: #ffffff;
    display: block;
    margin-bottom: 0.25rem;
}

.estimate-text span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ─── Drawer Footer ────────────────────────────────────────── */
.drawer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.btn-prev-step,
.btn-next-step,
.btn-submit-quote {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-prev-step {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.btn-prev-step:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.btn-prev-step:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-next-step,
.btn-submit-quote {
    background: linear-gradient(135deg, #7cb342, #9ccc65);
    color: #ffffff;
    margin-left: auto;
}

.btn-next-step:hover,
.btn-submit-quote:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 179, 66, 0.35);
}

.btn-next-step:active,
.btn-submit-quote:active {
    transform: translateY(0);
}

/* ─── Step Indicator ──────────────────────────────────────── */
.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.step-dot.active {
    background: #7cb342;
    box-shadow: 0 0 10px rgba(124, 179, 66, 0.5);
    transform: scale(1.2);
}

.step-dot.completed {
    background: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
    transform: scale(1.1);
}

.step-dot.completed::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    opacity: 0.9;
}

/* ─── Toast Notifications ──────────────────────────────────── */
.quote-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    z-index: 100000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
}

.toast-success {
    background: #10b981;
    color: white;
}

.toast-error {
    background: #ef4444;
    color: white;
}

.toast-hiding {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes fieldShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* ─── Form Privacy Consent ───────────────────────────────── */
.form-consent {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 1rem;
    padding: 0 1rem;
    line-height: 1.5;
}

.form-consent a {
    color: #7cb342;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.form-consent a:hover {
    color: #9ccc65;
}

/* ─── Honeypot Field (Hidden) ────────────────────────────── */
#website {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* ─── Mobile Drawer Adjustments ──────────────────────────── */
@media (max-width: 768px) {
    .quick-quote-drawer .drawer-panel {
        max-width: 100%;
    }

    .drawer-header {
        padding: 1.25rem 1.5rem;
    }

    .drawer-body {
        padding: 1.5rem;
    }

    .drawer-footer {
        padding: 1.25rem 1.5rem;
    }
}

@media (max-width: 640px) {
    .quick-quote-drawer .drawer-panel {
        max-width: 100%;
    }

    .drawer-header {
        padding: 1rem 1.25rem;
    }

    .drawer-body {
        padding: 1.25rem;
    }

    .drawer-footer {
        padding: 1rem 1.25rem;
    }

    .size-selector {
        grid-template-columns: 1fr;
    }

    .bundle-checkboxes {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .service-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    .service-option {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }

    .service-option i {
        font-size: 1.25rem;
    }

    .return-fields {
        grid-template-columns: 1fr;
    }

    .return-fields.visible {
        gap: 0;
    }
}