/**
 * Frontend booking form styles (shadcn/ui inspired)
 * Tailwind CSS classes are used via CDN
 */

/* shadcn/ui component styles */
:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 126 53% 59%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 126 53% 59%;
    --radius: 0.5rem;
    --mbs-brand-color: #61CE70;
    --mbs-brand-rgb: 97, 206, 112;
    --mbs-button-bg: #61CE70;
    --mbs-button-text: #FFFFFF;
    --mbs-button-border: #61CE70;
    --mbs-button-hover-color: #4FB85E;
    --mbs-button-hover-rgb: 79, 184, 94;
    --mbs-button-bg-hover: rgba(97,206,112,0.88);
}

.mbs-booking-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.mbs-form-container {
    background: linear-gradient(180deg, #ffffff 0%, #f7fff9 100%);
    border: 1px solid #d1fae5;
    border-radius: 16px;
    box-shadow: 0 14px 35px rgba(17, 24, 39, 0.08);
    padding: 2rem;
}

.mbs-form-container h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
}

.mbs-form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.mbs-form-section:last-child {
    border-bottom: none;
}

.mbs-form-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #065f46;
}

.mbs-form-group {
    margin-bottom: 1.5rem;
}

.mbs-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1rem;
}

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

.mbs-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.mbs-form-group .required {
    color: #ef4444;
}

.mbs-input,
.mbs-select,
.mbs-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #111827 !important; /* Force black text */
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* Ensure all form inputs have visible text */
.mbs-input::placeholder,
.mbs-select::placeholder,
.mbs-textarea::placeholder {
    color: #9ca3af;
}

.mbs-input:focus,
.mbs-select:focus,
.mbs-textarea:focus {
    color: #111827 !important; /* Force black text on focus */
}

.mbs-input:focus,
.mbs-select:focus,
.mbs-textarea:focus {
    outline: none;
    border-color: var(--mbs-brand-color);
    box-shadow: 0 0 0 3px rgba(var(--mbs-brand-rgb), 0.2);
}

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

.mbs-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.mbs-checkbox {
    margin-right: 0.5rem;
    margin-top: 0.25rem;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.mbs-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.mbs-button-primary {
    background: var(--mbs-button-bg);
    color: var(--mbs-button-text);
    border: 1px solid var(--mbs-button-border);
}

.mbs-button-primary:hover {
    background: var(--mbs-button-bg-hover);
}

.mbs-button-primary:disabled {
    background-color: #93c5a0;
    cursor: not-allowed;
}

.mbs-messages {
    margin-top: 1rem;
}

.mbs-message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.mbs-message-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.mbs-message-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.mbs-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

#mbs-stripe-element {
    padding: 1rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* Loading state */
.mbs-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Taken slots styling */
.mbs-select option.mbs-slot-taken {
    color: #9ca3af;
    font-style: italic;
    background-color: #f3f4f6;
}

.mbs-select option:disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

/* Loading state improvements */
.mbs-loading {
    position: relative;
    pointer-events: none;
}

.mbs-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
}

.mbs-loading .mbs-button-primary::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Hero booking layout ([mbs_booking_form layout="hero"]) */
.mbs-booking-hero {
    position: relative;
    overflow: hidden;
    padding: 2.75rem 1.25rem 3.5rem;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: linear-gradient(165deg, #f7fff9 0%, #effaf2 40%, #e8f7ec 100%);
}

.mbs-booking-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse 90% 60% at 15% -10%, rgba(255, 255, 255, 0.95) 0%, transparent 55%),
        radial-gradient(ellipse 70% 50% at 92% 8%, rgba(255, 255, 255, 0.75) 0%, transparent 48%),
        radial-gradient(ellipse 55% 40% at 40% 100%, rgba(255, 255, 255, 0.5) 0%, transparent 45%);
    pointer-events: none;
    z-index: 0;
}

/* Compact hero: lighter section, tighter card — matches small 2×3 grid + time row */
.mbs-booking-hero--mini {
    padding: 1.5rem 1rem 2rem;
    background: #eef8f0;
}

.mbs-booking-hero--mini::before {
    opacity: 0.65;
}

.mbs-booking-hero__layout {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
}

.mbs-booking-hero__layout--mini {
    max-width: 640px;
}

.mbs-booking-hero__intro {
    max-width: 36rem;
    margin-bottom: 2rem;
}

.mbs-booking-hero__intro--mini {
    max-width: none;
    margin-bottom: 0.85rem;
    text-align: center;
}

.mbs-booking-hero__heading {
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    font-weight: 700;
    color: #0f172a;
    line-height: 1.15;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
}

.mbs-booking-hero__heading--mini {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    margin: 0 0 0.35rem;
}

.mbs-booking-hero__lede {
    font-size: 1.05rem;
    color: #475569;
    line-height: 1.55;
    margin: 0;
}

.mbs-booking-hero__lede--mini {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.45;
}

.mbs-booking-hero__card {
    background: #ffffff;
    border: 1px solid #d1fae5;
    border-radius: 16px;
    box-shadow: 0 14px 35px rgba(17, 24, 39, 0.08);
    padding: 1.75rem 1.5rem 2rem;
    max-width: 720px;
}

.mbs-booking-hero__card--mini {
    margin: 0 auto;
    max-width: 100%;
    width: 100%;
    padding: 1.1rem 1.15rem 1.2rem;
    border: 1px solid #d1fae5;
    border-radius: 16px;
    box-shadow: 0 14px 35px rgba(17, 24, 39, 0.08);
}

.mbs-booking-hero__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
    align-items: stretch;
}

.mbs-booking-hero__grid--mini {
    gap: 0.65rem 0.75rem;
    align-items: center;
}

.mbs-booking-hero__grid-full {
    grid-column: 1 / -1;
}

.mbs-booking-hero__phone-field {
    position: relative;
    width: 100%;
    min-width: 0;
}

.mbs-booking-hero__phone-field .mbs-booking-hero__input {
    padding-right: 2.25rem;
}

.mbs-booking-hero__phone-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    opacity: 0.45;
    pointer-events: none;
    background: no-repeat center / contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E");
}

.mbs-booking-hero__input:user-invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.35);
}

.mbs-booking-hero__intake {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px solid #d1fae5;
}

.mbs-booking-hero__intake-title {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin: 0;
}

.mbs-booking-hero .mbs-booking-hero-calendar > button,
.mbs-booking-hero .mbs-booking-hero-select > button,
.mbs-booking-hero .mbs-booking-hero-time > button {
    height: 48px !important;
    border-radius: 8px !important;
    border: 1px solid #d1fae5 !important;
    background-color: #f7fff9 !important;
    font-size: 15px !important;
    box-sizing: border-box !important;
}

.mbs-booking-hero--mini .mbs-booking-hero-calendar > button,
.mbs-booking-hero--mini .mbs-booking-hero-select > button,
.mbs-booking-hero--mini .mbs-booking-hero-time > button {
    height: 40px !important;
    border-radius: 8px !important;
    border: 1px solid #bbf7d0 !important;
    background-color: #f0fdf4 !important;
    font-size: 14px !important;
}

.mbs-booking-hero__cta:hover:not(:disabled) {
    background-color: var(--mbs-button-hover-color) !important;
}

.mbs-booking-hero__cta--mini:hover:not(:disabled) {
    background-color: var(--mbs-button-hover-color) !important;
}

@media (max-width: 640px) {
    .mbs-booking-hero__grid {
        grid-template-columns: 1fr;
    }
    
    .mbs-booking-hero {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .mbs-booking-hero__intro--mini {
        text-align: left;
    }
}

/* Form appearance presets (Settings + shortcode appearance="standard|clean|minimal|clinical") */
.mbs-booking-form.mbs-appearance-clean .mbs-form-container {
    border-radius: 16px;
    box-shadow: 0 14px 35px rgba(17, 24, 39, 0.08);
    border: 1px solid #d1fae5;
}

.mbs-booking-form.mbs-appearance-minimal .mbs-form-container {
    box-shadow: none;
    border: 1px solid #bbf7d0;
    background: #f8fff9;
}

.mbs-booking-form.mbs-appearance-clinical .mbs-form-container {
    border-left: 4px solid var(--mbs-brand-color);
    box-shadow: 0 14px 35px rgba(17, 24, 39, 0.08);
    border-top: 1px solid #d1fae5;
    border-right: 1px solid #d1fae5;
    border-bottom: 1px solid #d1fae5;
}

/* Unified shell for React-based default layout */
#mbs-booking-form-react.mbs-booking-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

/* Harmonize shadcn select/calendar/time buttons with lookup design */
#mbs-booking-form-react .mbs-select-trigger,
#mbs-booking-form-react .mbs-calendar-trigger,
#mbs-booking-form-react .mbs-time-picker-trigger {
    border: 1px solid #d1fae5 !important;
    border-radius: 10px !important;
    background: #f7fff9 !important;
    color: #111827 !important;
}

#mbs-booking-form-react .mbs-select-trigger:focus,
#mbs-booking-form-react .mbs-calendar-trigger:focus,
#mbs-booking-form-react .mbs-time-picker-trigger:focus {
    outline: none !important;
    border-color: var(--mbs-brand-color) !important;
    box-shadow: 0 0 0 3px rgba(var(--mbs-brand-rgb), 0.2) !important;
}

.mbs-booking-hero.mbs-appearance-clean {
    background: linear-gradient(165deg, #f7fff9 0%, #eef8f0 100%);
}

.mbs-booking-hero.mbs-appearance-clean .mbs-booking-hero__card--mini {
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.1);
}

.mbs-booking-hero.mbs-appearance-minimal {
    background: #f3faf5;
}

.mbs-booking-hero.mbs-appearance-minimal::before {
    opacity: 0.35;
}

.mbs-booking-hero.mbs-appearance-minimal .mbs-booking-hero__card--mini {
    box-shadow: none;
    border: 1px solid #e2e8f0;
    background: #fafafa;
}

.mbs-booking-hero.mbs-appearance-clinical {
    background: #f4fbf6;
}

.mbs-booking-hero.mbs-appearance-clinical .mbs-booking-hero__card--mini {
    border-left: 4px solid var(--mbs-brand-color);
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

/* Responsive */
@media (max-width: 640px) {
    .mbs-booking-form {
        padding: 1rem;
    }
    
    .mbs-form-container {
        padding: 1.5rem;
    }

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