/* Global page navigation — Ana sayfa + Geri (mobile & desktop) */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    /* Krom mavisi (theme_kobalt.css --bk-header ile aynı) */
    background: linear-gradient(180deg, #4a7ce6 0%, #2b5bc8 48%, #224ead 52%, #1d4499 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.28);
    box-sizing: border-box;
}

.site-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    min-width: 44px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.site-nav-btn:hover,
.site-nav-btn:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
    outline: none;
}

.site-nav-btn:active {
    background: rgba(255, 255, 255, 0.28);
}

.site-nav-btn[aria-current="page"] {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.7);
}

.site-nav-btn[disabled],
.site-nav-btn.is-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* Reserve space under fixed nav without breaking flex-centered pages */
body.site-nav-active {
    padding-top: calc(60px + env(safe-area-inset-top, 0px)) !important;
}

@media (max-width: 480px) {
    .site-nav {
        gap: 6px;
        padding: 6px 8px;
        padding-top: max(6px, env(safe-area-inset-top, 0px));
    }

    .site-nav-btn {
        flex: 1 1 auto;
        font-size: 13px;
        padding: 10px 12px;
    }

    body.site-nav-active {
        padding-top: calc(56px + env(safe-area-inset-top, 0px)) !important;
    }
}

/* Dil seçici (i18n.js) */
.site-nav-lang {
    margin-inline-start: auto;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

.site-nav-lang option {
    color: #111;
}

/* Rol önizleme bandı (admin "Rol Önizleme"): nav satırında; dar ekranda kendi satırında */
.site-nav-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding: 4px 6px;
    padding-inline-start: 12px;
    border-radius: 10px;
    background: #ffc107;
    color: #212529;
    font-size: 14px;
    font-weight: 600;
    box-sizing: border-box;
}

.site-nav-preview-title {
    white-space: nowrap;
}

.site-nav-preview-label {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-nav-preview-back {
    flex: none;
    min-height: 36px;
    padding: 6px 12px;
    border: 0;
    border-radius: 8px;
    background: #212529;
    color: #fff;
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
}

.site-nav-preview-back:hover,
.site-nav-preview-back:focus-visible {
    background: #000;
    outline: 2px solid #fff;
    outline-offset: 1px;
}

@media (max-width: 640px) {
    .site-nav-preview {
        flex-basis: 100%;
        order: 1;
    }

    body.site-nav-active.site-nav-previewing {
        padding-top: calc(116px + env(safe-area-inset-top, 0px)) !important;
    }
}

@media (max-width: 480px) {
    /* Telefonda yer rol etiketine kalsın (👁 + sarı bant yeterince belli) */
    .site-nav-preview-title {
        display: none;
    }
}

/* Sesli yardım asistanı (js/help_bot.js): sağ altta maskot "Kromi" + davet balonu + panel.
   Sohbet sayfasında giriş kutusu + misafir bandı altta (~235px): maskot onların üstünde durur;
   kartın yanında yer kalan çok geniş ekranda köşeye iner. */
body {
    --hb-size: 96px;
    --hb-bottom: 24px;
}

body:has(.chat-input-container) {
    --hb-bottom: 244px;
}

@media (min-width: 1880px) {
    body:has(.chat-input-container) { --hb-bottom: 24px; }
}

@media (max-width: 768px) {
    body { --hb-size: 64px; }
    body:has(.chat-input-container) { --hb-bottom: 210px; }
}

.hb-dock {
    position: fixed;
    inset-inline-end: 16px;
    bottom: calc(var(--hb-bottom) + env(safe-area-inset-bottom, 0px));
    z-index: 10055;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.hb-dock > * {
    pointer-events: auto;
}

/* Kaydırınca kenara çekilmiş Kromi (help_bot.js watchScroll): yalnız bir parçası görünür */
.hb-dock {
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.hb-dock.hb-tucked {
    transform: translateX(calc(var(--hb-size) * 0.62));
    opacity: 0.8;
}

[dir="rtl"] .hb-dock.hb-tucked {
    transform: translateX(calc(var(--hb-size) * -0.62));
}

.hb-dock.hb-tucked .hb-bubble {
    display: none;
}

.hb-dock.hb-tucked .hb-fab {
    animation-play-state: paused;
}

.hb-dock.hb-tucked:hover,
.hb-dock.hb-tucked:focus-within {
    transform: none;
    opacity: 1;
}

.hb-fab {
    width: var(--hb-size);
    height: calc(var(--hb-size) * 1.2);
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    filter: drop-shadow(0 6px 10px rgba(29, 68, 153, 0.35));
    animation: hb-float 3.2s ease-in-out infinite;
    transition: transform 0.15s;
}

.hb-fab:hover {
    transform: scale(1.08);
}

.hb-fab:focus-visible {
    outline: 3px solid #2a5bd0;
    outline-offset: 2px;
    border-radius: 16px;
}

.hb-avatar {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.hb-head .hb-avatar {
    width: 30px;
    height: 36px;
    flex: none;
}

.hb-eyes,
.hb-mouth,
.hb-bub {
    transform-box: fill-box;
    transform-origin: center;
}

.hb-eyes {
    animation: hb-blink 5s infinite;
}

/* El sallama: omuz (75,84) çevresinde, 7 sn'de bir */
.hb-fab .hb-arm {
    transform-origin: 75px 84px;
    animation: hb-wave 7s ease-in-out infinite;
}

.hb-bub {
    animation: hb-rise 3s ease-in infinite;
}

.hb-bub:nth-child(2) { animation-delay: 1s; }
.hb-bub:nth-child(3) { animation-delay: 2s; }

.hb-head .hb-bub,
.hb-head .hb-arm {
    animation: none;
}

.hb-talking .hb-mouth {
    animation: hb-talk 0.32s ease-in-out infinite alternate;
}

@keyframes hb-float {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -8px; }
}

@keyframes hb-blink {
    0%, 94%, 100% { transform: scaleY(1); }
    97% { transform: scaleY(0.1); }
}

@keyframes hb-wave {
    0%, 70%, 100% { transform: rotate(0deg); }
    75%, 85% { transform: rotate(-22deg); }
    80%, 90% { transform: rotate(12deg); }
}

@keyframes hb-rise {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateY(-34px); opacity: 0; }
}

@keyframes hb-talk {
    from { transform: scaleY(1); }
    to { transform: scale(0.8, 2.6); }
}

/* Davet balonu: maskotun yanında, maskota bakan kuyruklu */
.hb-bubble {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 220px;
    padding: 4px 4px 4px 0;
    border: 1px solid #b3c7e6;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(16, 40, 90, 0.18);
    animation: hb-pop 0.4s ease-out 0.6s both;
}

.hb-bubble[hidden] {
    display: none;
}

.hb-bubble::after {
    content: '';
    position: absolute;
    inset-inline-end: -7px;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    background: #fff;
    border-top: 1px solid #b3c7e6;
    border-inline-end: 1px solid #b3c7e6;
    transform: rotate(45deg);
}

[dir="rtl"] .hb-bubble::after {
    transform: rotate(-45deg);
}

.hb-bubble-text {
    padding: 8px 4px 8px 12px;
    border: 0;
    background: transparent;
    color: #12213a;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-align: start;
    cursor: pointer;
}

.hb-bubble-text:hover {
    color: #2a5bd0;
}

.hb-bubble-x {
    align-self: flex-start;
    min-width: 28px;
    min-height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #586b8a;
    font-size: 16px;
    cursor: pointer;
}

.hb-bubble-x:hover {
    background: #eef4fd;
}

@keyframes hb-pop {
    from { opacity: 0; transform: translateX(8px) scale(0.92); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
    .hb-bubble { max-width: 170px; }
    .hb-bubble-text { font-size: 13px; }
}

.hb-panel {
    position: fixed;
    bottom: calc(var(--hb-bottom) + var(--hb-size) * 1.2 + 12px + env(safe-area-inset-bottom, 0px));
    inset-inline-end: 16px;
    z-index: 10060;
    display: flex;
    flex-direction: column;
    width: min(360px, calc(100vw - 32px));
    max-height: min(480px, calc(100dvh - var(--hb-bottom) - var(--hb-size) * 1.2 - 90px));
    border: 1px solid #b3c7e6;
    border-radius: 16px;
    background: #fbfdff;
    color: #12213a;
    box-shadow: 0 12px 32px rgba(16, 40, 90, 0.22);
    font-size: 14px;
    overflow: hidden;
}

.hb-panel[hidden] {
    display: none;
}

.hb-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #4a7ce6 0%, #2b5bc8 48%, #224ead 52%, #1d4499 100%);
    color: #fff;
}

.hb-title {
    flex: 1;
    font-size: 15px;
}

.hb-icon {
    min-width: 36px;
    min-height: 36px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.hb-head .hb-icon:hover {
    background: rgba(255, 255, 255, 0.18);
}

.hb-log {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Kromi geçmişinde gün ayracı (Bugün / Dün / tarih) */
.hb-day {
    align-self: center;
    margin: 4px 0;
    padding: 2px 10px;
    border-radius: 999px;
    background: #e4edfa;
    color: #586b8a;
    font-size: 12px;
    font-weight: 600;
}

.hb-msg {
    margin: 0;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 88%;
    line-height: 1.45;
}

.hb-bot {
    align-self: flex-start;
    background: #eef4fd;
    border: 1px solid #d3e0f3;
}

.hb-user {
    align-self: flex-end;
    background: #2a5bd0;
    color: #fff;
}

.hb-busy .hb-log::after {
    content: '…';
    align-self: flex-start;
    padding: 4px 12px;
    color: #586b8a;
    font-size: 20px;
}

/* Hazır sorular (yazmadan sor) */
.hb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px 0;
    border-top: 1px solid #d3e0f3;
}

.hb-chip {
    padding: 6px 10px;
    border: 1px solid #b3c7e6;
    border-radius: 999px;
    background: #fff;
    color: #1f4ab3;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.hb-chip:hover {
    background: #eef4fd;
}

/* Cevap altındaki küçük düğmeler: "Daha basit anlat", "Vazgeç" */
.hb-simpler {
    margin-top: 6px;
    padding: 3px 10px;
    border: 1px solid #b3c7e6;
    border-radius: 8px;
    background: #fff;
    color: #1f4ab3;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.hb-simpler:hover {
    background: #e4edfa;
}

.hb-form {
    display: flex;
    gap: 6px;
    padding: 10px;
}

.hb-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #b3c7e6;
    border-radius: 10px;
    background: #fff;
    color: inherit;
    font: inherit;
}

.hb-input:focus {
    outline: none;
    border-color: #2a5bd0;
    box-shadow: 0 0 0 3px rgba(42, 91, 208, 0.22);
}

.hb-form .hb-icon {
    border-color: #b3c7e6;
}

.hb-mic.hb-listening {
    background: #c62828;
    border-color: #c62828;
    animation: hb-pulse 1s infinite;
}

@keyframes hb-pulse {
    50% { box-shadow: 0 0 0 6px rgba(198, 40, 40, 0.2); }
}

.hb-send {
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: #2a5bd0;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.hb-send:hover {
    background: #1f4ab3;
}

/* Adım adım gösterme: maskotun yanındaki adım kutusu + öğelerin üstünde numaralı rozetler */
.hb-tour {
    width: min(300px, calc(100vw - var(--hb-size) - 48px));
    padding: 12px 12px 8px;
    border: 2px solid #2a5bd0;
    border-radius: 14px;
    background: #fff;
    color: #12213a;
    box-shadow: 0 10px 26px rgba(16, 40, 90, 0.25);
    animation: hb-pop 0.3s ease-out both;
}

.hb-tour[hidden] {
    display: none;
}

.hb-tour-text {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
}

.hb-tour-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hb-tour-count {
    flex: 1;
    color: #586b8a;
    font-size: 13px;
    text-align: center;
}

.hb-tour-nav button {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #b3c7e6;
    border-radius: 10px;
    background: #fff;
    color: #1f4ab3;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.hb-tour-nav .hb-tour-next {
    border-color: #2a5bd0;
    background: #2a5bd0;
    color: #fff;
}

.hb-tour-nav button:disabled {
    opacity: 0.4;
    cursor: default;
}

.hb-badge {
    position: absolute;
    z-index: 10052;
    width: 24px;
    height: 24px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #586b8a;
    color: #fff;
    font: 700 12px/20px system-ui, sans-serif;
    text-align: center;
    box-shadow: 0 2px 6px rgba(16, 40, 90, 0.35);
    pointer-events: none;
}

.hb-badge[hidden] {
    display: none;
}

.hb-badge-on {
    background: #f0a020;
    transform: scale(1.25);
}

/* Asistanın gösterdiği öğe */
.hb-spot {
    outline: 3px solid #f0a020 !important;
    outline-offset: 3px;
    animation: hb-spot 1s ease-in-out 4;
}

@keyframes hb-spot {
    50% { outline-color: rgba(240, 160, 32, 0.25); }
}

@media (prefers-reduced-motion: reduce) {
    .hb-fab, .hb-fab .hb-arm, .hb-bub, .hb-bubble,
    .hb-eyes, .hb-talking .hb-mouth, .hb-spot, .hb-mic.hb-listening {
        animation: none;
    }
}

@media print {
    .hb-dock, .hb-panel, .hb-badge {
        display: none !important;
    }
}
