/* ═══════════════════════════════════════════════════════════════
   İyilik Hali — Hasta Portalı Tema
   Orijinal GAS tasarımına birebir sadık — mobil öncelikli PWA
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* İyilik Hali "moss" paleti (SvelteKit teması ile birebir) */
    --portal-primary: #3D5A3D;        /* ih-500 */
    --portal-primary-dark: #344F34;   /* ih-600 */
    --portal-primary-light: #E4ECE0;  /* ih-100 */
    --portal-bg: #F5F1EA;             /* zemin */
    --portal-card: #FAF7F0;           /* yüzey */
    --portal-text: #1C1F19;           /* metin */
    --portal-text-secondary: #6A6458; /* soluk */
    --portal-text-muted: #9A917F;
    --portal-border: #D9D1BF;         /* çizgi */
    --portal-success: #38A169;
    --portal-warning: #DD6B20;
    --portal-danger: #A83E2C;         /* alert */
    --portal-info: #3182CE;
    --portal-shadow: 0 1px 2px rgba(28,31,25,0.05);
}

body {
    font-family: 'Public Sans', 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--portal-bg);
    color: var(--portal-text);
    margin: 0;
    font-size: 0.9rem;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Instrument Serif', Georgia, 'Poppins', serif;
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* ═══ Topbar ═══ */
.portal-topbar {
    background: linear-gradient(135deg, var(--portal-primary) 0%, var(--portal-primary-dark) 100%);
    color: #fff;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.portal-topbar h6 {
    margin: 0;
    font-size: 1rem;
}

/* ═══ İçerik ═══ */
.portal-content {
    padding: 1rem;
    padding-bottom: 80px;
    max-width: 1080px;     /* PC'de 1080px; daha dar ekranda tam genişlik (responsive) */
    margin: 0 auto;
}

/* Topbar + alt-nav iç içeriği: PC'de 1080px ortalanır, mobilde tam genişlik (bar arka planı tam genişlik kalır) */
.portal-bar-inner {
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Dashboard modül ızgarası — PC'de (≥768px) 2 sütun → 1080px genişliği kullanır; mobilde tek sütun (responsive).
   .portal-dash-full ile işaretli öğeler (karşılama + hızlı erişim) tam satır kaplar. */
.portal-dash {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
.portal-dash > .portal-card { margin-bottom: 0; }   /* boşluğu grid gap yönetir */
@media (min-width: 768px) {
    .portal-dash { grid-template-columns: 1fr 1fr; align-items: start; }
    .portal-dash > .portal-dash-full { grid-column: 1 / -1; }
}

/* ═══ Kartlar ═══ */
.portal-card {
    background: var(--portal-card);
    border-radius: 16px;
    box-shadow: var(--portal-shadow);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.portal-card-header {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ═══ Stat Kartı ═══ */
.portal-stat {
    text-align: center;
    padding: 1rem;
    border-radius: 12px;
    background: var(--portal-primary-light);
}

.portal-stat .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    color: var(--portal-primary);
}

.portal-stat .stat-label {
    font-size: 0.75rem;
    color: var(--portal-text-secondary);
    margin-top: 0.15rem;
}

/* ═══ Alt Navigasyon ═══ */
.portal-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--portal-card);
    border-top: 1px solid var(--portal-border);
    padding: 0.4rem 0;
    padding-bottom: calc(0.4rem + env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

/* Alt-nav iç içeriği: PC'de 1080px ortalanır (item'lar tüm ekrana yayılmaz), mobilde tam genişlik */
.portal-nav-inner {
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-around;
}

.portal-bottom-nav a,
.portal-bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--portal-text-muted);
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
    transition: color 0.15s;
}

.portal-bottom-nav a.active,
.portal-bottom-nav .nav-link.active {
    color: var(--portal-primary);
}

.portal-bottom-nav .mdi {
    font-size: 1.4rem;
    margin-bottom: 0.1rem;
}

/* ═══ Ruh Hali Seçici ═══ */
.mood-selector {
    display: flex;
    justify-content: space-around;
    gap: 0.5rem;
}

.mood-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid var(--portal-border);
    background: var(--portal-card);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.mood-btn.selected {
    border-color: var(--portal-primary);
    background: var(--portal-primary-light);
    transform: scale(1.1);
}

/* ═══ Progress Bar ═══ */
.portal-progress {
    border-radius: 8px;
    height: 8px;
    background: var(--portal-border);
    overflow: hidden;
}

.portal-progress .bar {
    height: 100%;
    border-radius: 8px;
    background: var(--portal-primary);
    transition: width 0.3s ease;
}

/* ═══ Giriş Sayfası ═══ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--portal-primary) 0%, var(--portal-primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: var(--portal-card);
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

/* ═══ Butonlar ═══ */
.btn-portal {
    background: var(--portal-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    width: 100%;
}

.btn-portal:hover {
    background: var(--portal-primary-dark);
    color: #fff;
}

/* ═══ Badge ═══ */
.portal-badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.portal-badge-success { background: #C6F6D5; color: #276749; }
.portal-badge-warning { background: #FEEBC8; color: #9C4221; }
.portal-badge-danger { background: #FED7D7; color: #9B2C2C; }
.portal-badge-info { background: #BEE3F8; color: #2A4365; }

/* ═══ Liste ═══ */
.portal-list-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--portal-border);
    gap: 0.75rem;
}

.portal-list-item:last-child {
    border-bottom: none;
}

/* ═══ Animasyonlar ═══ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.portal-card {
    animation: fadeIn 0.3s ease;
}

/* ═══ Mesajlaşma ═══ */
@media (max-width: 576px) {
    .portal-content {
        padding: 0.75rem;
        padding-bottom: 80px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PREMIUM HASTA PORTALI TEMASI — v2 override
   Sakinleştirici, güven verici, mobil PWA odaklı
   ═══════════════════════════════════════════════════════════════ */

:root {
    --portal-bg: #F4F6F8;
    --portal-shadow: 0 6px 18px -6px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
    --portal-shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.05);

    --portal-soft-success: rgba(56, 161, 105, 0.12);
    --portal-soft-success-fg: #1F7A4F;
    --portal-soft-warning: rgba(221, 107, 32, 0.12);
    --portal-soft-warning-fg: #B5530F;
    --portal-soft-danger: rgba(244, 63, 94, 0.12);
    --portal-soft-danger-fg: #B91C40;
    --portal-soft-primary: rgba(6, 145, 157, 0.12);
    --portal-soft-primary-fg: #057A84;
}

body {
    font-family: 'Inter', 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* TC, sayaçlar, remisyon günleri, su bardakları — rakam dikey hizası */
.portal-counter, .portal-stat-value, .badge,
table td, table th,
input[type="number"], input[type="tel"] {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Premium kart — büyük radius + soft shadow + hover lift */
.portal-card, .card {
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 18px;
    box-shadow: var(--portal-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.portal-card:hover, .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--portal-shadow-lg);
}

/* Glass topbar (gradient'i koruyor ama hafif blur+saturation katmanı) */
.portal-topbar {
    -webkit-backdrop-filter: saturate(140%);
    backdrop-filter: saturate(140%);
    box-shadow: 0 4px 14px -4px rgba(6, 145, 157, 0.25);
}

/* Butonlar */
.btn {
    border-radius: 12px;
    font-weight: 500;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -4px rgba(15, 23, 42, 0.15);
}

.btn-primary {
    background-color: var(--portal-primary);
    border-color: var(--portal-primary);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--portal-primary-dark);
    border-color: var(--portal-primary-dark);
}

/* Form alanları */
.form-control, .form-select {
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px rgba(6, 145, 157, 0.12);
}

/* Soft badges — alarm değil, bilgilendirme */
.badge-soft-success { background: var(--portal-soft-success); color: var(--portal-soft-success-fg); font-weight: 600; }
.badge-soft-warning { background: var(--portal-soft-warning); color: var(--portal-soft-warning-fg); font-weight: 600; }
.badge-soft-danger  { background: var(--portal-soft-danger);  color: var(--portal-soft-danger-fg);  font-weight: 600; }
.badge-soft-primary { background: var(--portal-soft-primary); color: var(--portal-soft-primary-fg); font-weight: 600; }

.badge-soft-success, .badge-soft-warning, .badge-soft-danger, .badge-soft-primary {
    border-radius: 8px;
    padding: 0.4em 0.7em;
    letter-spacing: 0.01em;
}

/* Remisyon sayaç dairesi (Profile/Home'da kullanılabilir) */
.portal-counter-circle {
    width: 120px; height: 120px;
    border-radius: 50%;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--portal-soft-primary);
    color: var(--portal-soft-primary-fg);
    font-variant-numeric: tabular-nums;
    box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.6), var(--portal-shadow);
}

.portal-counter-circle .num {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
}

.portal-counter-circle .lbl {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
    opacity: 0.85;
}

/* Modal — yumuşak */
.modal-content {
    border-radius: 18px;
    border: none;
    box-shadow: var(--portal-shadow-lg);
}

/* Reduced motion uyumu */
@media (prefers-reduced-motion: reduce) {
    .portal-card, .card, .btn { transition: none; }
    .portal-card:hover, .card:hover, .btn:hover { transform: none; }
}

/* ═══ Breadcrumb — Premium Soft Pill (Clinic ile tutarlı) ═══ */
.portal-breadcrumb {
    margin-bottom: 0.85rem;
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    backdrop-filter: blur(8px) saturate(140%);
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 12px;
    padding: 0.45rem 0.75rem;
    box-shadow: 0 2px 6px -2px rgba(15, 23, 42, 0.04);
    overflow-x: auto;
    white-space: nowrap;
}

.portal-breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    line-height: 1.4;
}

.portal-breadcrumb li {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.portal-breadcrumb a {
    color: var(--portal-text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.18rem 0.5rem;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.portal-breadcrumb a:hover,
.portal-breadcrumb a:focus {
    color: var(--portal-primary-dark);
    background: var(--portal-soft-primary);
    text-decoration: none;
}

.portal-breadcrumb a .mdi {
    font-size: 1rem;
    line-height: 1;
}

.portal-breadcrumb .separator {
    color: rgba(15, 23, 42, 0.25);
    font-size: 1rem;
}

.portal-breadcrumb .current {
    color: var(--portal-soft-primary-fg);
    font-weight: 600;
    padding: 0.18rem 0.5rem;
    background: var(--portal-soft-primary);
    border-radius: 8px;
}

/* ═══════════ ASİSTAN (panel-içi AI sohbet) ═══════════ */
.sohbet-wrap { display: flex; flex-direction: column; height: calc(100vh - 190px); }
.sohbet-baslik { padding: 4px 0 10px; }
.sohbet-baslik h5 { margin: 0; color: var(--portal-primary); font-weight: 700; }
.sohbet-baslik p { margin: 2px 0 0; font-size: .78rem; color: var(--portal-text-muted); }
.sohbet-mesajlar { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 2px; }
.sohbet-bubble { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: .9rem; line-height: 1.5; white-space: pre-wrap; }
.sohbet-bubble.ai { align-self: flex-start; background: var(--portal-card); border: 1px solid var(--portal-primary-light); border-bottom-left-radius: 4px; color: var(--portal-text); }
.sohbet-bubble.ben { align-self: flex-end; background: var(--portal-primary); color: #fff; border-bottom-right-radius: 4px; }
.sohbet-bubble.kriz { align-self: stretch; max-width: 100%; background: #fbeaea; border: 1px solid #e0a99f; color: #8a2b1c; font-weight: 500; }
.sohbet-yaziyor { align-self: flex-start; font-size: .8rem; color: var(--portal-text-muted); font-style: italic; padding: 4px 8px; }
.sohbet-giris { display: flex; gap: 8px; padding: 10px 0 4px; border-top: 1px solid var(--portal-primary-light); }
.sohbet-input { flex: 1; border: 1px solid var(--portal-primary-light); border-radius: 14px; padding: 11px 14px; font-size: .9rem; outline: none; resize: none; font-family: inherit; color: var(--portal-text); background: #fff; }
.sohbet-input:focus { border-color: var(--portal-primary); }
.sohbet-gonder { border: none; background: var(--portal-primary); color: #fff; width: 44px; border-radius: 14px; cursor: pointer; font-size: 1.2rem; flex: 0 0 auto; }
.sohbet-gonder:disabled { opacity: .5; cursor: default; }
.sohbet-not { text-align: center; font-size: .7rem; color: var(--portal-text-muted); padding: 6px 0 0; }

/* ── Bilişsel oyun motorları — ortak yerleşim (tüm oyunlar paylaşır; tek tek bileşen <style>'ına bağlı kalmasın) ── */
.oyun-saha { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: .5rem 0; }
.oyun-ipucu { font-size: .8rem; color: var(--portal-text-muted, #6a6458); text-align: center; margin: 0; }
.oyun-btn { background: var(--portal-primary, #3d5a3d); color: #fff; border: none; border-radius: 12px; padding: .6rem 1.5rem; font-weight: 600; cursor: pointer; }
.oyun-btn:disabled { opacity: .4; cursor: default; }
