/* ==========================================================================
   ZocDoc Integration – Multi-Step Booking Modal (Frontend)
   Uses the Synergy Health theme CSS variables defined in style.css.
   ========================================================================== */

/* ---------- Overlay ---------- */

.zocdoc-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(32, 32, 48, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 250ms ease, visibility 250ms ease;
    padding: 20px;
}

.zocdoc-modal-overlay.zocdoc-modal--open {
    opacity: 1;
    visibility: visible;
}

/* ---------- Modal Container ---------- */

.zocdoc-modal {
    background: var(--white, #ffffff);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 560px;
    padding: 40px 36px 36px;
    position: relative;
    transform: translateY(20px) scale(0.97);
    transition: transform 250ms ease, max-width 300ms ease;
    overflow: hidden;
}

.zocdoc-modal-overlay.zocdoc-modal--open .zocdoc-modal {
    transform: translateY(0) scale(1);
}

.zocdoc-modal--wide {
    max-width: 680px;
}

/* ---------- Close Button ---------- */

.zocdoc-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-light, #f5f5f5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease;
    padding: 0;
    line-height: 1;
    z-index: 2;
}

.zocdoc-modal-close:hover {
    background: var(--gray-medium, #cccccc);
}

.zocdoc-modal-close svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-dark, #333333);
    stroke-width: 2.5;
}

/* ---------- Back Button ---------- */

.zocdoc-modal-back {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-light, #f5f5f5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease;
    padding: 0;
    line-height: 1;
    z-index: 2;
}

.zocdoc-modal-back:hover {
    background: var(--gray-medium, #cccccc);
}

.zocdoc-modal-back svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-dark, #333333);
    stroke-width: 2.5;
    fill: none;
}

/* ---------- Step Indicator ---------- */

.zocdoc-modal-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.zocdoc-modal-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-medium, #cccccc);
    transition: background 200ms ease, transform 200ms ease;
}

.zocdoc-modal-step-dot--active {
    background: var(--teal, #62A498);
    transform: scale(1.25);
}

.zocdoc-modal-step-dot--done {
    background: var(--teal-light, #E3EFED);
}

/* ---------- Step Container ---------- */

.zocdoc-modal-step-container {
    position: relative;
    overflow: hidden;
}

.zocdoc-modal-step {
    display: none;
    animation: zocdocFadeIn 250ms ease forwards;
}

.zocdoc-modal-step--active {
    display: block;
}

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

/* ---------- Header ---------- */

.zocdoc-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.zocdoc-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark, #333333);
    margin: 0 0 6px;
    line-height: 1.3;
}

.zocdoc-modal-subtitle {
    font-size: 14px;
    color: var(--text-light, #666666);
    margin: 0;
    line-height: 1.5;
}

/* ---------- Patient Type Cards (Step 1) ---------- */

.zocdoc-modal-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.zocdoc-modal-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 20px 24px;
    border: 2px solid var(--gray-border, #E5E5E5);
    border-radius: 12px;
    background: var(--white, #ffffff);
    cursor: pointer;
    transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
    text-decoration: none;
    color: inherit;
    text-align: center;
}

.zocdoc-modal-card:hover {
    border-color: var(--teal, #62A498);
    box-shadow: 0 4px 16px rgba(98, 164, 152, 0.18);
    transform: translateY(-2px);
}

.zocdoc-modal-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(98, 164, 152, 0.15);
}

.zocdoc-modal-card:focus-visible {
    outline: 3px solid var(--teal, #62A498);
    outline-offset: 2px;
}

/* ---------- Card Icon ---------- */

.zocdoc-modal-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.zocdoc-modal-card--new .zocdoc-modal-card-icon {
    background: var(--teal-light, #E3EFED);
}

.zocdoc-modal-card--new .zocdoc-modal-card-icon svg {
    stroke: var(--teal, #62A498);
}

.zocdoc-modal-card--existing .zocdoc-modal-card-icon {
    background: var(--light-blue, #C7D4EC);
}

.zocdoc-modal-card--existing .zocdoc-modal-card-icon svg {
    stroke: var(--blue, #4464AD);
}

.zocdoc-modal-card-icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.8;
    fill: none;
}

/* ---------- Card Text ---------- */

.zocdoc-modal-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark, #333333);
    margin: 0 0 4px;
    line-height: 1.3;
}

.zocdoc-modal-card-desc {
    font-size: 12px;
    color: var(--text-light, #666666);
    margin: 0;
    line-height: 1.4;
}

/* ---------- Specialty Grid (Step 2) ---------- */

.zocdoc-specialty-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.zocdoc-specialty-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px 16px;
    border: 2px solid var(--gray-border, #E5E5E5);
    border-radius: 12px;
    background: var(--white, #ffffff);
    cursor: pointer;
    transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
    text-align: center;
    text-decoration: none;
    color: inherit;
}

.zocdoc-specialty-card:hover {
    border-color: var(--teal, #62A498);
    box-shadow: 0 4px 16px rgba(98, 164, 152, 0.18);
    transform: translateY(-2px);
}

.zocdoc-specialty-card:active {
    transform: translateY(0);
}

.zocdoc-specialty-card:focus-visible {
    outline: 3px solid var(--teal, #62A498);
    outline-offset: 2px;
}

.zocdoc-specialty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--teal, #62A498);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.zocdoc-specialty-icon img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.zocdoc-specialty-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark, #333333);
    line-height: 1.3;
}

/* ---------- Location List (Condition Step) ---------- */

.zocdoc-location-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 360px;
    overflow-y: auto;
}

.zocdoc-location-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border: 2px solid var(--gray-border, #E5E5E5);
    border-radius: 12px;
    background: var(--white, #ffffff);
    cursor: pointer;
    transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
    text-decoration: none;
    color: inherit;
}

.zocdoc-location-card:hover {
    border-color: var(--teal, #62A498);
    background: var(--teal-light, #E3EFED);
}

.zocdoc-location-card:active {
    box-shadow: 0 2px 8px rgba(98, 164, 152, 0.15);
}

.zocdoc-location-card:focus-visible {
    outline: 3px solid var(--teal, #62A498);
    outline-offset: 2px;
}

.zocdoc-location-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--teal-light, #E3EFED);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.zocdoc-location-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--teal, #62A498);
    stroke-width: 2;
    fill: none;
}

.zocdoc-location-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark, #333333);
}

.zocdoc-location-dropdown-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 6px;
}

.zocdoc-location-select {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid var(--gray-border, #E5E5E5);
    border-radius: 8px;
    background: var(--white, #ffffff);
    cursor: pointer;
    appearance: auto;
}

.zocdoc-location-select:focus {
    outline: 3px solid var(--teal, #62A498);
    outline-offset: 2px;
    border-color: var(--teal, #62A498);
}

.zocdoc-location-select option {
    padding: 8px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.zocdoc-location-fallback {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.zocdoc-location-fallback-desc {
    font-size: 14px;
    color: var(--text-muted, #6B7280);
    line-height: 1.5;
    margin: 0;
}

.zocdoc-preferred-location-input {
    width: 100%;
}

.zocdoc-location-continue {
    align-self: flex-start;
}

.zocdoc-location-continue:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------- Contact Info Form (Final Step) ---------- */

.zocdoc-contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.zocdoc-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.zocdoc-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.zocdoc-form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark, #333333);
    line-height: 1.4;
}

.zocdoc-required {
    color: var(--red, #D14B4B);
}

.zocdoc-form-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-border, #E5E5E5);
    border-radius: 10px;
    font-size: 15px;
    color: var(--text-dark, #333333);
    background: var(--white, #ffffff);
    transition: border-color 200ms ease, box-shadow 200ms ease;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}

.zocdoc-form-input::placeholder {
    color: var(--text-light, #999999);
}

.zocdoc-form-input:focus {
    border-color: var(--teal, #62A498);
    box-shadow: 0 0 0 3px rgba(98, 164, 152, 0.15);
}

.zocdoc-form-input--error {
    border-color: var(--red, #D14B4B);
}

.zocdoc-form-input--error:focus {
    border-color: var(--red, #D14B4B);
    box-shadow: 0 0 0 3px rgba(209, 75, 75, 0.15);
}

.zocdoc-form-error {
    font-size: 13px;
    color: var(--red, #D14B4B);
    background: rgba(209, 75, 75, 0.08);
    padding: 10px 14px;
    border-radius: 8px;
    line-height: 1.4;
}

.zocdoc-form-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    background: var(--teal, #62A498);
    color: var(--white, #ffffff);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 200ms ease, transform 100ms ease;
    font-family: inherit;
    margin-top: 4px;
}

.zocdoc-form-submit:hover {
    background: var(--teal-dark, #4E8A7F);
}

.zocdoc-form-submit:active {
    transform: scale(0.98);
}

.zocdoc-form-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.zocdoc-form-submit:focus-visible {
    outline: 3px solid var(--teal, #62A498);
    outline-offset: 2px;
}

.zocdoc-form-submit-loading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.zocdoc-spinner {
    width: 18px;
    height: 18px;
    animation: zocdocSpin 0.8s linear infinite;
}

@keyframes zocdocSpin {
    to { transform: rotate(360deg); }
}

/* ---------- Responsive ---------- */

@media screen and (max-width: 640px) {
    .zocdoc-modal {
        padding: 32px 24px 28px;
    }

    .zocdoc-modal--wide {
        max-width: 95%;
    }

    .zocdoc-specialty-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .zocdoc-specialty-icon {
        width: 52px;
        height: 52px;
    }

    .zocdoc-specialty-icon img {
        width: 34px;
        height: 34px;
    }

    .zocdoc-specialty-name {
        font-size: 12px;
    }
}

@media screen and (max-width: 480px) {
    .zocdoc-modal {
        padding: 28px 18px 24px;
    }

    .zocdoc-modal-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .zocdoc-modal-card {
        flex-direction: row;
        padding: 18px 20px;
        gap: 16px;
        text-align: left;
    }

    .zocdoc-modal-card-icon {
        margin-bottom: 0;
        width: 48px;
        height: 48px;
    }

    .zocdoc-modal-card-icon svg {
        width: 24px;
        height: 24px;
    }

    .zocdoc-modal-title {
        font-size: 18px;
    }

    .zocdoc-form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
