/* style.css - Gergin Quiz Ana Stil Dosyası */

/* ==========================================================================
   0. CSS Değişkenleri (Renk Paleti)
   ========================================================================== */
:root {
  --primary-50: #e0f2fe; /* Çok Açık Mavi */
  --primary-100: #bbdefb;
  --primary-200: #90caf9;
  --primary-300: #64b5f6;
  --primary-400: #42a5f5;
  --primary-500: #2196f3; /* Ana Mavi (Kahoot mavisi gibi) */
  --primary-600: #1e88e5;
  --primary-700: #1976d2;
  --primary-800: #1565c0;
  --primary-900: #0d47a1; /* Koyu Mavi */

  --accent-50: #fce4ec; /* Çok Açık Pembe */
  --accent-100: #f8bbd0;
  --accent-200: #f48fb1;
  --accent-300: #f06292;
  --accent-400: #ec407a;
  --accent-500: #e91e63; /* Canlı Pembe (Kahoot pembe gibi) */
  --accent-600: #d81b60;
  --accent-700: #c2185b;
  --accent-800: #ad1457;
  --accent-900: #880e4f; /* Koyu Pembe */

  --success: #4CAF50; /* Yeşil */
  --warning: #FFC107; /* Sarı */
  --danger: #F44336;  /* Kırmızı */
  --info: #2196F3;   /* Mavi */

  --text-dark: #333;
  --text-light: #fff;
  --background-light: #fdfdfd;
  --background-dark: #212121; /* Koyu tema için */

  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 16px; /* Kutular için daha büyük radius */

  --shadow: 0 6px 16px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1); /* Daha belirgin gölge */
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.3), 0 4px 8px rgba(0,0,0,0.15);
  
  --spacing-sm: 10px;
  --spacing-md: 20px;
  --spacing-lg: 30px;
}

/* ==========================================================================
   1. Genel Sıfırlamalar ve Temel Stiller
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', sans-serif; /* Daha modern bir font */
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500)); /* Mevcut gradient */
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column; /* Footer'ı alta sabitlemek için */
  justify-content: center; /* İçeriği dikeyde ortala */
  align-items: center; /* İçeriği yatayda ortala */
  padding: var(--spacing-md); /* Mobil cihazlarda kenar boşluğu */
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--text-dark);
}

p {
  line-height: 1.6;
}

a {
  color: var(--primary-700);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button, input[type="submit"], .kahoot-btn {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1.1em;
  padding: 12px 25px;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px; /* İkon ile yazı arasına boşluk */
}

button:hover, .kahoot-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

button:active, .kahoot-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow);
}

/* ==========================================================================
   2. Temel Bileşenler (Kutular, Formlar, Butonlar)
   ========================================================================== */
.kahoot-card {
  background: var(--background-light);
  border-radius: var(--border-radius-lg); /* Daha yuvarlak köşeler */
  box-shadow: var(--shadow);
  padding: var(--spacing-lg); /* İç boşluğu artır */
  width: 100%;
  max-width: 450px; /* Daha geniş kart */
  text-align: center;
  margin: var(--spacing-md) auto; /* Dikeyde de ortala */
}

.kahoot-input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid var(--primary-200);
  border-radius: var(--border-radius-md);
  margin-bottom: var(--spacing-sm);
  font-size: 1em;
  color: var(--text-dark);
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.kahoot-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(var(--primary-500), 0.2);
}

.kahoot-btn-primary {
  background-color: var(--primary-600);
  color: var(--text-light);
}

.kahoot-btn-success {
  background-color: var(--success);
  color: var(--text-light);
}

.kahoot-btn-danger {
  background-color: var(--danger);
  color: var(--text-light);
}

.kahoot-btn-secondary {
  background-color: var(--primary-200);
  color: var(--primary-900);
}

/* Başlık stilleri */
.kahoot-card h1 {
  font-size: 2.2em; /* Daha büyük başlık */
  color: var(--primary-700);
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.kahoot-card h1 .fa-solid {
  color: var(--accent-500); /* İkon rengi */
}

.kahoot-card p.subtitle {
    color: #666;
    margin-top: -5px;
    margin-bottom: var(--spacing-lg);
    font-size: 0.9em;
}


/* ==========================================================================
   3. Özel Düzenler (Giriş Sayfası, Lobi, Oyun Ekranı)
   ========================================================================== */

/* Giriş Sayfası (.php) */
#giris-formu .form-group {
  margin-bottom: var(--spacing-md); /* Form grupları arasına boşluk */
  text-align: left;
}

#giris-formu label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
  font-size: 1.1em;
}

#giris-formu .pin-input-group,
#giris-formu .kullanici-adi-input-group {
    margin-bottom: var(--spacing-md);
}

/* Avatar Seçim Alanı */
.avatar-secim {
  margin-bottom: var(--spacing-md);
  text-align: center;
}
.avatar-secim h3 {
  font-size: 1.1em;
  color: var(--text-dark);
  margin-bottom: var(--spacing-sm);
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(40px, 1fr)); /* Daha fazla sütun */
  gap: 10px;
  max-width: 300px; /* Ortalamak için */
  margin: 0 auto;
}
.avatar-secim-btn {
  background: var(--primary-100);
  border: 2px solid var(--primary-200);
  border-radius: var(--border-radius-md);
  font-size: 1.8em;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  user-select: none; /* Metin seçimi engelle */
}
.avatar-secim-btn:hover {
  border-color: var(--primary-500);
  transform: scale(1.1);
}
.avatar-secim-btn.selected {
  border-color: var(--accent-500);
  background: var(--accent-100);
  box-shadow: 0 0 0 3px rgba(var(--accent-500), 0.3);
  transform: scale(1.1);
}

/* ==========================================================================
   4. Footer
   ========================================================================== */
footer {
  text-align: center;
  padding: var(--spacing-md);
  color: var(--primary-100); /* Daha açık bir renk */
  font-weight: 500;
  opacity: 0.8;
  font-size: 0.85em;
  margin-top: auto; /* Footer'ı dibe iter */
  width: 100%;
  max-width: 100%; /* Genişlik sınırlamasını kaldır */
  position: relative; /* z-index için */
  z-index: 10; /* Diğer elementlerin altında kalmasın */
}

/* ==========================================================================
   5. Responsive Tasarım (Mobil Uyumluluk)
   ========================================================================== */
@media (max-width: 768px) {
  body {
    padding: var(--spacing-sm);
  }

  .kahoot-card {
    padding: var(--spacing-md);
    margin: var(--spacing-sm) auto;
  }

  .kahoot-card h1 {
    font-size: 1.8em;
  }
  
  button, .kahoot-btn {
    font-size: 1em;
    padding: 10px 20px;
  }
  
  #giris-formu label {
      font-size: 1em;
  }
  
  .avatar-grid {
      grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
      gap: 8px;
      max-width: 250px;
  }
  .avatar-secim-btn {
      width: 45px;
      height: 45px;
      font-size: 1.5em;
  }
}

@media (max-width: 480px) {
    .kahoot-card {
        padding: var(--spacing-sm);
    }
    
    .kahoot-card h1 {
        font-size: 1.5em;
        flex-direction: column; /* Mobil'de başlığı ve ikonu alt alta */
        gap: 5px;
    }
    .kahoot-card h1 .fa-solid {
        font-size: 0.9em;
    }
    
    .kahoot-card p.subtitle {
        font-size: 0.8em;
    }

    button, .kahoot-btn {
        font-size: 0.9em;
        padding: 8px 15px;
    }
    
    #giris-formu label {
        font-size: 0.9em;
    }
    
    .avatar-grid {
        max-width: 100%; /* Mobil'de genişliği kullan */
    }
    .avatar-secim-btn {
        width: 40px;
        height: 40px;
        font-size: 1.3em;
    }

    footer {
        padding: var(--spacing-sm);
        font-size: 0.75em;
    }
}

/* Spinner animasyonu */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--text-light);
  animation: spin 1s ease-in-out infinite;
  -webkit-animation: spin 1s ease-in-out infinite;
  margin-left: 10px;
}

@keyframes spin {
  to { -webkit-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
  to { -webkit-transform: rotate(360deg); }
}

/* Temel Mesaj kutuları */
.alert-box {
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-md);
    font-weight: 500;
    font-size: 0.95em;
}
.alert-box.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert-box.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.alert-box.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* --- YENİ EFSANE AVATAR SEÇİCİ STİLLERİ --- */

/* Scroll yapılabilir alan (Çok fazla avatar olursa taşmasın) */
.avatar-grid-container {
    max-height: 250px; /* Yükseklik sınırı */
    overflow-y: auto;  /* Dikey kaydırma çubuğu */
    padding: 10px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); /* Esnek kolonlar */
    gap: 15px;
    justify-items: center;
}

.avatar-item {
    width: 60px;
    height: 60px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 2px solid transparent;
}

.avatar-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none; /* Resme tıklanmasın, div'e tıklansın */
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1));
}

/* Hover Efekti (Üzerine gelince) */
.avatar-item:hover {
    transform: scale(1.15) rotate(5deg);
    background: #e3f2fd;
    z-index: 2;
}

/* Seçili Durumu (Legendary Parlama) */
.avatar-item.selected {
    border-color: #2196F3;
    background: rgba(33, 150, 243, 0.1);
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.5);
    z-index: 3;
}
.avatar-item.selected img {
    animation: bounceAvatar 0.5s infinite alternate;
}

@keyframes bounceAvatar {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

/* Scrollbar Tasarımı (Webkit) */
.avatar-grid-container::-webkit-scrollbar {
    width: 8px;
}
.avatar-grid-container::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
.avatar-grid-container::-webkit-scrollbar-thumb {
    background: #ccc; 
    border-radius: 4px;
}
.avatar-grid-container::-webkit-scrollbar-thumb:hover {
    background: #aaa; 
}

/* --- 3D AVATAR DÜZELTMESİ --- */
.emoji-img {
    width: 40px; 
    height: 40px; 
    object-fit: contain; 
    vertical-align: middle;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

/* Chat ve liste içindeki boyutlar */
.mesaj-gonderen .emoji-img { width: 20px; height: 20px; }
.oyuncu-adi .emoji-img { width: 30px; height: 30px; }
.podyum-avatar .emoji-img { width: 80px; height: 80px; } /* Podyumda büyük */