/* Isolated appointment booking UI — does not use minimal.css */

@font-face {
    font-family: "Vazir";
    src: url("../fonts/Vazir.woff") format("woff");
    font-display: swap;
}

:root {
    --ap-dark: #283618;
    --ap-mid: #5A6242;
    --ap-sage: #8B9568;
    --ap-cream: #F7F1E1;
    --ap-sand: #B9B69E;
    --ap-white: #ffffff;
    --ap-muted: rgba(40, 54, 24, 0.7);
    --ap-radius: 16px;
    --ap-radius-lg: 24px;
    --ap-shadow: 0 12px 40px rgba(40, 54, 24, 0.1);
    --ap-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ap-safe-top: env(safe-area-inset-top, 0px);
    --ap-safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
}

.ap-body {
    margin: 0;
    min-height: 100dvh;
    min-height: 100vh;
    font-family: "Vazir", Tahoma, sans-serif;
    color: var(--ap-dark);
    direction: rtl;
    background:
        radial-gradient(ellipse 100% 70% at 50% -10%, rgba(90, 98, 66, 0.2), transparent 55%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(40, 54, 24, 0.1), transparent 50%),
        linear-gradient(165deg, #efe8d4 0%, var(--ap-cream) 45%, #e8e2d0 100%);
    -webkit-tap-highlight-color: transparent;
}

.ap-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding:
        max(0.75rem, var(--ap-safe-top))
        1rem
        0.75rem;
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(247, 241, 225, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(185, 182, 158, 0.35);
}

.ap-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--ap-mid);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 4.5rem;
}

.ap-back:hover { color: var(--ap-dark); }

.ap-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--ap-dark);
    font-weight: 700;
}

.ap-brand img {
    height: 40px;
    width: auto;
}

.ap-brand span {
    font-size: 0.95rem;
}

.ap-topbar-spacer {
    min-width: 4.5rem;
}

.ap-main {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 1.25rem 1rem max(2rem, calc(var(--ap-safe-bottom) + 1.25rem));
}

.ap-intro {
    text-align: center;
    margin-bottom: 1.25rem;
    animation: apRise 0.5s var(--ap-ease) both;
}

.ap-intro-kicker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ap-sage);
    margin-bottom: 0.4rem;
}

.ap-intro h1 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.5rem, 5vw, 1.85rem);
}

.ap-intro p {
    margin: 0;
    color: var(--ap-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.ap-shell {
    background: var(--ap-white);
    border-radius: var(--ap-radius-lg);
    box-shadow: var(--ap-shadow);
    border: 1px solid rgba(185, 182, 158, 0.35);
    overflow: hidden;
    animation: apRise 0.55s var(--ap-ease) 0.05s both;
}

.ap-progress {
    display: flex;
    background: #f3ecdc;
    border-bottom: 1px solid rgba(185, 182, 158, 0.4);
}

.ap-progress-step {
    flex: 1;
    text-align: center;
    padding: 0.85rem 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ap-mid);
    opacity: 0.45;
    position: relative;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.ap-progress-step.is-active,
.ap-progress-step.is-done {
    opacity: 1;
    color: var(--ap-dark);
}

.ap-progress-step.is-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 18%;
    left: 18%;
    height: 3px;
    background: var(--ap-dark);
    border-radius: 3px 3px 0 0;
}

.ap-body-panel {
    padding: 1.25rem 1.1rem 1.4rem;
}

/* Smooth stacked steps — no display:none jank */
.ap-stack {
    display: grid;
    min-height: 280px;
}

.ap-step {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.985);
    pointer-events: none;
    transition:
        opacity 0.32s var(--ap-ease),
        transform 0.32s var(--ap-ease),
        visibility 0.32s;
    z-index: 0;
}

.ap-step.is-active {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    z-index: 2;
}

.ap-step.is-leaving {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.99);
    z-index: 1;
}

.ap-step-title {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.ap-step-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.ap-step-head h3 {
    margin: 0;
    font-size: 1.1rem;
}

.ap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    text-decoration: none;
    border-radius: 999px;
    transition: transform 0.2s var(--ap-ease), box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.ap-btn:active { transform: scale(0.98); }

.ap-btn-ghost {
    background: transparent;
    color: var(--ap-mid);
    border: 1.5px solid rgba(90, 98, 66, 0.35);
    padding: 0.55rem 0.95rem;
    font-size: 0.88rem;
}

.ap-btn-ghost:hover {
    background: var(--ap-cream);
    color: var(--ap-dark);
}

.ap-btn-primary {
    background: var(--ap-dark);
    color: var(--ap-white);
    padding: 0.95rem 1.25rem;
    width: 100%;
    font-size: 1.02rem;
    box-shadow: 0 10px 24px rgba(40, 54, 24, 0.2);
}

.ap-btn-primary:hover {
    background: var(--ap-mid);
    color: var(--ap-white);
}

.ap-btn-primary:disabled {
    opacity: 0.65;
    cursor: wait;
}

.ap-date-chip {
    text-align: center;
    margin: 0 0 1rem;
    padding: 0.55rem 0.9rem;
    background: var(--ap-cream);
    border-radius: 999px;
    color: var(--ap-mid);
    font-size: 0.9rem;
}

.ap-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
}

@media (min-width: 480px) {
    .ap-grid { grid-template-columns: repeat(3, 1fr); }
}

.ap-tile {
    padding: 0.85rem 0.5rem;
    border: 1.5px solid rgba(185, 182, 158, 0.55);
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    background: var(--ap-cream);
    color: var(--ap-dark);
    transition: transform 0.2s var(--ap-ease), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    position: relative;
}

.ap-tile:hover {
    border-color: var(--ap-mid);
    background: var(--ap-white);
    transform: translateY(-2px);
}

.ap-tile.is-selected {
    background: var(--ap-dark);
    border-color: var(--ap-dark);
    color: var(--ap-white);
    box-shadow: 0 8px 18px rgba(40, 54, 24, 0.22);
}

.ap-tile.is-busy {
    pointer-events: none;
    opacity: 0.7;
}

.ap-tile.is-busy::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(185, 182, 158, 0.5);
    border-top-color: var(--ap-dark);
    border-radius: 50%;
    animation: apSpin 0.65s linear infinite;
}

.ap-tile.is-selected.is-busy::after {
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
}

.ap-tile-label {
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.ap-tile-main {
    font-size: 1.02rem;
    font-weight: 800;
    margin-bottom: 0.1rem;
}

.ap-tile-sub {
    font-size: 0.72rem;
    opacity: 0.8;
}

.ap-tile.is-selected .ap-tile-label,
.ap-tile.is-selected .ap-tile-main,
.ap-tile.is-selected .ap-tile-sub {
    color: var(--ap-white);
}

.ap-time-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}

@media (min-width: 480px) {
    .ap-time-grid { grid-template-columns: repeat(4, 1fr); }
}

.ap-time {
    padding: 0.9rem 0.4rem;
    border: 1.5px solid rgba(185, 182, 158, 0.55);
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    background: var(--ap-cream);
    color: var(--ap-dark);
    font-weight: 700;
    transition: transform 0.2s var(--ap-ease), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    user-select: none;
}

.ap-time:hover {
    border-color: var(--ap-mid);
    background: var(--ap-white);
    transform: translateY(-2px);
}

.ap-time.is-selected {
    background: var(--ap-dark);
    border-color: var(--ap-dark);
    color: var(--ap-white);
    box-shadow: 0 8px 18px rgba(40, 54, 24, 0.22);
}

.ap-time.is-busy {
    pointer-events: none;
    opacity: 0.7;
}

.ap-time.is-busy::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(185, 182, 158, 0.5);
    border-top-color: var(--ap-dark);
    border-radius: 50%;
    animation: apSpin 0.65s linear infinite;
}

.ap-empty {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--ap-cream);
    border-radius: var(--ap-radius);
    color: var(--ap-mid);
}

.ap-empty i {
    font-size: 1.8rem;
    display: block;
    margin-bottom: 0.6rem;
}

.ap-field {
    margin-bottom: 1rem;
}

.ap-field label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.ap-field input,
.ap-field textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1.5px solid rgba(185, 182, 158, 0.7);
    border-radius: 12px;
    font: inherit;
    color: var(--ap-dark);
    background: var(--ap-cream);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ap-field input:focus,
.ap-field textarea:focus {
    outline: none;
    border-color: var(--ap-dark);
    background: var(--ap-white);
    box-shadow: 0 0 0 3px rgba(40, 54, 24, 0.1);
}

.ap-field textarea {
    resize: vertical;
    min-height: 100px;
}

.ap-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
    border-radius: var(--ap-radius);
}

.ap-loading.is-on { display: flex; }

.ap-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(185, 182, 158, 0.45);
    border-top-color: var(--ap-dark);
    border-radius: 50%;
    animation: apSpin 0.75s linear infinite;
}

.ap-step-relative { position: relative; }

.ap-modal {
    position: fixed;
    inset: 0;
    background: rgba(40, 54, 24, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ap-modal.is-open { display: flex; }

.ap-modal-card {
    width: 100%;
    max-width: 400px;
    background: var(--ap-white);
    border-radius: var(--ap-radius-lg);
    padding: 1.75rem 1.35rem;
    text-align: center;
    box-shadow: var(--ap-shadow);
    animation: apRise 0.4s var(--ap-ease);
}

.ap-modal-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: rgba(90, 98, 66, 0.12);
    color: var(--ap-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.ap-modal-card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
}

.ap-modal-card p {
    margin: 0 0 1.25rem;
    color: var(--ap-muted);
    line-height: 1.7;
}

@keyframes apRise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes apSpin {
    to { transform: rotate(360deg); }
}

@media (min-width: 640px) {
    .ap-main { padding-top: 1.75rem; }
    .ap-body-panel { padding: 1.5rem 1.5rem 1.65rem; }
    .ap-brand span { font-size: 1rem; }
}
