/* =========================================================
   HealthKey Design System
   Estetica: Clinica moderna — bianco chirurgico, verde tenue,
   tipografia editoriale DM Serif / DM Sans
   ========================================================= */

:root {
    --hk-white:       #FAFAF8;
    --hk-black:       #0F0F0E;
    --hk-green:       #2D6A4F;
    --hk-green-light: #52B788;
    --hk-green-pale:  #D8F3DC;
    --hk-gray-100:    #F4F4F0;
    --hk-gray-200:    #E8E8E2;
    --hk-gray-400:    #9E9E94;
    --hk-gray-700:    #3D3D38;
    --hk-red:         #C0392B;
    --hk-amber:       #D4870A;

    --hk-font-display: 'DM Serif Display', Georgia, serif;
    --hk-font-body:    'DM Sans', system-ui, sans-serif;

    --hk-radius:      8px;
    --hk-radius-lg:   16px;
    --hk-shadow:      0 1px 3px rgba(15,15,14,.08), 0 4px 12px rgba(15,15,14,.06);
    --hk-shadow-lg:   0 8px 32px rgba(15,15,14,.12);

    --hk-transition:  160ms cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    background: var(--hk-white);
    color: var(--hk-black);
    font-family: var(--hk-font-body);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Splash screen ─────────────────────────────────────── */
.hk-splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
}
.hk-splash__mark {
    font-family: var(--hk-font-display);
    font-size: 48px;
    color: var(--hk-green);
    letter-spacing: -2px;
}
.hk-splash__label {
    color: var(--hk-gray-400);
    font-size: 13px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* ── Layout shell ──────────────────────────────────────── */
.hk-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
    transition: grid-template-columns .2s ease;
}
.hk-shell--collapsed {
    grid-template-columns: 60px 1fr;
}
.hk-shell__sidebar {
    background: var(--hk-black);
    color: var(--hk-white);
    display: flex;
    flex-direction: column;
    padding: 32px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.hk-shell__main {
    background: var(--hk-gray-100);
    min-height: 100vh;
    overflow-y: auto;
}

/* ── Pulsante riduci/espandi sidebar ───────────────────── */
.hk-sidebar-toggle {
    background: rgba(255,255,255,.06);
    border: none;
    color: rgba(255,255,255,.5);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin: -16px 24px 20px;
    transition: background var(--hk-transition), color var(--hk-transition);
}
.hk-sidebar-toggle:hover {
    background: rgba(255,255,255,.12);
    color: var(--hk-white);
}
.hk-shell--collapsed .hk-sidebar-toggle {
    margin: -16px auto 20px;
}

/* Sidebar collassata: nasconde le sezioni e tronca il testo delle voci
   (nessuna modifica al markup delle singole NavLink — il testo semplice
   dopo l'icona viene semplicemente tagliato dall'overflow nascosto) */
.hk-shell--collapsed .hk-nav__section,
.hk-shell--collapsed .hk-logo__sub {
    display: none;
}
.hk-shell--collapsed .hk-logo {
    text-align: center;
    padding: 0 0 12px;
}
.hk-shell--collapsed .hk-logo__mark {
    font-size: 0;
}
.hk-shell--collapsed .hk-logo__mark::after {
    content: "HK";
    font-size: 20px;
}
.hk-shell--collapsed .hk-nav__item {
    overflow: hidden;
    white-space: nowrap;
    padding-left: 22px;
}
.hk-shell--collapsed .hk-nav__item.active {
    border-right: none;
}

/* ── Sidebar logo ──────────────────────────────────────── */
.hk-logo {
    padding: 0 24px 32px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 24px;
}
.hk-logo__mark {
    font-family: var(--hk-font-display);
    font-size: 28px;
    letter-spacing: -1px;
    color: var(--hk-green-light);
}
.hk-logo__sub {
    font-size: 11px;
    color: rgba(255,255,255,.35);
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-top: 2px;
}

/* ── Nav ───────────────────────────────────────────────── */
.hk-nav { flex: 1; }
.hk-nav__section {
    padding: 8px 24px 4px;
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.25);
    margin-top: 16px;
}
.hk-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 24px;
    color: rgba(255,255,255,.6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: background var(--hk-transition), color var(--hk-transition);
    border-radius: 0;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}
.hk-nav__item:hover {
    background: rgba(255,255,255,.06);
    color: var(--hk-white);
}
.hk-nav__item.active {
    background: rgba(82,183,136,.15);
    color: var(--hk-green-light);
    border-right: 3px solid var(--hk-green-light);
}
.hk-nav__icon { width: 20px; display: inline-block; text-align: center; font-size: 14px; flex-shrink: 0; }

/* ── Page header ───────────────────────────────────────── */
.hk-page {
    padding: 40px 48px;
    max-width: 1200px;
}
.hk-page__header {
    margin-bottom: 32px;
}
.hk-page__title {
    font-family: var(--hk-font-display);
    font-size: 32px;
    font-weight: 400;
    color: var(--hk-black);
    letter-spacing: -.5px;
    line-height: 1.2;
}
.hk-page__sub {
    color: var(--hk-gray-400);
    font-size: 14px;
    margin-top: 6px;
}

/* ── Cards ─────────────────────────────────────────────── */
.hk-card {
    background: var(--hk-white);
    border-radius: var(--hk-radius-lg);
    box-shadow: var(--hk-shadow);
    padding: 24px;
}
.hk-card--flat {
    box-shadow: none;
    border: 1px solid var(--hk-gray-200);
}

/* ── Forms ─────────────────────────────────────────────── */
.hk-field { margin-bottom: 20px; }
.hk-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--hk-gray-700);
    margin-bottom: 6px;
}
.hk-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--hk-gray-200);
    border-radius: var(--hk-radius);
    background: var(--hk-white);
    font-family: var(--hk-font-body);
    font-size: 14px;
    color: var(--hk-black);
    transition: border-color var(--hk-transition), box-shadow var(--hk-transition);
    outline: none;
}
.hk-input:focus {
    border-color: var(--hk-green);
    box-shadow: 0 0 0 3px rgba(45,106,79,.12);
}
.hk-input.error { border-color: var(--hk-red); }
.hk-hint {
    font-size: 12px;
    color: var(--hk-gray-400);
    margin-top: 4px;
}
.hk-error-msg {
    font-size: 12px;
    color: var(--hk-red);
    margin-top: 4px;
}

/* ── Buttons ───────────────────────────────────────────── */
.hk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--hk-radius);
    font-family: var(--hk-font-body);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--hk-transition);
    text-decoration: none;
    white-space: nowrap;
}
.hk-btn--primary {
    background: var(--hk-green);
    color: var(--hk-white);
}
.hk-btn--primary:hover { background: #255c43; }
.hk-btn--primary:disabled { opacity: .5; cursor: not-allowed; }
.hk-btn--outline {
    background: transparent;
    color: var(--hk-green);
    border: 1.5px solid var(--hk-green);
}
.hk-btn--outline:hover { background: var(--hk-green-pale); }
.hk-btn--ghost {
    background: transparent;
    color: var(--hk-gray-700);
}
.hk-btn--ghost:hover { background: var(--hk-gray-100); }
.hk-btn--danger {
    background: var(--hk-red);
    color: white;
}
.hk-btn--sm { padding: 6px 14px; font-size: 13px; }
.hk-btn--full { width: 100%; }
.hk-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Badges / Status ───────────────────────────────────── */
.hk-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
}
.hk-badge--green  { background: var(--hk-green-pale);  color: var(--hk-green); }
.hk-badge--amber  { background: #FEF3C7; color: #92400E; }
.hk-badge--gray   { background: var(--hk-gray-200);    color: var(--hk-gray-700); }
.hk-badge--red    { background: #FEE2E2; color: var(--hk-red); }

/* ── Table ─────────────────────────────────────────────── */
.hk-table-wrap { overflow-x: auto; }
.hk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.hk-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--hk-gray-400);
    border-bottom: 1px solid var(--hk-gray-200);
}
.hk-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--hk-gray-100);
    color: var(--hk-gray-700);
}
.hk-table tr:last-child td { border-bottom: none; }
.hk-table tr:hover td { background: var(--hk-gray-100); }

/* ── Alerts ────────────────────────────────────────────── */
.hk-alert {
    padding: 12px 16px;
    border-radius: var(--hk-radius);
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.hk-alert--error   { background: #FEE2E2; color: #7F1D1D; border-left: 3px solid var(--hk-red); }
.hk-alert--success { background: var(--hk-green-pale); color: #1B4332; border-left: 3px solid var(--hk-green); }
.hk-alert--info    { background: #EFF6FF; color: #1E3A5F; border-left: 3px solid #3B82F6; }
.hk-alert--warning { background: #FEF3C7; color: #78350F; border-left: 3px solid var(--hk-amber); }

/* ── Auth pages (login, registrazione) ─────────────────── */
.hk-auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 480px;
}
.hk-auth__panel {
    background: var(--hk-black);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    position: relative;
    overflow: hidden;
}
.hk-auth__panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 20% 80%, rgba(45,106,79,.35) 0%, transparent 70%);
    pointer-events: none;
}
.hk-auth__panel-logo {
    font-family: var(--hk-font-display);
    font-size: 40px;
    color: var(--hk-white);
    letter-spacing: -2px;
    position: relative;
}
.hk-auth__panel-logo span { color: var(--hk-green-light); }
.hk-auth__panel-claim {
    position: relative;
    font-family: var(--hk-font-display);
    font-size: 42px;
    line-height: 1.15;
    color: var(--hk-white);
    opacity: .9;
}
.hk-auth__panel-claim em {
    font-style: italic;
    color: var(--hk-green-light);
}
.hk-auth__panel-foot {
    position: relative;
    font-size: 12px;
    color: rgba(255,255,255,.3);
    letter-spacing: .04em;
}
/* ── Download app mobile — QR nel pannello nero ────────── */
.hk-auth__panel-app {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}
.hk-auth__panel-app-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.45);
}
.hk-auth__panel-app-qr {
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid rgba(255,255,255,.15);
    line-height: 0;        /* rimuove gap sotto l'img */
    display: inline-block;
}
.hk-auth__panel-app-hint {
    font-size: 11px;
    color: rgba(255,255,255,.35);
    line-height: 1.5;
}
.hk-auth__form {
    background: var(--hk-white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}
.hk-auth__box { width: 100%; max-width: 360px; }
.hk-auth__title {
    font-family: var(--hk-font-display);
    font-size: 28px;
    letter-spacing: -.5px;
    margin-bottom: 6px;
}
.hk-auth__sub {
    color: var(--hk-gray-400);
    font-size: 14px;
    margin-bottom: 32px;
}
.hk-auth__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--hk-gray-400);
    font-size: 12px;
}
.hk-auth__divider::before,
.hk-auth__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--hk-gray-200);
}

/* ── Grid utilities ────────────────────────────────────── */
.hk-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hk-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.hk-flex   { display: flex; gap: 12px; align-items: center; }
.hk-flex--between { justify-content: space-between; }
.hk-mt-8  { margin-top: 8px; }
.hk-mt-16 { margin-top: 16px; }
.hk-mt-24 { margin-top: 24px; }
.hk-mt-32 { margin-top: 32px; }

/* ── KPI stat cards ────────────────────────────────────── */
.hk-stat {
    background: var(--hk-white);
    border-radius: var(--hk-radius-lg);
    padding: 24px;
    box-shadow: var(--hk-shadow);
}
.hk-stat__label {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--hk-gray-400);
    margin-bottom: 8px;
}
.hk-stat__value {
    font-family: var(--hk-font-display);
    font-size: 36px;
    letter-spacing: -1px;
    color: var(--hk-black);
    line-height: 1;
}
.hk-stat__delta {
    font-size: 12px;
    margin-top: 6px;
    color: var(--hk-green);
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hk-animate { animation: fadeInUp .3s ease both; }
.hk-animate--d1 { animation-delay: .05s; }
.hk-animate--d2 { animation-delay: .10s; }
.hk-animate--d3 { animation-delay: .15s; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .hk-auth { grid-template-columns: 1fr; }
    .hk-auth__panel { display: none; }
    .hk-shell { grid-template-columns: 1fr; }
    .hk-shell__sidebar { display: none; }
    .hk-page { padding: 24px 16px; }
}

/* ── Blazor error UI ────────────────────────────────────── */
#blazor-error-ui {
    background: #FEE2E2;
    bottom: 0; left: 0; right: 0;
    position: fixed;
    padding: 12px 16px;
    display: none;
    font-size: 13px;
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ── Stati appuntamento agenda ──────────────────────────── */
.hk-stato--prenotato  { background: #C8DCFA; color: #1A73E8; }
.hk-stato--confermato { background: #B8F0CE; color: #0F7A38; }
.hk-stato--in-attesa  { background: #FAEDB0; color: #A07800; }
.hk-stato--in-sala    { background: #FAD9B0; color: #C05000; }
.hk-stato--in-visita  { background: #DDD0F5; color: #5E3AA8; }
.hk-stato--concluso   { background: #DCDCDC; color: #444444; }
.hk-stato--annullato  { background: #F5C0BC; color: #B52020; }

/* Barra laterale appuntamento per stato (usata in agenda) */
.hk-appt--prenotato  { border-left: 4px solid #1A73E8 !important; }
.hk-appt--confermato { border-left: 4px solid #1DB954 !important; }
.hk-appt--in-attesa  { border-left: 4px solid #F4B400 !important; }
.hk-appt--in-sala    { border-left: 4px solid #F28C28 !important; }
.hk-appt--in-visita  { border-left: 4px solid #7E57C2 !important; }
.hk-appt--concluso   { border-left: 4px solid #666666 !important; opacity: 0.7; }
.hk-appt--annullato  { border-left: 4px solid #D93025 !important; opacity: 0.5; text-decoration: line-through; }
