/**
 * T~Suds Booking Form Styles
 * Adapted from LaundryHQ app booking form
 */

/* CSS Variables (matching T~Suds branding) */
#bookingForm {
    --primary-purple: #d3c3f1;
    --secondary-purple: #B88BC7;
    --dark-purple: #9A6BB0;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --border-color: #e0e0e0;
    --text-dark: #2d2235;
    --text-light: #666;
    --text-muted: #999;
    --success-green: #28a745;
    --error-red: #dc3545;
    --warning-yellow: #ffc107;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --transition: all 0.2s ease;
    --border-radius: 8px;
}

/* Container - 2 column layout */
.booking-container {
    display: grid;
    grid-template-columns: 1fr 365px;
    gap: 24px;
    align-items: start;
    margin: 40px auto;
    max-width: 1200px;
    padding: 0 20px;
}

.booking-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Cards */
.booking-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: visible;
}

.booking-card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.booking-card-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.booking-card-body {
    padding: 20px;
}

/* Form Elements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.form-label.required::after {
    content: " *";
    color: var(--error-red);
}

.form-input,
.form-select,
.form-textarea {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(211, 195, 241, 0.1);
}

.form-field-invalid,
.form-field-invalid:focus {
    border-color: #b42318;
    outline: 2px solid #b42318;
    outline-offset: 2px;
    background: #fff1f0;
}

#address-autocomplete-container input.form-field-invalid {
    border-color: #b42318;
    outline: 2px solid #b42318;
    outline-offset: 2px;
    background: #fff1f0;
}

.booking-service-cards.form-field-invalid {
    outline: 2px solid #b42318;
    outline-offset: 4px;
    background: #fff1f0;
}

.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
.address-autocomplete-wrapper input:-webkit-autofill,
.address-autocomplete-wrapper input:-webkit-autofill:hover,
.address-autocomplete-wrapper input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    -webkit-text-fill-color: var(--text-dark) !important;
    caret-color: var(--text-dark);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.mb-0 {
    margin-bottom: 0;
}

/* Service Cards */
.booking-service-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.booking-service-card {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    background: var(--bg-white);
}

.booking-service-card:hover {
    border-color: var(--secondary-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.booking-service-card.selected {
    border-color: var(--primary-purple);
    background: rgba(211, 195, 241, 0.08);
}

.booking-service-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.service-icon {
    font-size: 28px;
    margin-bottom: 8px;
    line-height: 1;
}

.service-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.service-price {
    color: var(--dark-purple);
    font-size: 0.85rem;
    font-weight: 500;
}

.card-checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: var(--success-green);
    border-radius: 50%;
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.booking-service-card.selected .card-checkmark {
    display: flex;
}

/* Service Options Panel */
.service-options-panel {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    display: none;
}

.service-options-panel.active {
    display: block;
}

.service-options-panel .form-row {
    grid-template-columns: 180px 1fr;
}

.service-options-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark-purple);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Radio Cards */
.booking-radio-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.booking-radio-card {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    background: var(--bg-white);
    flex: 1;
    min-width: 140px;
}

.booking-radio-card:hover {
    border-color: var(--secondary-purple);
}

.booking-radio-card.selected {
    border-color: var(--primary-purple);
    background: rgba(211, 195, 241, 0.08);
}

.booking-radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-dark);
}

.price-badge {
    margin-left: auto;
    background: var(--primary-purple);
    color: #3b2354;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Household Items Table */
.household-items-compact {
    background: var(--bg-light);
    border-radius: 6px;
    padding: 12px;
}

.household-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.household-item-row:last-child {
    border-bottom: none;
}

.household-item-row .item-name {
    font-size: 0.85rem;
    font-weight: 500;
    flex: 1;
}

.household-item-row .item-price {
    font-size: 0.8rem;
    color: var(--dark-purple);
    width: 60px;
    text-align: center;
}

.household-item-row .item-qty {
    width: 60px;
}

.household-item-row .item-qty input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
}

/* Add-on Cards */
.booking-addon-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.booking-addon-card {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    background: var(--bg-white);
}

.booking-addon-card:hover {
    border-color: var(--secondary-purple);
}

.booking-addon-card.selected {
    border-color: var(--primary-purple);
    background: rgba(211, 195, 241, 0.08);
}

.booking-addon-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.addon-icon {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 6px;
}

.addon-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
    line-height: 1.2;
}

.addon-price {
    font-size: 0.7rem;
    color: var(--dark-purple);
    font-weight: 500;
}

.addon-qty-inline {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    display: none;
}

.booking-addon-card.selected .addon-qty-inline {
    display: block;
}

.addon-qty-inline input,
.addon-qty-inline select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    text-align: center;
}

/* Price Sidebar */
.booking-price-sidebar {
    position: sticky;
    top: 100px;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary-purple), var(--secondary-purple));
    color: white;
    padding: 16px;
    text-align: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.sidebar-body {
    padding: 16px;
}

.price-breakdown {
    margin-bottom: 16px;
}

.price-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-dark);
}

.price-line.service-line {
    border-bottom: 1px dashed var(--border-color);
}

.price-line.addon-line {
    font-size: 0.8rem;
    color: var(--text-light);
    padding: 6px 0;
    padding-left: 8px;
}

.price-line.addon-line span:first-child::before {
    content: "+ ";
    color: var(--text-muted);
}

.price-line span:last-child {
    font-weight: 500;
}

.price-divider {
    height: 2px;
    background: var(--border-color);
    margin: 12px 0;
}

.price-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark-purple);
}

.minimum-notice {
    background: rgba(211, 195, 241, 0.1);
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--dark-purple);
    font-weight: 600;
    margin-top: 12px;
}

.minimum-warning {
    background: rgba(255, 193, 7, 0.15);
    color: #B38600;
}

/* Submit Section */
.booking-submit {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
}

#bookingForm .btn {
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    display: inline-block;
}

#bookingForm .btn-primary {
    background: #674075;
    color: white;
}

#bookingForm .btn-primary:hover {
    background: #4f2d5e;
}

#bookingForm .btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.booking-status:not(:empty) {
    position: fixed;
    top: 90px;
    right: 16px;
    width: min(420px, calc(100vw - 32px));
    z-index: 1100;
    padding: 12px 16px;
    border-radius: 6px;
    text-align: left;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.booking-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.booking-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.booking-status.pending {
    background: #f4eef8;
    color: #4f2d5e;
    border: 1px solid #d3c3f1;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    z-index: 10000;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.notification.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notification.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

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

/* Geoapify Autocomplete Styles */
.geoapify-autocomplete-items {
    position: absolute;
    z-index: 10000;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.geoapify-autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.geoapify-autocomplete-item:last-child {
    border-bottom: none;
}

.geoapify-autocomplete-item:hover {
    background: var(--bg-light);
}

.geoapify-close-button {
    display: none;
}

/* Address Autocomplete Container Wrapper */
.address-autocomplete-wrapper {
    position: relative;
    overflow: visible;
    z-index: 100;
}

/* Ensure Geoapify dropdown displays above other content */
.address-autocomplete-wrapper .geoapify-autocomplete-items {
    z-index: 1000;
}

.address-autocomplete-wrapper input.form-input {
    width: 100%;
}

/* Style the Geoapify-created input to match our form styling */
.address-autocomplete-wrapper input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: 'Open Sans', sans-serif;
    transition: all 0.2s ease;
    background: white;
}

.address-autocomplete-wrapper input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-purple, #d3c3f1);
    box-shadow: 0 0 0 3px rgba(211, 195, 241, 0.1);
}

/* Service area warning */
.form-note-warning {
    padding: 8px 12px;
    background: #fef3c7;
    border-left: 3px solid #d97706;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #92400e;
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .booking-container {
        grid-template-columns: 1fr;
    }

    .booking-price-sidebar {
        position: static;
        order: -1;
    }

    .booking-addon-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .service-options-panel .form-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .service-options-panel .form-group {
        min-width: 0;
    }

    .booking-service-cards {
        grid-template-columns: 1fr;
    }

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

    .booking-radio-group {
        flex-direction: column;
    }

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

/* Accordion/Collapsible Preferences */
.accordion-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-header:hover {
    background: rgba(211, 195, 241, 0.05);
}

.accordion-toggle {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
    color: var(--primary-purple);
}

.accordion-toggle.active {
    transform: rotate(180deg);
}

.accordion-body {
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.accordion-body.collapsed {
    max-height: 0 !important;
    overflow: hidden;
    opacity: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.accordion-body:not(.collapsed) {
    max-height: 2000px;
    opacity: 1;
}
