/*
 * Problem Ağacı - Özel Stiller ve Animasyonlar
 * Tailwind CSS üzerine ek tanımlamalar
 */

/* ============================================
   GENEL AYARLAR
   ============================================ */

/* Sayfa yükleme animasyonu */
body {
    opacity: 0;
    animation: pageLoad 0.6s ease-out forwards;
}

/* Scrollbar stili */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ============================================
   ANİMASYON TANIMLARI
   ============================================ */

/* Sayfa yükleme */
@keyframes pageLoad {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Yeni soru/adım belirir - yukarıdan aşağıya kayarak.
   Not: max-height kullanılmaz; "forwards" ile kalıcı olan 1000px sınırı uzun
   sonuç kartlarını ve derin dalları keserek içeriği üst üste bindiriyordu. */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Genel belirme */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Belirme + hafif büyüme */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Kaybolma + küçülme */
@keyframes fadeOutCollapse {
    from {
        opacity: 1;
        transform: scale(1);
        max-height: 1000px;
    }
    to {
        opacity: 0;
        transform: scale(0.95);
        max-height: 0;
    }
}

/* Hatalı şifre sarsıntısı */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Yumuşak parlama efekti (sonuç kartı) */
@keyframes softGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
    }
    50% {
        box-shadow: 0 0 25px rgba(59, 130, 246, 0.25);
    }
}

/* Nabız efekti */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Yükleniyor döndürme */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Alt çizgi genişleme (hover efekti) */
@keyframes expandLine {
    from { width: 0; }
    to { width: 100%; }
}

/* ============================================
   ANİMASYON SINIFLAR
   ============================================ */

.animate-slide-down {
    animation: slideDown 0.4s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.animate-fade-in-scale {
    animation: fadeInScale 0.35s ease-out forwards;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

.animate-soft-glow {
    animation: softGlow 2s ease-in-out infinite;
}

.animate-pulse-slow {
    animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Kaybolma animasyonu (JS ile tetiklenir) */
.animate-fade-out-collapse {
    animation: fadeOutCollapse 0.3s ease-in forwards;
    overflow: hidden;
}

/* ============================================
   BUTON STİLLERİ
   ============================================ */

/* Seçenek butonu hover efekti */
.option-btn {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.option-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.option-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Seçili seçenek */
.option-btn.selected {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    color: white !important;
    border-color: #2563eb !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.option-btn.selected:hover {
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* Seçilmemiş ama aynı seviyede seçim yapılmış butonlar */
.option-btn.not-selected {
    opacity: 0.5;
    transform: scale(0.98);
}

.option-btn.not-selected:hover {
    opacity: 0.8;
    transform: scale(1);
}

/* Ripple efekti */
.option-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.option-btn:active::after {
    width: 300px;
    height: 300px;
}

/* ============================================
   SORU KARTI STİLLERİ
   ============================================ */

.question-card {
    transition: all 0.3s ease;
}

.question-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* Bağlantı çizgisi (düğümler arası) */
.connector-line {
    width: 2px;
    background: linear-gradient(to bottom, #3b82f6, #93c5fd);
    margin: 0 auto;
    transition: height 0.3s ease;
}

/* ============================================
   ŞİFRE GİRİŞ EKRANI
   ============================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.login-card {
    animation: fadeInScale 0.5s ease-out;
}

.login-input {
    transition: all 0.3s ease;
}

.login-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
}

.login-btn {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

/* ============================================
   SONUÇ KARTI (YAPRAK DÜĞÜM)
   ============================================ */

.result-card {
    animation: fadeInScale 0.5s ease-out, softGlow 2s ease-in-out infinite;
    border-left: 4px solid #10b981;
}

/* ============================================
   ADMİN PANELİ
   ============================================ */

/* Ağaç düğüm listesi */
.tree-item {
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.tree-item:hover {
    background-color: #f1f5f9;
    border-left-color: #3b82f6;
}

.tree-item.active {
    background-color: #eff6ff;
    border-left-color: #3b82f6;
}

/* Admin butonlar */
.admin-btn {
    transition: all 0.15s ease;
}

.admin-btn:hover {
    transform: translateY(-1px);
}

.admin-btn:active {
    transform: translateY(0);
}

/* Form alanları */
.admin-input {
    transition: all 0.2s ease;
}

.admin-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
}

/* Modal overlay */
.modal-overlay {
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: fadeInScale 0.3s ease-out;
}

/* ============================================
   YÜKLEME GÖSTERGESİ
   ============================================ */

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   RESPONSİVE DÜZENLEMELER
   ============================================ */

@media (max-width: 768px) {
    .option-btn {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    /* Dokunmatik ekranda hover kaydırması "takılı" kalmasın */
    .option-btn:hover {
        transform: none;
    }

    .question-card h2 {
        font-size: 1rem;
    }
}

/* iOS'ta 16px altı input'a odaklanınca sayfa yakınlaşmasın */
@media (max-width: 640px) {
    input[type="text"],
    input[type="search"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Sonuç metnindeki bağlantılar */
.result-text a {
    word-break: break-all;
}

/* Ağaçta sonu eksik (çözümsüz) düğüm etiketi - admin */
.dead-end-badge {
    font-size: 10px;
    font-weight: 700;
    color: #b45309;
    background: #fef3c7;
    border-radius: 4px;
    padding: 1px 5px;
}
html.dark .dead-end-badge {
    color: #fcd34d;
    background: rgba(245, 158, 11, .18);
}

/* ============================================
   GEÇİŞ YARDIMCILARI
   ============================================ */

/* Gecikmeli animasyon (art arda gelen elemanlar için) */
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.2s; }
.delay-5 { animation-delay: 0.25s; }
.delay-6 { animation-delay: 0.3s; }

/* Başlangıçta görünmez (animasyon fill-mode: forwards ile görünür olacak) */
.initially-hidden {
    opacity: 0;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Yatay kaydırılabilir şeritlerde kaydırma çubuğunu gizle (kaydırma çalışmaya devam eder) */
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
