/* ============================================================
   Clinic — global styles + branded SweetAlert theme
   ============================================================ */
:root {
    --app-primary: #0ea5a4;
    --app-primary-dark: #0b8281;
    --app-primary-light: #5eead4;
    --app-ink: #0f172a;
    --app-muted: #64748b;
    --app-bg: #f1f5f9;
    --app-radius: 18px;
    --app-shadow: 0 20px 45px -20px rgba(15, 23, 42, 0.45);
}

body {
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--app-ink);
}

/* ---------- Auth / login layout ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(94, 234, 212, 0.35), transparent 60%),
        radial-gradient(1000px 500px at 110% 110%, rgba(14, 165, 164, 0.35), transparent 55%),
        linear-gradient(135deg, #0f766e 0%, #0ea5a4 45%, #22d3ee 100%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
    padding: 2.25rem 2rem;
    animation: auth-pop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes auth-pop {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.4rem;
}

.auth-brand__logo {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark));
    box-shadow: 0 8px 20px -8px var(--app-primary);
}

.auth-brand__name {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.auth-title { font-weight: 600; font-size: 1.15rem; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--app-muted); font-size: 0.9rem; margin-bottom: 1.4rem; }

.auth-card .form-label { font-weight: 500; font-size: 0.85rem; color: var(--app-muted); }

.auth-card .input-group-text,
.auth-card .form-control {
    border-radius: 12px;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}
.auth-card .input-group .input-group-text { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.auth-card .input-group .form-control { border-top-left-radius: 0; border-bottom-left-radius: 0; }

.auth-card .form-control:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 0.2rem rgba(14, 165, 164, 0.2);
}

.btn-app {
    width: 100%;
    border: 0;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark));
    box-shadow: 0 12px 22px -12px var(--app-primary-dark);
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.btn-app:hover { transform: translateY(-1px); color: #fff; }
.btn-app:active { transform: translateY(0); }
.btn-app:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-link { color: var(--app-primary-dark); font-weight: 500; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

.step { display: none; }
.step.is-active { display: block; animation: step-in 0.35s ease; }
@keyframes step-in {
    from { opacity: 0; transform: translateX(12px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---------- Branded SweetAlert2 ---------- */
.app-swal {
    border-radius: var(--app-radius) !important;
    padding: 1.75rem 1.5rem 1.5rem !important;
    box-shadow: var(--app-shadow) !important;
    font-family: inherit;
}
.app-swal__title { font-weight: 700 !important; color: var(--app-ink) !important; font-size: 1.3rem !important; }
.app-swal__text { color: var(--app-muted) !important; font-size: 0.95rem !important; }

.app-swal__actions { gap: 0.6rem; margin-top: 1.25rem !important; }

.app-swal__btn {
    border: 0;
    border-radius: 12px;
    padding: 0.62rem 1.4rem;
    font-weight: 600;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.app-swal__btn:hover { transform: translateY(-1px); }
.app-swal__btn--confirm {
    color: #fff;
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark));
    box-shadow: 0 12px 22px -12px var(--app-primary-dark);
}
.app-swal__btn--cancel { color: var(--app-ink); background: #e2e8f0; }
.app-swal__btn--cancel:hover { background: #cbd5e1; }

.app-swal__icon { border-width: 3px !important; }

.app-swal--show { animation: auth-pop 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.app-swal--hide { animation: swal-out 0.2s ease forwards; }
@keyframes swal-out { to { opacity: 0; transform: scale(0.96); } }

/* Toast variant */
.app-toast {
    border-radius: 14px !important;
    box-shadow: var(--app-shadow) !important;
    font-family: inherit;
}
.app-toast__title { font-weight: 600 !important; font-size: 0.92rem !important; }

/* ============================================================
   Admin shell (sidebar layout)
   ============================================================ */
:root { --admin-sidebar-w: 260px; }

.admin-shell { min-height: 100vh; background: var(--app-bg); }

.admin-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--admin-sidebar-w);
    background: linear-gradient(180deg, #0f766e 0%, #0b8281 100%);
    color: #e2fbf7;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.25s ease;
}

.admin-sidebar__brand {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 0.6rem;
    padding: 0.25rem 0.5rem 1.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.admin-sidebar__logo {
    grid-row: 1 / 3;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff; font-size: 1.3rem; font-weight: 700;
}
.admin-sidebar__name { font-weight: 700; font-size: 1.15rem; color: #fff; }
.admin-sidebar__role { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.75; }

.admin-nav {
    display: flex; flex-direction: column; gap: 0.25rem;
    flex: 1; overflow-y: auto; overflow-x: hidden;
    margin: 0 -0.35rem; padding: 0 0.35rem;
}
/* Slim scrollbar inside the dark sidebar */
.admin-nav::-webkit-scrollbar { width: 6px; }
.admin-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.25); border-radius: 3px; }

.admin-nav__link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    color: #d7f5f0;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}
.admin-nav__link i { font-size: 1.05rem; }
.admin-nav__link:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.admin-nav__link.is-active { background: #fff; color: var(--app-primary-dark); box-shadow: 0 10px 20px -12px rgba(0,0,0,0.5); }

/* Collapsible group toggle */
.admin-nav__toggle {
    width: 100%; border: 0; background: transparent; text-align: left;
    font: inherit; font-weight: 500; cursor: pointer;
}
.admin-nav__caret { margin-left: auto; font-size: 0.8rem !important; transition: transform 0.2s ease; }
.admin-nav__toggle[aria-expanded="true"] { background: rgba(255, 255, 255, 0.12); color: #fff; }
.admin-nav__toggle[aria-expanded="true"] .admin-nav__caret { transform: rotate(180deg); }

/* Submenu */
.admin-submenu { padding: 0.25rem 0 0.35rem 0.4rem; margin: 0.15rem 0 0.25rem 0.9rem; border-left: 1px solid rgba(255, 255, 255, 0.15); }
.admin-submenu__label {
    display: block; padding: 0.5rem 0.6rem 0.2rem;
    font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em;
    opacity: 0.55; font-weight: 600;
}
.admin-submenu__link {
    display: block; padding: 0.42rem 0.6rem; border-radius: 9px;
    color: #cdeee9; text-decoration: none; font-size: 0.88rem;
    transition: background 0.15s ease, color 0.15s ease;
}
.admin-submenu__link:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.admin-submenu__link.is-active { background: #fff; color: var(--app-primary-dark); font-weight: 600; }

.admin-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1035;
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s ease;
}
.admin-backdrop.is-visible { opacity: 1; visibility: visible; }

.admin-main { margin-left: var(--admin-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.admin-topbar {
    position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: 1rem;
    background: #fff;
    padding: 0.85rem 1.5rem;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}
.admin-topbar__toggle {
    display: none;
    border: 0; background: transparent; font-size: 1.4rem; color: var(--app-ink); cursor: pointer;
}
.admin-topbar__title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.admin-topbar__user { margin-left: auto; }

.admin-user {
    display: flex; align-items: center; gap: 0.55rem;
    border: 0; background: transparent; cursor: pointer;
    padding: 0.25rem 0.4rem; border-radius: 10px;
}
.admin-user:hover { background: var(--app-bg); }
.admin-user__avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark));
    color: #fff; font-weight: 600;
}
.admin-user__name { font-weight: 500; font-size: 0.92rem; }

.admin-content { padding: 1.5rem; flex: 1; }

/* Cards */
.stat-card {
    display: flex; align-items: center; gap: 1rem;
    background: #fff; border-radius: 16px; padding: 1.1rem 1.25rem;
    box-shadow: 0 12px 30px -22px rgba(15, 23, 42, 0.4);
}
.stat-card__icon {
    width: 48px; height: 48px; border-radius: 12px; flex: none;
    display: grid; place-items: center; font-size: 1.35rem;
    color: var(--c, var(--app-primary));
    background: color-mix(in srgb, var(--c, var(--app-primary)) 14%, #fff);
}
.stat-card__value { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-card__label { color: var(--app-muted); font-size: 0.85rem; }

.content-card {
    background: #fff; border-radius: 16px; padding: 1.25rem 1.5rem;
    box-shadow: 0 12px 30px -22px rgba(15, 23, 42, 0.4);
}

/* Responsive: collapse sidebar under lg */
@media (max-width: 991.98px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.is-open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .admin-topbar__toggle { display: inline-flex; }
}

/* Sidebar brand with an uploaded wordmark logo */
.admin-sidebar__brand--logo { display: block; }
.admin-sidebar__brand--logo img { display: block; width: 100%; max-height: 64px; object-fit: contain; object-position: left center; }
.admin-sidebar__brand--logo .admin-sidebar__role { display: block; margin-top: 0.5rem; }

/* Login: patient verifies on WhatsApp */
.wa-box { text-align: center; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 1rem; }
.wa-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.9rem; font-weight: 700; letter-spacing: 0.12em; color: var(--app-ink); margin-bottom: 0.85rem;
}
.btn-wa {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    width: 100%; padding: 0.75rem 1rem; border-radius: 12px;
    background: #25D366; color: #fff; font-weight: 600; text-decoration: none;
    transition: transform 0.15s ease, background 0.15s ease;
}
.btn-wa:hover { background: #1ebe5b; color: #fff; transform: translateY(-1px); }
.btn-wa i { font-size: 1.2rem; }
.wa-qr { display: inline-block; padding: 8px; background: #fff; border-radius: 10px; border: 1px solid #e2e8f0; }
.wa-qr img, .wa-qr canvas { display: block; }
.wa-status { margin-top: 0.85rem; font-size: 0.9rem; color: var(--app-muted); display: flex; align-items: center; justify-content: center; }
.wa-status.is-expired { color: #b45309; }
