/* ============================================================
   Al Ahmadani AI Assistant — mobile-first UI
   Visual fidelity pass tuned against the reference mockup:
   cool-white bg · compact header · hero with orb ·
   square quick-action cards · soft chat bubbles ·
   pill composer · slim bottom nav
   ============================================================ */

:root {
    --primary: #045687;
    --primary-dark: #0b2f4a;
    --accent: #2e9dd8;
    --accent-soft: #e6f3fb;
    --bg: #f5f9fc;
    --surface: #ffffff;
    --text: #14283c;
    --muted: #66798c;
    --border: #e3ecf3;
    --success: #16a34a;
    --danger: #dc2626;
    --shadow-xs: 0 1px 2px rgba(16, 35, 58, 0.05);
    --shadow-sm: 0 1px 3px rgba(16, 35, 58, 0.06), 0 2px 10px rgba(16, 35, 58, 0.05);
    --shadow-md: 0 14px 34px rgba(16, 35, 58, 0.12);
    --nav-h: 60px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 0 0 calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

/* Arabic typography */

html[lang="ar"] body,
html[lang="ar"] button,
html[lang="ar"] input {
    font-family: "Noto Sans Arabic", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html[dir="rtl"] .brand-name,
html[dir="rtl"] .brand-sub {
    letter-spacing: 0;
}

button,
input {
    font: inherit;
    color: inherit;
}

button {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(46, 157, 216, 0.4);
    outline-offset: 2px;
    border-radius: 8px;
}

a {
    color: var(--primary);
}

/* ---------- App shell ---------- */

.app-shell {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Header ---------- */

.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 54px;
    padding: 6px 2px;
    direction: ltr;
    background: rgba(245, 249, 252, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    text-align: start;
}

.brand-mark {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    color: #ffffff;
    background: linear-gradient(150deg, var(--primary), #0a6fa6);
    border-radius: 11px;
    box-shadow: var(--shadow-xs);
}

.brand-mark svg {
    width: 20px;
    height: 20px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.brand-name {
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--primary-dark);
}

.brand-sub {
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: 0.24em;
    color: #8b9bad;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 34px;
    padding: 0 11px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-xs);
    transition: background 0.2s ease, transform 0.15s ease;
}

.lang-toggle:active {
    transform: scale(0.96);
}

.lang-toggle svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--primary-dark);
    border-radius: 10px;
    transition: background 0.2s ease, transform 0.15s ease;
}

.icon-btn:active {
    transform: scale(0.92);
    background: var(--accent-soft);
}

.icon-btn svg {
    width: 21px;
    height: 21px;
}

/* ---------- Status pill ---------- */

.status-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    margin: 0 0 4px;
    padding: 4px 11px;
    white-space: nowrap;
    color: #0e7a3c;
    font-size: 11.5px;
    font-weight: 600;
    background: #e9f9ef;
    border: 1px solid rgba(22, 163, 74, 0.16);
    border-radius: 999px;
}

[dir="rtl"] .status-pill {
    direction: ltr;
    margin-inline-end: auto;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 3.5px rgba(22, 163, 74, 0.13);
    animation: statusPulse 2.4s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 0 3.5px rgba(22, 163, 74, 0.13); }
    50% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.05); }
}

/* ---------- Hero ---------- */

.hero {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 2px 2px;
}

.hero-text {
    flex: 1;
    min-width: 0;
}

#greeting {
    margin: 0;
    font-size: clamp(26px, 6.6vw, 38px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--primary-dark);
    white-space: nowrap;
}

.hero-sub {
    margin: 8px 0 0;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--muted);
    max-width: 320px;
}

.hero-visual {
    flex-shrink: 0;
    width: 112px;
    height: 112px;
    display: grid;
    place-items: center;
    margin-inline-start: auto;
}

.ai-orb {
    position: relative;
    width: 108px;
    height: 108px;
    animation: orbFloat 5s ease-in-out infinite;
}

.orb-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 6px 12px rgba(4, 86, 135, 0.11));
}

@keyframes orbFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
}

/* ---------- Section headings ---------- */

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 18px 2px 10px;
}

.section-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--primary-dark);
}

/* ---------- Quick actions ---------- */

.qa-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.qa-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
    min-height: 100px;
    padding: 12px 11px 10px;
    text-align: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: var(--shadow-xs);
    transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.qa-card:active {
    transform: scale(0.97);
}

.qa-card:hover {
    border-color: rgba(46, 157, 216, 0.4);
    box-shadow: var(--shadow-sm);
}

.qa-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
}

.qa-icon svg {
    width: 18px;
    height: 18px;
}

.qa-icon-blue { color: #155e96; background: #e3f1fb; }
.qa-icon-teal { color: #0d7a6b; background: #ddf4ed; }
.qa-icon-rose { color: #b3436e; background: #fde9f0; }
.qa-icon-violet { color: #6a57c9; background: #ece9fb; }
.qa-icon-amber { color: #a87a28; background: #fdf3d8; }
.qa-icon-green { color: #2e7d46; background: #e1f4e4; }

.qa-label {
    margin-top: auto;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
    overflow-wrap: break-word;
    word-break: normal;
    padding-inline-end: 10px;
}

.qa-chevron {
    position: absolute;
    inset-inline-end: 10px;
    bottom: 15px;
    color: #8fa4b5;
}

.qa-chevron svg {
    width: 14px;
    height: 14px;
}

/* ---------- Conversation ---------- */

#chat-view {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--nav-h) - 10px);
}

#chat-view .composer-wrap {
    margin-top: auto;
}

.clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 34px;
    padding: 0 9px;
    color: #0d74b8;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 9px;
    transition: color 0.2s ease, background 0.2s ease;
}

.clear-btn:hover {
    color: var(--danger);
    background: #fef2f2;
}

.clear-btn svg {
    width: 16px;
    height: 16px;
}

#chat-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 2px;
}

.chat-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 78%;
    animation: messageIn 0.24s ease;
}

.chat-row.ai {
    align-items: flex-start;
}

.chat-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.chat-row.user {
    align-self: flex-end;
}

.chat-row.user .chat-main {
    align-items: flex-end;
}

.chat-avatar {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    color: var(--primary);
    background: var(--accent-soft);
    border-radius: 50%;
}

.chat-avatar svg {
    width: 17px;
    height: 17px;
}

.chat-bubble {
    padding: 10px 13px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    border-radius: 17px;
}

.chat-row.ai .chat-bubble {
    color: #17394e;
    background: #eef5fb;
    border: 1px solid rgba(4, 86, 135, 0.07);
    border-start-start-radius: 5px;
}

.chat-row.user .chat-bubble {
    color: #ffffff;
    text-align: start;
    background: linear-gradient(150deg, var(--primary), #0a6fa6);
    border-end-end-radius: 5px;
    box-shadow: 0 5px 14px rgba(4, 86, 135, 0.2);
}

.chat-row.error .chat-bubble {
    color: #9f1d1d;
    background: #fef2f2;
    border-color: rgba(220, 38, 38, 0.18);
}

.chat-time {
    font-size: 10.5px;
    color: #a7b6c3;
}

/* Typing indicator */

.typing .chat-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 14px 16px;
}

.typing .chat-bubble i {
    width: 7px;
    height: 7px;
    background: #8db6d2;
    border-radius: 50%;
    animation: typingBounce 1.2s ease-in-out infinite;
}

.typing .chat-bubble i:nth-child(2) { animation-delay: 0.15s; }
.typing .chat-bubble i:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Composer ---------- */

.composer-wrap {
    position: sticky;
    bottom: calc(var(--nav-h) + 10px);
    z-index: 30;
    margin-top: 14px;
}

.voice-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto 8px;
    padding: 9px 14px;
    background: var(--surface);
    border: 1px solid rgba(220, 38, 38, 0.22);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    animation: messageIn 0.2s ease;
}

.wave {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 18px;
}

.wave i {
    width: 3.5px;
    height: 100%;
    background: var(--danger);
    border-radius: 2px;
    animation: waveBar 0.9s ease-in-out infinite;
}

.wave i:nth-child(2) { animation-delay: 0.12s; }
.wave i:nth-child(3) { animation-delay: 0.24s; }
.wave i:nth-child(4) { animation-delay: 0.36s; }

@keyframes waveBar {
    0%, 100% { transform: scaleY(0.35); }
    50% { transform: scaleY(1); }
}

.voice-status {
    flex: 1;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

.voice-stop {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    color: #ffffff;
    background: var(--danger);
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.voice-stop:active {
    transform: scale(0.9);
}

.voice-stop svg {
    width: 13px;
    height: 13px;
}

.composer {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 560px;
    margin: 0 auto;
    padding: 6px;
    background: var(--surface);
    border: 1px solid #dbe7f0;
    border-radius: 999px;
    box-shadow: 0 6px 22px rgba(16, 35, 58, 0.09);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer:focus-within {
    border-color: rgba(46, 157, 216, 0.55);
    box-shadow: 0 6px 22px rgba(16, 35, 58, 0.1), 0 0 0 4px rgba(46, 157, 216, 0.12);
}

#user-input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 10px;
    font-size: 15px;
    background: transparent;
    border: none;
    outline: none;
}

#user-input::placeholder {
    color: #9db0bf;
}

#user-input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.composer-mic,
.composer-send {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 50%;
    transition: transform 0.15s ease, background 0.2s ease;
}

.composer-mic:active,
.composer-send:active {
    transform: scale(0.92);
}

.composer-mic {
    width: 38px;
    height: 38px;
    color: var(--primary);
    background: var(--accent-soft);
}

.composer-mic svg {
    width: 18px;
    height: 18px;
}

.composer-mic .stop-ico {
    display: none;
}

.composer-mic.voice-active {
    color: #ffffff;
    background: var(--danger);
    animation: micPulse 1.6s ease-in-out infinite;
}

.composer-mic.voice-active .mic-ico {
    display: none;
}

.composer-mic.voice-active .stop-ico {
    display: block;
}

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
    50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0.08); }
}

.composer-send {
    width: 40px;
    height: 40px;
    color: #ffffff;
    background: linear-gradient(150deg, var(--primary), #0a6fa6);
    box-shadow: 0 5px 12px rgba(4, 86, 135, 0.28);
}

.composer-send:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.composer-send svg {
    width: 17px;
    height: 17px;
}

/* ---------- Bottom navigation ---------- */

.bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: var(--nav-h);
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 44px;
    color: #8da2b4;
    font-size: 10px;
    font-weight: 600;
    border-radius: 12px;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-item svg {
    width: 21px;
    height: 21px;
}

.nav-item.active {
    color: var(--primary);
    background: var(--accent-soft);
}

/* ---------- Views (Services / Doctors / About) ---------- */

.view {
    animation: viewIn 0.22s ease;
}

.view[hidden] {
    display: none;
}

@keyframes viewIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.view-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 2px 4px;
}

.view-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-dark);
}

.back-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-xs);
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

.view-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 0 10px;
}

.info-card {
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-xs);
}

.info-card h3 {
    margin: 0 0 6px;
    font-size: 15.5px;
    font-weight: 700;
    color: var(--primary-dark);
}

.info-card p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted);
}

.info-card .card-sub {
    margin-top: 8px;
    font-size: 13px;
}

.doctors-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.doctor-card {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: var(--shadow-xs);
}

.doctor-avatar {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    color: var(--primary);
    background: var(--accent-soft);
    border-radius: 50%;
}

.doctor-avatar svg {
    width: 22px;
    height: 22px;
}

.doctor-name {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
}

.doctor-spec {
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 2px;
    border-bottom: 1px solid var(--border);
}

.contact-row:last-child {
    border-bottom: none;
}

.contact-row svg {
    flex-shrink: 0;
    width: 19px;
    height: 19px;
    color: var(--primary);
}

.contact-row a {
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none;
}

.contact-row a:hover {
    text-decoration: underline;
}

.contact-label {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hours-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
    margin-top: 10px;
}

.hours-grid .day {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 0;
    font-size: 13.5px;
    border-bottom: 1px dashed var(--border);
}

.hours-grid .day b {
    font-weight: 600;
    color: var(--text);
}

.hours-grid .day span {
    color: var(--muted);
    text-align: end;
}

.retry-btn {
    min-height: 42px;
    padding: 0 20px;
    color: var(--primary);
    font-weight: 700;
    background: var(--accent-soft);
    border-radius: 12px;
    align-self: center;
}

.skeleton-row {
    height: 74px;
    background: linear-gradient(100deg, #eef3f7 40%, #f7fafc 50%, #eef3f7 60%);
    background-size: 200% 100%;
    border-radius: 15px;
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    to { background-position: -200% 0; }
}

/* ---------- Page hero (sub-screens) ---------- */

.page-hero {
    padding: 6px 2px 2px;
}

.page-hero h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--primary-dark);
}

.page-hero p {
    margin: 5px 0 0;
    font-size: 13.5px;
    color: var(--muted);
}

/* ---------- Service cards ---------- */

.service-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.service-card {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 14px;
    text-align: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-xs);
    transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.service-card:active {
    transform: scale(0.985);
}

.service-card:hover {
    border-color: rgba(46, 157, 216, 0.4);
    box-shadow: var(--shadow-sm);
}

.service-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    color: var(--primary);
    background: var(--accent-soft);
    border-radius: 13px;
}

.service-icon svg {
    width: 22px;
    height: 22px;
}

.service-main {
    flex: 1;
    min-width: 0;
}

.service-name {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
}

.service-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 3px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--muted);
}

.service-arrow {
    flex-shrink: 0;
    color: #b7c6d2;
}

.service-arrow svg {
    width: 16px;
    height: 16px;
}

[dir="rtl"] .service-arrow svg {
    transform: rotate(180deg);
}

/* ---------- Service detail ---------- */

.detail-hero {
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-xs);
}

.detail-hero h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: var(--primary-dark);
}

.detail-hero p {
    margin: 7px 0 0;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--muted);
}

.detail-section-title {
    margin: 16px 4px 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.treatment-row {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
    box-shadow: var(--shadow-xs);
}

.treatment-row + .treatment-row {
    margin-top: 8px;
}

.treatment-row .dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-top: 7px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.55;
}

.treatment-row span {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text);
}

.detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}

/* ---------- Buttons ---------- */

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 46px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 13px;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary:active,
.btn-secondary:active {
    transform: scale(0.97);
}

.btn-primary {
    color: #ffffff;
    background: linear-gradient(150deg, var(--primary), #0a6fa6);
    box-shadow: 0 6px 14px rgba(4, 86, 135, 0.25);
}

.btn-secondary {
    color: var(--primary);
    background: var(--accent-soft);
}

.btn-secondary .ai-spark {
    color: #7a5af8;
}

.btn-primary svg,
.btn-secondary svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

.detail-actions .btn-primary,
.detail-actions .btn-secondary {
    width: 100%;
}

/* ---------- Doctor search + filters ---------- */

.search-box {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 14px 0 10px;
    padding: 0 14px;
    height: 46px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-xs);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
    border-color: rgba(46, 157, 216, 0.55);
    box-shadow: 0 0 0 4px rgba(46, 157, 216, 0.12);
}

.search-box svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #9db0bf;
}

.search-box input {
    flex: 1;
    min-width: 0;
    height: 100%;
    font-size: 14px;
    background: transparent;
    border: none;
    outline: none;
}

.search-box input::placeholder {
    color: #9db0bf;
}

.search-box input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.filter-chips {
    display: flex;
    gap: 8px;
    margin: 0 0 4px;
    padding: 2px 0 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    flex-shrink: 0;
    min-height: 34px;
    padding: 0 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.chip.active {
    color: #ffffff;
    background: var(--primary);
    border-color: var(--primary);
}

/* ---------- Doctor cards (directory) ---------- */

.doctor-card {
    padding: 13px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-xs);
}

.doctor-top {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: start;
}

.doctor-avatar {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    color: var(--primary);
    background: var(--accent-soft);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.doctor-info {
    flex: 1;
    min-width: 0;
}

.doctor-name {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
}

.doctor-spec {
    margin-top: 2px;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--muted);
}

.doctor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.doctor-actions .btn-primary,
.doctor-actions .btn-secondary {
    min-height: 40px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 11px;
}

/* ---------- Doctor profile ---------- */

.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 22px 16px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-xs);
}

.profile-card .doctor-avatar {
    width: 76px;
    height: 76px;
    font-size: 22px;
}

.profile-card .doctor-name {
    margin-top: 12px;
    font-size: 17px;
}

.profile-card .doctor-spec {
    font-size: 13.5px;
}

.profile-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- Empty state ---------- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 34px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state svg {
    width: 40px;
    height: 40px;
    margin-bottom: 4px;
    color: #b9c9d6;
}

.empty-state strong {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
}

.empty-state span {
    font-size: 13px;
}

/* ---------- About ---------- */

.about-section-title {
    margin: 18px 4px 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dept-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dept-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 13px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary);
    background: var(--accent-soft);
    border-radius: 999px;
    transition: transform 0.15s ease;
}

.dept-chip:active {
    transform: scale(0.96);
}

.contact-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.contact-actions .btn-primary,
.contact-actions .btn-secondary {
    width: 100%;
    min-height: 44px;
    font-size: 13.5px;
}

.location-card {
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-xs);
}

.location-card .address-line {
    display: flex;
    gap: 10px;
    margin: 10px 0 14px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text);
}

.location-card .address-line svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    color: var(--primary);
}

/* ---------- Sheet / menu ---------- */

.voice-indicator[hidden],
.menu-sheet[hidden],
.sheet-backdrop[hidden] {
    display: none !important;
}

.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(10, 25, 40, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.menu-sheet {
    position: fixed;
    top: calc(54px + env(safe-area-inset-top, 0px));
    right: 16px;
    left: auto;
    z-index: 61;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 230px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    animation: viewIn 0.16s ease;
}

.sheet-item {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 46px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    border-radius: 10px;
    transition: background 0.15s ease;
}

.sheet-item:hover {
    background: var(--accent-soft);
}

.sheet-item svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

/* ---------- Developer credit (About view only) ---------- */

.dev-credit {
    margin-top: 18px;
    padding-top: 12px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    border-top: 1px solid var(--border);
}

.dev-credit a {
    font-weight: 700;
    text-decoration: none;
}

/* ---------- RTL icon mirroring ---------- */

[dir="rtl"] .qa-chevron svg,
[dir="rtl"] .back-btn svg {
    transform: rotate(180deg);
}

[dir="rtl"] .composer-send svg {
    transform: scaleX(-1);
}

/* ---------- Desktop ---------- */

@media (min-width: 880px) {
    body {
        padding-bottom: calc(var(--nav-h) + 30px + env(safe-area-inset-bottom, 0px));
    }

    .app-shell {
        padding: 0 32px 30px;
    }

    .app-header {
        min-height: 64px;
        padding: 8px 6px;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }

    .brand-name {
        font-size: 14.5px;
    }

    .brand-sub {
        font-size: 9.5px;
    }

    .hero {
        gap: 30px;
        padding: 24px 6px 14px;
    }

    .hero-visual {
        width: 230px;
        height: 230px;
    }

    .ai-orb {
        width: 200px;
        height: 200px;
    }

    #greeting {
        font-size: clamp(36px, 4.2vw, 46px);
        white-space: normal;
    }

    .hero-sub {
        font-size: 17px;
        max-width: 460px;
    }

    .qa-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 12px;
    }

    .qa-card {
        min-height: 104px;
        padding: 13px 12px;
    }

    .qa-label {
        font-size: 12.5px;
    }

    .section-head {
        margin-top: 28px;
    }

    .chat-row {
        max-width: 620px;
    }

    .view-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }

    #service-detail-body,
    #doctor-profile-body {
        display: flex;
        flex-direction: column;
    }

    #service-detail-body .detail-actions,
    #doctor-profile-body .detail-actions {
        max-width: 420px;
        width: 100%;
    }

    #doctor-profile-body #doc-ask {
        max-width: 420px;
        width: 100%;
    }

    .doctors-list {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .bottom-nav {
        inset-inline: 0;
        width: min(480px, 90vw);
        margin: 0 auto;
        bottom: 18px;
        border: 1px solid var(--border);
        border-radius: 20px;
        box-shadow: 0 18px 44px rgba(16, 35, 58, 0.16);
    }
}

/* ---------- Small phones (<=340px): 2-column quick actions ---------- */

@media (max-width: 340px) {
    .qa-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-visual {
        width: 88px;
        height: 88px;
    }

    .ai-orb {
        width: 82px;
        height: 82px;
    }

    #greeting {
        white-space: normal;
    }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
