/* =====================================================================
   Guard - Erişilebilirlik ve ergonomi katmanı (kullanıcı + admin ortak)
   Tarih: 2026-11-20. Mevcut tasarımı bozmadan üstüne eklenir.
   ===================================================================== */

/* ---- 1. Klavye odağı: her etkileşimli öğede görünür halka ----
   Bazı sayfalarda :focus-visible için outline:none verilmişti; klavyeyle
   gezen kullanıcı nerede olduğunu göremiyordu. Fareyle tıklamada görünmez. */
:root {
    --ga-focus: #fbbf24;
    --ga-focus-shadow: 0 0 0 4px rgba(251, 191, 36, 0.35);
    --ga-toast-bg: #111827;
    --ga-toast-fg: #f9fafb;
    --ga-ok: #10b981;
    --ga-err: #ef4444;
    --ga-warn: #f59e0b;
    --ga-info: #38bdf8;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 3px solid var(--ga-focus) !important;
    outline-offset: 2px !important;
    box-shadow: var(--ga-focus-shadow) !important;
}

/* ---- 2. "İçeriğe geç" bağlantısı (klavye/ekran okuyucu) ---- */
.ga-skip-link {
    position: fixed;
    top: -100px;
    left: 12px;
    z-index: 100000;
    padding: 10px 18px;
    border-radius: 0 0 10px 10px;
    background: var(--ga-focus);
    color: #111 !important;
    font-weight: 700;
    text-decoration: none;
    transition: top 0.15s ease;
}
.ga-skip-link:focus { top: 0; }

/* Sadece ekran okuyucunun okuyacağı metin */
.ga-sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* ---- 3. Dokunma hedefleri: mobilde en az 44x44 px ---- */
@media (pointer: coarse) {
    .nav-link,
    .menu-toggle,
    .banner-close-btn,
    .quick-reply-btn,
    .tab-btn,
    .favorite-btn,
    .btn-sm,
    .g-btn,
    #chatbot-send-btn,
    #chatbot-close-btn,
    .nav-list .nav-item > a {
        min-height: 44px;
        min-width: 44px;
    }
    input, select, textarea { font-size: 16px !important; } /* iOS'ta odaklanınca zoom yapmasın */
}

/* ---- 4. Hareket azaltma: işletim sisteminde "hareketi azalt" açıksa ----
   Arka plan videosu durur, sonsuz animasyonlar (nabız, parlama) kapanır. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    #bg-video { display: none !important; }
}
/* Kullanıcı sitede "animasyonları kapat" düğmesine bastıysa da aynısı */
html.ga-reduce-motion *, html.ga-reduce-motion *::before, html.ga-reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}
html.ga-reduce-motion #bg-video { display: none !important; }

/* ---- 5. Okunabilirlik: çok küçük yazılar için alt sınır ---- */
.badge-modern, .showcase-badge, .platform-badge-img + span { font-size: max(0.72rem, 11px); }
.main-content-wrapper .text-secondary, .main-content-wrapper .text-muted { color: #b8c0cc !important; } /* kullanıcı sitesi koyu zemin: kontrast 4.5:1 üstü */

/* ---- 6. Bildirim (toast) kutusu: tarayıcı alert() yerine ---- */
#ga-toast-region {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}
.ga-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--ga-toast-bg);
    color: var(--ga-toast-fg);
    border-left: 5px solid var(--ga-info);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    font-size: 0.95rem;
    line-height: 1.4;
    animation: ga-toast-in 0.18s ease-out;
    white-space: pre-line;
    word-break: break-word;
}
.ga-toast.ga-ok { border-left-color: var(--ga-ok); }
.ga-toast.ga-err { border-left-color: var(--ga-err); }
.ga-toast.ga-warn { border-left-color: var(--ga-warn); }
.ga-toast-icon { font-size: 1.1rem; line-height: 1.3; }
.ga-ok .ga-toast-icon { color: var(--ga-ok); }
.ga-err .ga-toast-icon { color: var(--ga-err); }
.ga-warn .ga-toast-icon { color: var(--ga-warn); }
.ga-info .ga-toast-icon { color: var(--ga-info); }
.ga-toast-msg { flex: 1; }
.ga-toast-close {
    background: none;
    border: 0;
    color: inherit;
    opacity: 0.7;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    min-width: 32px;
    min-height: 32px;
}
.ga-toast-close:hover { opacity: 1; }
@keyframes ga-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 576px) {
    #ga-toast-region { left: 16px; right: 16px; bottom: 12px; max-width: none; }
}

/* ---- 7. Tıklanabilir kartlar (oyun seçimi vb.) klavyeyle seçilebilir ---- */
[data-ga-clickable] { cursor: pointer; }

/* ---- 8. Hareket tercihi düğmesi (alt köşe) ---- */
.ga-motion-toggle {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 9990;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(17, 24, 39, 0.85);
    color: #e5e7eb;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.ga-motion-toggle[aria-pressed="true"] { color: var(--ga-focus); border-color: var(--ga-focus); }

/* ---- 9. Yükleniyor durumu: çift tıklamayı engelle ---- */
.ga-busy { pointer-events: none; opacity: 0.65; cursor: progress !important; }

/* =====================================================================
   ADMIN PANELİ (admin_ergonomi.js ile birlikte)
   ===================================================================== */
.ga-side-filter-wrap { padding: 10px 14px 6px; }
#ga-side-filter {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.3);
    color: #f3f4f6;
    font-size: 0.9rem;
}
#ga-side-filter::placeholder { color: #9ca3af; }

#ga-palette, #ga-help {
    position: fixed; inset: 0;
    z-index: 100002;
    background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 12vh 16px 16px;
}
#ga-palette[hidden], #ga-help[hidden] { display: none; }
.ga-pal-box {
    width: min(560px, 100%);
    background: #111827;
    color: #f3f4f6;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}
#ga-pal-input {
    width: 100%;
    padding: 16px 18px;
    font-size: 1.05rem;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: inherit;
}
#ga-pal-input:focus { outline: none !important; box-shadow: none !important; }
#ga-pal-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
#ga-pal-list [role="option"], .ga-pal-empty {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
#ga-pal-list [role="option"] i { width: 20px; text-align: center; opacity: 0.85; }
#ga-pal-list [role="option"] small { margin-left: auto; color: #9ca3af; font-size: 0.75rem; }
#ga-pal-list [aria-selected="true"] { background: rgba(251, 191, 36, 0.18); outline: 1px solid rgba(251, 191, 36, 0.5); }
.ga-pal-empty { color: #9ca3af; cursor: default; }
.ga-pal-foot { padding: 8px 14px; font-size: 0.78rem; color: #9ca3af; border-top: 1px solid rgba(255, 255, 255, 0.08); }
#ga-help .ga-pal-box { padding: 18px 20px; }
#ga-help h2 { font-size: 1.1rem; margin: 0 0 12px; }
#ga-help dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; }
#ga-help dd { margin: 0; color: #d1d5db; }
kbd {
    display: inline-block; padding: 1px 6px; border-radius: 4px;
    background: #374151; color: #f9fafb; font-size: 0.78em; border: 1px solid #4b5563;
}

.ga-table-filter { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; max-width: 420px; }
.ga-tf-count { font-size: 0.8rem; color: #9ca3af; white-space: nowrap; }

/* Uzun tablolarda başlık kaydırırken görünür kalsın */
.main-content .table-responsive { max-height: 75vh; }
.main-content .table-responsive thead th {
    position: sticky; top: 0; z-index: 2;
    background: #1f2937;
}
.nav-list .nav-item > a[aria-current="page"] { font-weight: 700; }
