/**
 * SYS-008: WCAG AA Erişilebilirlik İyileştirmeleri
 * 
 * Kapsam:
 * - Focus göstergeleri (keyboard navigation)
 * - Skip to content linki
 * - Renk kontrastı iyileştirmeleri
 * - Screen reader yardımcıları
 * - Motion preference (reduced motion)
 * - High contrast mode desteği
 */

/* ═══════════════════════════════════════════════════════════════
   1. Skip to Content (Atlama Linkleri)
   ═══════════════════════════════════════════════════════════════ */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 10000;
    background: #405189;
    color: #fff;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
    color: #fff;
    outline: 3px solid #f7b84b;
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   2. Focus Göstergeleri (Keyboard Navigation)
   ═══════════════════════════════════════════════════════════════ */

/* Focus-visible: sadece keyboard ile focus olduğunda göster */
*:focus-visible {
    outline: 3px solid #405189 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(64, 81, 137, 0.25) !important;
}

/* Butonlar ve linkler */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
    outline: 3px solid #405189 !important;
    outline-offset: 2px !important;
}

/* Form elemanları */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 3px solid #405189 !important;
    outline-offset: 0 !important;
    border-color: #405189 !important;
    box-shadow: 0 0 0 3px rgba(64, 81, 137, 0.25) !important;
}

/* Dropdown items */
.dropdown-item:focus-visible {
    background-color: rgba(64, 81, 137, 0.1) !important;
    outline: 2px solid #405189 !important;
    outline-offset: -2px !important;
}

/* Nav links */
.nav-link:focus-visible {
    outline: 2px solid #405189 !important;
    outline-offset: 2px !important;
    border-radius: 4px;
}

/* Pagination */
.page-link:focus-visible {
    outline: 2px solid #405189 !important;
    box-shadow: 0 0 0 3px rgba(64, 81, 137, 0.25) !important;
}

/* Cards */
.card:focus-visible {
    outline: 3px solid #405189 !important;
    outline-offset: 2px !important;
}

/* Modal focus trap indicator */
.modal.show .modal-content:focus-visible {
    outline: 3px solid #405189 !important;
    outline-offset: -3px !important;
}

/* ═══════════════════════════════════════════════════════════════
   3. Screen Reader Yardımcıları
   ═══════════════════════════════════════════════════════════════ */

/* Görsel olarak gizle ama screen reader'lar okusun */
.sr-only,
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Live region bildirimleri */
.aria-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   4. Renk Kontrastı İyileştirmeleri
   ═══════════════════════════════════════════════════════════════ */

/* Muted text kontrastı artır (4.5:1 ratio minimum) */
.text-muted {
    color: #5c6270 !important; /* AA uyumlu kontrast */
}

[data-bs-theme="dark"] .text-muted {
    color: #a0a5b1 !important; /* Dark mode AA uyumlu */
}

/* Badge kontrastları */
.badge.bg-warning {
    color: #000 !important; /* Sarı arka plan siyah yazı */
}

.badge.bg-info {
    color: #000 !important; /* Turkuaz arka plan */
}

/* Form placeholder kontrastı */
::placeholder {
    color: #6c757d !important;
    opacity: 1 !important;
}

[data-bs-theme="dark"] ::placeholder {
    color: #8c92a0 !important;
}

/* Disabled elemanlar */
.form-control:disabled,
.form-select:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════
   5. Motion Tercihleri (Reduced Motion)
   ═══════════════════════════════════════════════════════════════ */

@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;
    }
    
    .card-animate:hover {
        transform: none !important;
    }
    
    .spinner-border,
    .spinner-grow {
        animation-duration: 1.5s !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   6. High Contrast Mode
   ═══════════════════════════════════════════════════════════════ */

@media (forced-colors: active) {
    .btn {
        border: 2px solid ButtonText !important;
    }
    
    .card {
        border: 1px solid CanvasText !important;
    }
    
    .badge {
        border: 1px solid CanvasText !important;
    }
    
    a {
        text-decoration: underline !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   7. Tablo Erişilebilirliği
   ═══════════════════════════════════════════════════════════════ */

/* Tablo satır hover'ları daha belirgin */
.table-hover tbody tr:hover {
    background-color: rgba(64, 81, 137, 0.08) !important;
}

.table-hover tbody tr:focus-within {
    background-color: rgba(64, 81, 137, 0.12) !important;
    outline: 2px solid #405189;
    outline-offset: -2px;
}

/* Tablo header'ları scope attribute ile birlikte */
.table th {
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   8. Form Erişilebilirliği
   ═══════════════════════════════════════════════════════════════ */

/* Zorunlu alan göstergesi */
label.required::after,
.form-label.required::after {
    content: " *";
    color: #f06548;
    font-weight: bold;
}

/* Hata durumunda form alanı */
.form-control.is-invalid:focus-visible,
.form-select.is-invalid:focus-visible {
    outline-color: #f06548 !important;
    box-shadow: 0 0 0 3px rgba(240, 101, 72, 0.25) !important;
}

/* Başarı durumunda form alanı */
.form-control.is-valid:focus-visible,
.form-select.is-valid:focus-visible {
    outline-color: #0ab39c !important;
    box-shadow: 0 0 0 3px rgba(10, 179, 156, 0.25) !important;
}

/* ═══════════════════════════════════════════════════════════════
   9. Touch Hedefi Boyutları (min 44x44px)
   ═══════════════════════════════════════════════════════════════ */

@media (pointer: coarse) {
    .btn-sm {
        min-height: 44px;
        min-width: 44px;
        padding: 8px 16px;
    }
    
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
    
    .dropdown-item {
        padding: 10px 16px;
        min-height: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .form-check-input {
        min-width: 20px;
        min-height: 20px;
    }
}
