/* =========================================================
   1. GENEL TEMA VE SIFIRLAMA (RESET)
   ========================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #121212;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Light Theme Desteği */
body.light-theme {
  background-color: #f4f6f9;
  color: #2c3e50;
}

body.light-theme .app-header,
body.light-theme .board-card,
body.light-theme .cat-card,
body.light-theme .modal-card {
  background-color: #ffffff;
  color: #2c3e50;
  border-color: #e0e0e0;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

body.light-theme .main-nav {
  background-color: #e2e8f0;
}

body.light-theme .nav-btn.active {
  background-color: #ffffff;
  color: #2c3e50;
}

/* =========================================================
   2. ÜST HEADER VE ELO ALANI
   ========================================================= */
.app-header {
  background-color: #1e1e1e;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #2d2d2d;
}

.logo-area h1 {
  font-size: 1.6rem;
  color: #00ff66;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.logo-area .tagline {
  font-size: 0.85rem;
  color: #aaa;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 15px;
  background-color: #2a2a2a;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid #3d3d3d;
}

.user-badge select {
  background: #1e1e1e;
  color: #fff;
  border: 1px solid #444;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  font-size: 0.85rem;
}

/* Sağ Üst Kullanıcı Adı ve Çıkış Butonları Alanı */
.header-user-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-header-user {
  background: transparent;
  border: none;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-header-logout {
  background-color: #e74c3c;
  color: #fff;
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-header-logout:hover {
  background-color: #c0392b;
}

.header-elo-display {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.95rem;
  color: #00ff66;
  font-weight: 600;
}

/* =========================================================
   3. GENEL BUTON VE PANEL DÜZENİ (CENTERED & FULL WIDTH)
   ========================================================= */
.btn-primary {
  width: 100%;
  padding: 12px;
  background-color: #00ff66;
  border: none;
  border-radius: 6px;
  color: #121212;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background-color: #00993d;
  color: #fff;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
  flex: 1;
}

.main-nav {
  display: flex;
  gap: 10px;
  background-color: #1e1e1e;
  padding: 6px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.nav-btn {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  color: #aaa;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn.active {
  background-color: #2a2a2a;
  color: #00ff66;
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

.centered-grid {
  display: flex;
  justify-content: center;
  width: 100%;
}

.full-width-card {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* =========================================================
   4. SATRANÇ TAHTASI VE KART BİLEŞENLERİ
   ========================================================= */
.board-card {
  background-color: #1e1e1e;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #2d2d2d;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.board-card h2 {
  font-size: 1.35rem;
  margin-bottom: 6px;
  width: 100%;
  text-align: left;
}

.sub-text {
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 12px;
  width: 100%;
  text-align: left;
}

.turn-indicator {
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 1rem;
  color: #f1c40f;
}

.board-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-action {
  padding: 10px 18px;
  background-color: #2a2a2a;
  border: 1px solid #3d3d3d;
  color: #fff;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  background-color: #383838;
  border-color: #00ff66;
}

.btn-action.highlight {
  background-color: #27ae60;
  border-color: #27ae60;
}

.btn-action.highlight:hover {
  background-color: #219150;
}

/* =========================================================
   T GÖRSELİNDEKİ TAHTA RENKLERİ VE BİÇİMLENDİRMESİ
   ========================================================= */
.chess-board {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  border: 6px solid #886868 !important;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

/* Açık Kareler */
.chess-board .square-55d63.white-1e1d7,
.chess-board .white-1e1d7 {
  background-color: #f8ebeb !important;
  color: #c9a0a0;
}

/* Koyu Kareler */
.chess-board .square-55d63.black-3c85d,
.chess-board .black-3c85d {
  background-color: #c9a0a0 !important;
  color: #f8ebeb;
}

/* Vurgu ve Hamle Renkleri (T Görseline Uygun Pembe/Gül Tonları) */
.chess-board .square-55d63.last-move::before {
  background-color: rgba(212, 140, 140, 0.45) !important;
}

.chess-board .square-55d63.selected-square::before {
  background-color: rgba(180, 100, 100, 0.5) !important;
}

.chess-board .square-55d63.legal-move::after {
  background: radial-gradient(rgba(140, 70, 70, 0.45) 19%, transparent 20%) !important;
}

.chess-board .square-55d63.legal-move-capture::after {
  background: radial-gradient(transparent 0%, transparent 79%, rgba(140, 70, 70, 0.35) 80%) !important;
}

/* =========================================================
   5. SAYFA 2: KATEGORİ IZGARASI VE ARAMA
   ========================================================= */
.search-bar {
  margin-bottom: 20px;
}

.search-bar input {
  width: 100%;
  padding: 12px 16px;
  background-color: #1e1e1e;
  border: 1px solid #3d3d3d;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}

.search-bar input:focus {
  border-color: #00ff66;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 15px;
}

.cat-card {
  background-color: #1e1e1e;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #2d2d2d;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.cat-card:hover {
  transform: translateY(-3px);
  border-color: #00ff66;
}

.cat-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
  color: #00ff66;
}

.cat-card p {
  font-size: 0.8rem;
  color: #aaa;
  line-height: 1.4;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 12px;
}

.btn-back {
  background: transparent;
  border: none;
  color: #00ff66;
  cursor: pointer;
  font-weight: 600;
}

.diff-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  width: 100%;
}

.diff-btn {
  flex: 1;
  padding: 8px;
  background-color: #2a2a2a;
  border: 1px solid #3d3d3d;
  color: #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.diff-btn.active {
  background-color: #00cc52;
  color: #fff;
  border-color: #00cc52;
}

/* =========================================================
   6. MODAL (ELO POPUP)
   ========================================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background-color: #1e1e1e;
  width: 90%;
  max-width: 400px;
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  position: relative;
  border: 1px solid #3d3d3d;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.modal-card h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: #00ff66;
}

/* =========================================================
   7. LICHESS TARZI TAHTA ETKİLEŞİMLERİ & ANİMASYONLAR
   ========================================================= */
.square-55d63 img, img[data-piece] {
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.square-55d63 .piece-417db {
  transition: transform 150ms ease-in-out, opacity 100ms ease;
  will-change: transform;
}

body > img[src*="wikipedia"] {
  z-index: 9999 !important;
  transform: scale(1.08);
  filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.3));
}

.chess-board {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.chess-board .square-55d63 {
  position: relative;
  cursor: pointer;
}

.chess-board .square-55d63 .piece-417db {
  position: relative;
  z-index: 2;
  cursor: grab;
}

.chess-board .square-55d63.last-move::before,
.chess-board .square-55d63.selected-square::before,
.chess-board .square-55d63.highlight1-32417::before,
.chess-board .square-55d63.right-move::before,
.chess-board .square-55d63.wrong-move::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.chess-board .square-55d63.right-move::before {
  background-color: rgba(70, 200, 90, 0.55);
}

.chess-board .square-55d63.wrong-move::before {
  background-color: rgba(230, 60, 60, 0.6);
}

.chess-board .square-55d63.legal-move::after,
.chess-board .square-55d63.legal-move-capture::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.chess-board .square-55d63.legal-move:hover::after,
.chess-board .square-55d63.legal-move-capture:hover::after {
  background: rgba(140, 70, 70, 0.3);
}

body > img.piece-417db {
  cursor: grabbing;
  pointer-events: none;
}

.chess-board .highlight1-32417,
.chess-board .highlight2-9c5d2 {
  box-shadow: none;
}

/* Auth Modal Buton Stilleri */
.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.auth-buttons button {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

/* Birincil Buton (Log In) */
.btn-primary {
  background-color: #00ff66;
  color: #121212;
}

.btn-primary:hover {
  background-color: #00cc52;
}

/* İkincil Buton (Sign Up) */
.btn-secondary {
  background-color: #2c3e50;
  color: #ffffff;
  border: 1px solid #34495e !important;
}

.btn-secondary:hover {
  background-color: #34495e;
}

/* Çerçeveli Buton (Continue as Guest / Back) */
.btn-outline {
  background-color: transparent;
  color: #bdc3c7;
  border: 1px solid #7f8c8d !important;
}

.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

/* =========================================================
   MODAL FORM GİRDİLERİ VE BUTON DÜZENLEMELERİ
   ========================================================= */
.modal-card input[type="text"],
.modal-card input[type="email"],
.modal-card input[type="password"],
.modal-card input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  margin: 8px 0;
  background-color: #121212;
  border: 1px solid #3d3d3d;
  border-radius: 8px;
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.modal-card input:focus {
  border-color: #00ff66;
}

.modal-card button {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.modal-card .btn-outline {
  background-color: transparent;
  color: #bdc3c7;
  border: 1px solid #7f8c8d !important;
}

.modal-card .btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  border-color: #00ff66 !important;
}

/* =========================================================
   8. KULLANICI İSTATİSTİKLERİ VE BULMACA GEÇMİŞİ LİSTESİ
   ========================================================= */
#solvedPuzzlesListContainer::-webkit-scrollbar {
  width: 6px;
}

#solvedPuzzlesListContainer::-webkit-scrollbar-thumb {
  background: #3d3d3d;
  border-radius: 3px;
}

.puzzle-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: #1e1e1e;
  border-radius: 6px;
  border: 1px solid #2d2d2d;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  font-size: 0.85rem;
}

.puzzle-history-item:hover {
  background: #2a2a2a;
  border-color: #00ff66;
}

/* =========================================================
   ADSENSE REKLAM DÜZENLEMESİ (BOŞLUK GİDERİCİ)
   ========================================================= */
ins.adsbygoogle:not([data-ad-status="filled"]) {
  display: none !important;
}