/* ==========================================================================
   Wadantech HMS — Appointment form modernisation
   Scoped to .appointment-form so it only restyles the booking wizard markup
   (which uses legacy Bootstrap classes form-control / form-check / col-lg-*).
   No Blade edits — pure CSS overlay.
   ========================================================================== */

/* ----- Field grid spacing ----- */
.appointment-form .row {
    --bs-gutter-y: 1rem;
    row-gap: 1.25rem;
    column-gap: 0;
}
.appointment-form [class*="col-"] {
    padding-inline: 12px;
}

/* ----- Field wrapper ----- */
.appointment-form .appointment-form__input-block,
.appointment-form .form-group {
    margin-bottom: 0;
}

/* ----- Labels ----- */
.appointment-form .form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}
[data-theme="dark"] .appointment-form .form-label {
    color: var(--text-soft);
}
.appointment-form .required {
    color: var(--red-500);
    margin-inline-start: 2px;
}

/* ----- Section heading (h2) ----- */
.appointment-form h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0;
}
[data-theme="dark"] .appointment-form h2 { color: var(--text); }

/* ----- New / Old patient radio toggle (top-right of header) ----- */
.appointment-form .new-patient-radio,
.appointment-form .old-patient-radio {
    width: 18px;
    height: 18px;
    accent-color: var(--cyan-600);
    margin: 0;
    cursor: pointer;
}
.appointment-form .form-check-label {
    cursor: pointer;
    font-weight: 500;
    color: var(--text);
}

/* ----- Inputs / selects / textareas ----- */
.appointment-form .form-control,
.appointment-form .form-select,
.appointment-form select,
.appointment-form textarea,
.appointment-form input[type="text"],
.appointment-form input[type="email"],
.appointment-form input[type="password"],
.appointment-form input[type="number"],
.appointment-form input[type="tel"],
.appointment-form input[type="date"] {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9375rem;
    line-height: 1.4;
    transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    min-height: 44px;
}
.appointment-form .form-control:focus,
.appointment-form .form-select:focus,
.appointment-form select:focus,
.appointment-form textarea:focus,
.appointment-form input:focus {
    outline: none;
    border-color: var(--cyan-600);
    box-shadow: 0 0 0 3px rgba(0, 144, 168, 0.18);
    background: var(--surface);
}
.appointment-form .form-control::placeholder,
.appointment-form textarea::placeholder,
.appointment-form input::placeholder {
    color: #9CA3AF;
    opacity: 1;
}
.appointment-form .form-control:disabled,
.appointment-form .form-control[readonly] {
    background: var(--surface-2);
    color: var(--muted);
    cursor: not-allowed;
}

/* Dark mode inputs (still readable on the dark surface) */
[data-theme="dark"] .appointment-form .form-control,
[data-theme="dark"] .appointment-form .form-select,
[data-theme="dark"] .appointment-form select,
[data-theme="dark"] .appointment-form textarea,
[data-theme="dark"] .appointment-form input {
    background: var(--surface-3);
    border-color: var(--border-strong);
    color: var(--text);
}
[data-theme="dark"] .appointment-form .form-control:focus,
[data-theme="dark"] .appointment-form input:focus {
    background: var(--surface-2);
    border-color: var(--cyan-400);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.20);
}
[data-theme="dark"] .appointment-form .form-control:disabled,
[data-theme="dark"] .appointment-form .form-control[readonly] {
    background: rgba(255,255,255,0.04);
}

/* Custom select chevron */
.appointment-form select,
.appointment-form .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-inline-end: 36px;
}
[dir="rtl"] .appointment-form select,
[dir="rtl"] .appointment-form .form-select {
    background-position: left 14px center;
    padding-inline-start: 36px;
    padding-inline-end: 14px;
}

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

/* ----- Gender / radio groups inline -----
   Bootstrap's .form-check applies padding-left:1.5em and the input gets margin-left:-1.5em
   (absolute-ish positioning); the legacy markup also slaps ms-3 utility classes on both the
   input and the label, which scatter them across the row. We reset all of that with the
   highest specificity we reasonably can. */
.appointment-form .grp-radio {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    align-items: center;
    min-height: 44px; /* visually match input height */
}
.appointment-form .grp-radio .form-check {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
}
.appointment-form .grp-radio .form-check > .form-check-input,
.appointment-form .grp-radio .form-check-input {
    /* Reset Bootstrap's negative offset + the ms-3 utility on the input itself. */
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    margin-inline-start: 0 !important;
    margin-inline-end: 0 !important;
    margin-top: 0 !important;
    float: none !important;
    position: static !important;
    flex-shrink: 0;
    accent-color: var(--cyan-600);
    cursor: pointer;
}
.appointment-form .grp-radio .form-check > .form-check-label,
.appointment-form .grp-radio .form-check-label {
    /* Reset Bootstrap label positioning + the ms-3 utility on the label. */
    margin: 0 !important;
    margin-inline-start: 0 !important;
    padding: 0 !important;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    line-height: 1.3;
}

/* Same reset for the top-of-card "New Patient / Old Patient" toggle which uses the
   identical pattern (form-check with ms-3 on both input and label). */
.appointment-form .form-check {
    padding-left: 0 !important;
    padding-inline-start: 0 !important;
}
.appointment-form .form-check .new-patient-radio,
.appointment-form .form-check .old-patient-radio {
    margin: 0 !important;
    margin-inline-start: 0 !important;
    float: none !important;
    position: static !important;
}

/* ----- Phone-number widget (intl-tel-input) ----- */
.appointment-form .iti {
    width: 100%;
}
.appointment-form .iti .form-control {
    padding-inline-start: 88px; /* leave room for the country flag dropdown */
}

/* ----- Save / submit button ----- */
.appointment-form .btn[type="submit"],
.appointment-form #saveBtn,
.appointment-form .save-btn {
    padding: 12px 32px;
    font-size: 0.9375rem;
    min-width: 140px;
}

/* ----- Header: stack on mobile ----- */
@media (max-width: 720px) {
    .appointment-form .d-lg-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .appointment-form .d-lg-flex .d-flex {
        align-self: stretch;
    }
}

/* ----- Currency / amount field icon ----- */
.appointment-form .input-group {
    display: flex;
    align-items: stretch;
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.appointment-form .input-group:focus-within {
    border-color: var(--cyan-600);
    box-shadow: 0 0 0 3px rgba(0, 144, 168, 0.18);
}
.appointment-form .input-group .form-control,
.appointment-form .input-group input {
    border: none;
    box-shadow: none;
    min-height: 42px;
}
.appointment-form .input-group-text {
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 600;
    border-inline-end: 1px solid var(--border);
    font-size: 0.875rem;
}

/* ----- Validation error message ----- */
.appointment-form .invalid-feedback,
.appointment-form .error-msg {
    display: block;
    font-size: 0.8125rem;
    color: var(--red-500);
    margin-top: 6px;
}
.appointment-form .form-control.is-invalid,
.appointment-form .form-control.error {
    border-color: var(--red-500);
}

/* ----- Booking-slot button grid (the slot picker that lives below the form) ----- */
.appointment-form .slot-time-section .btn,
.appointment-form .booking-slot .btn {
    border-radius: var(--r-full);
    font-size: 0.875rem;
    padding: 8px 16px;
}
