/**
 * Guesty Booking Widget Styles
 *
 * Native booking widget for date selection, pricing, and reservations.
 */

/* Variables */
:root {
    --guesty-bw-brand: #c9a962;
    --guesty-bw-brand-dark: #b8993d;
    --guesty-bw-text: #333;
    --guesty-bw-text-light: #666;
    --guesty-bw-text-muted: #999;
    --guesty-bw-bg: #fff;
    --guesty-bw-bg-light: #f8f9fa;
    --guesty-bw-border: #e0e0e0;
    --guesty-bw-error: #dc3545;
    --guesty-bw-success: #28a745;
    --guesty-bw-radius: 8px;
    --guesty-bw-radius-lg: 12px;
    --guesty-bw-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --guesty-bw-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Widget Container */
.guesty-booking-widget {
    background: var(--guesty-bw-bg);
    border-radius: var(--guesty-bw-radius-lg);
    box-shadow: var(--guesty-bw-shadow-lg);
    padding: 24px;
    font-family: inherit;
    color: var(--guesty-bw-text);
    max-width: 400px;
    margin: 0 auto;
}

/* Bar title - hidden by default, shown in sticky bar context */
.guesty-bw-bar-title {
    display: none;
}

/* Step visibility */
.guesty-bw-step {
    display: none;
}

.guesty-bw-step.active,
.guesty-bw-step[style*="display: block"] {
    display: block;
}

/* Header & Price Display */
.guesty-bw-header {
    margin-bottom: 20px;
    text-align: center;
}

.guesty-bw-price-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

.guesty-bw-price-from {
    font-size: 14px;
    color: var(--guesty-bw-text-light);
}

.guesty-bw-price-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--guesty-bw-brand);
}

.guesty-bw-price-period {
    font-size: 14px;
    color: var(--guesty-bw-text-light);
}

/* Form Elements */
.guesty-bw-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guesty-bw-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.guesty-bw-dates-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.guesty-bw-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.guesty-bw-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--guesty-bw-text);
    margin: 0 0 2px 0;
}

.guesty-bw-field label .required {
    color: var(--guesty-bw-error);
    margin-left: 2px;
}

/* Smaller labels for date/guest fields in step 1 */
.guesty-bw-step-dates .guesty-bw-field label {
    font-size: 12px;
    color: var(--guesty-bw-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.guesty-bw-input {
    width: 100%;
    height: 40px;
    padding: 0 0.875rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: #fafafa;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.guesty-bw-input:focus {
    outline: none;
    border-color: #c9a962;
    box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.15);
}

.guesty-bw-input::placeholder {
    color: #999;
}

.guesty-bw-input[readonly] {
    cursor: pointer;
    border: 0 !important;
}

/* Flatpickr alt input inherits our input style */
.guesty-bw-field .flatpickr-input {
    height: 40px;
    padding: 0 0.875rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: #fafafa;
    box-sizing: border-box;
    cursor: pointer;
}

.guesty-bw-field .flatpickr-input:focus {
    outline: none;
    border-color: #c9a962;
    box-shadow: 0 0 0 3px rgba(201, 169, 98, 0.15);
}

.guesty-bw-textarea {
    height: auto;
    padding: 0.625rem 0.875rem;
    resize: vertical;
    min-height: 80px;
}

/* Guest Selector — matches search widget guest counter */
.guesty-bw-guests-selector {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    overflow: hidden;
}

.guesty-bw-guests-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    padding: 0;
    line-height: 1;
}

.guesty-bw-guests-btn:first-child {
    border-radius: 3px 0 0 3px;
}

.guesty-bw-guests-btn:last-child {
    border-radius: 0 3px 3px 0;
}

.guesty-bw-guests-btn:hover {
    background: #c9a962;
    color: #fff;
}

.guesty-bw-guests-btn:active {
    background: #b8993d;
    color: #fff;
}

.guesty-bw-guests-input {
    flex: 1;
    text-align: center;
    border: none;
    border-radius: 0;
    height: 40px;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    background: transparent;
    min-width: 40px;
    -moz-appearance: textfield;
}

.guesty-bw-guests-input::-webkit-outer-spin-button,
.guesty-bw-guests-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Buttons — matches search widget submit */
.guesty-bw-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 28px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
    letter-spacing: 0.5px;
    width: 100%;
}

.guesty-bw-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.guesty-bw-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.guesty-bw-btn-primary {
    background: #c9a962;
    color: #fff;
}

.guesty-bw-btn-primary:hover:not(:disabled) {
    background: #b8993d;
}

.guesty-bw-btn-secondary {
    background: transparent;
    color: #c9a962;
    border: 2px solid #c9a962;
}

.guesty-bw-btn-secondary:hover:not(:disabled) {
    background: #c9a962;
    color: #fff;
}

/* Back Button */
.guesty-bw-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    margin-bottom: 16px;
    background: none;
    border: none;
    color: var(--guesty-bw-text-light);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.2s ease;
}

.guesty-bw-back-btn:hover {
    color: var(--guesty-bw-brand);
}

.guesty-bw-back-btn svg {
    width: 16px;
    height: 16px;
}

/* Loading Spinner */
.guesty-bw-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: guesty-bw-spin 0.8s linear infinite;
}

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

.guesty-bw-btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Inline Pricing (auto-loaded in Step 1) */
.guesty-bw-inline-pricing {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--guesty-bw-border);
}

.guesty-bw-pricing-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 0;
    color: var(--guesty-bw-text-light);
    font-size: 14px;
}

.guesty-bw-pricing-loading .guesty-bw-spinner {
    border-color: rgba(201, 169, 98, 0.3);
    border-top-color: var(--guesty-bw-brand);
}

/* Pricing Breakdown */
.guesty-bw-pricing {
    display: table;
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.guesty-bw-pricing-line {
    display: table-row;
    font-size: 14px;
}

.guesty-bw-pricing-label {
    display: table-cell;
    color: var(--guesty-bw-text-light);
    padding: 6px 0;
    white-space: nowrap;
    border-bottom: 1px dotted #ccc;
}

.guesty-bw-pricing-value {
    display: table-cell;
    font-weight: 600;
    text-align: right;
    padding: 6px 0 6px 12px;
    white-space: nowrap;
    border-bottom: 1px dotted #ccc;
}

.guesty-bw-pricing-total {
    border-top: none;
}

.guesty-bw-pricing-total .guesty-bw-pricing-label {
    font-weight: 600;
    color: var(--guesty-bw-text);
    font-size: 15px;
    padding-top: 10px;
    border-bottom: none;
}

.guesty-bw-pricing-total .guesty-bw-pricing-value {
    font-weight: 700;
    font-size: 17px;
    color: var(--guesty-bw-brand);
    padding-top: 10px;
    border-bottom: none;
}

/* Promotion / Discount */
.guesty-bw-pricing-promotion .guesty-bw-pricing-label {
    color: #28a745;
}

.guesty-bw-pricing-promotion .guesty-bw-pricing-value {
    color: #28a745;
}

/* Pricing Details Toggle */
.guesty-bw-pricing-details-wrapper {
    position: relative;
}

.guesty-bw-pricing-details {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 16px 16px 12px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(10px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
}

.guesty-bw-pricing-details::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 8px;
    right: 8px;
    border-bottom: 2px dashed #ddd;
}

.guesty-bw-pricing-details .guesty-bw-pricing-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    padding: 4px 0;
}

.guesty-bw-pricing-details .guesty-bw-pricing-label {
    display: inline;
    border-bottom: none;
    padding: 0;
    color: var(--guesty-bw-text-light);
}

.guesty-bw-pricing-details .guesty-bw-pricing-value {
    display: inline;
    border-bottom: none;
    padding: 0;
    font-weight: 600;
}

.guesty-bw-pricing-details-wrapper.open .guesty-bw-pricing-details {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.guesty-bw-pricing-toggle {
    display: inline-block;
    font-size: 12px;
    color: var(--guesty-bw-brand);
    text-decoration: none;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.guesty-bw-pricing-toggle:hover {
    color: var(--guesty-bw-brand-dark);
    text-decoration: underline;
}

/* Section Titles */
.guesty-bw-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--guesty-bw-text);
    margin: 0 0 16px 0;
    padding: 0;
}

/* Total Summary (before submit) */
.guesty-bw-total-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--guesty-bw-bg-light);
    border-radius: var(--guesty-bw-radius);
    margin: 20px 0;
}

.guesty-bw-total-label {
    font-weight: 600;
    color: var(--guesty-bw-text);
}

.guesty-bw-total-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--guesty-bw-brand);
}

/* Disclaimer */
.guesty-bw-disclaimer {
    font-size: 12px;
    color: var(--guesty-bw-text-muted);
    text-align: center;
    margin: 16px 0 0 0;
    line-height: 1.5;
}

/* Confirmation */
.guesty-bw-step-confirmation {
    text-align: center;
}

.guesty-bw-confirmation-icon {
    color: var(--guesty-bw-success);
    margin-bottom: 20px;
}

.guesty-bw-confirmation-icon svg {
    width: 64px;
    height: 64px;
}

.guesty-bw-confirmation-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--guesty-bw-text);
    margin: 0 0 12px 0;
}

.guesty-bw-confirmation-message {
    color: var(--guesty-bw-text-light);
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.guesty-bw-confirmation-details {
    margin-bottom: 24px;
}

.guesty-bw-confirmation-code {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: var(--guesty-bw-bg-light);
    border-radius: var(--guesty-bw-radius);
}

.guesty-bw-confirmation-code-label {
    font-size: 12px;
    color: var(--guesty-bw-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.guesty-bw-confirmation-code-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--guesty-bw-brand);
    letter-spacing: 1px;
}

.guesty-bw-confirmation-summary {
    text-align: left;
    padding: 16px;
    background: var(--guesty-bw-bg-light);
    border-radius: var(--guesty-bw-radius);
    margin-bottom: 24px;
}

.guesty-bw-confirmation-property {
    font-weight: 600;
    margin-bottom: 8px;
}

.guesty-bw-confirmation-dates,
.guesty-bw-confirmation-guests {
    font-size: 14px;
    color: var(--guesty-bw-text-light);
}

/* Error Messages */
.guesty-bw-error {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: var(--guesty-bw-error);
    padding: 12px 16px;
    border-radius: var(--guesty-bw-radius);
    font-size: 14px;
    margin-top: 16px;
}

/* Flatpickr styling is handled by .guesty-flatpickr in guesty-search.css */

/* Responsive */
@media (max-width: 480px) {
    .guesty-booking-widget {
        padding: 20px 16px;
        border-radius: var(--guesty-bw-radius);
    }

    .guesty-bw-dates-row,
    .guesty-bw-form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .guesty-bw-price-amount {
        font-size: 24px;
    }

    .guesty-bw-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* Sidebar Card Integration */
.guesty-sp-booking-card .guesty-bw-price-display {
    justify-content: flex-start;
}

.guesty-sp-booking-card .guesty-bw-btn {
    margin-top: 4px;
}

/* Sidebar: show pricing details inline, hide toggle */
.guesty-sp-booking-card .guesty-bw-pricing-details-wrapper {
    position: static;
}

.guesty-sp-booking-card .guesty-bw-pricing-details {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin-bottom: 0;
}

.guesty-sp-booking-card .guesty-bw-pricing-details::after {
    display: none;
}

.guesty-sp-booking-card .guesty-bw-pricing-toggle {
    display: none;
}

/* Expanded widget in modal/overlay */
.guesty-sp-book-expanded .guesty-booking-widget {
    max-width: 440px;
    margin: 0 auto;
    padding: 24px;
    background: var(--guesty-bw-bg);
    border-radius: var(--guesty-bw-radius-lg) var(--guesty-bw-radius-lg) 0 0;
    box-shadow: var(--guesty-bw-shadow-lg);
}

