/* === ORTAK LAYOUT — TÜM SAYFALAR KULLANIR === */
:root {
  --sidebar-w: 260px;
  --header-h: 60px;
  --bg: #0a0a0a;
  --bg-card: #0f0f0f;
  --bg-hover: #131313;
  --border: #1a1a1a;
  --border-hover: #2a2a2a;
  --text: #e5e5e5;
  --text-dim: #a3a3a3;
  --text-mute: #666;
  --accent: #22c55e;
  --accent-bright: #4ade80;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === GRID BG === */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(34, 197, 94, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 197, 94, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at top, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at top, black 20%, transparent 70%);
}

/* === HEADER === */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 20px;
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.site-header .brand-icon {
  width: 32px; height: 32px;
  filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.4));
}
.site-header .brand-text {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}
.site-header .brand-text em {
  font-style: normal;
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.header-search input {
  width: 100%;
  padding: 8px 14px 8px 38px;
  background: #131313;
  border: 1px solid #232323;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.15s;
  font-family: inherit;
}
.header-search input:focus {
  border-color: var(--accent);
  background: #161616;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}
.header-search input::placeholder { color: #666; }
.header-search::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  opacity: 0.5;
  pointer-events: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  min-width: 0;
}
.header-right #userArea {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hamburger {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
}
.hamburger:hover { background: #1a1a1a; }

/* === LAYOUT === */
.layout-wrap {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  padding-top: var(--header-h);
  min-height: 100vh;
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.site-sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 20px 12px 40px 20px;
  border-right: 1px solid #131313;
}
.site-sidebar::-webkit-scrollbar { width: 4px; }
.site-sidebar::-webkit-scrollbar-thumb { background: #232323; border-radius: 2px; }

.side-section { margin-bottom: 22px; }
.side-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #555;
  padding: 0 10px;
  margin-bottom: 6px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.12s;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.side-link:hover {
  background: #151515;
  color: var(--text);
}
.side-link.active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--accent-bright);
}
.side-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.side-count {
  margin-left: auto;
  font-size: 0.7rem;
  color: #555;
  background: #131313;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}

.layout-main {
  padding: 24px 0 60px 32px;
  min-width: 0;
  max-width: 100%;
}

/* İçerik konteynerı - okunabilir genişlik */
.content-wrap {
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 900px) {
  .content-wrap { max-width: 100%; }
  .layout-wrap { padding-left: 0; padding-right: 0; }
  .layout-main { padding: 16px 14px 60px; }
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.page-sub {
  color: #666;
  font-size: 0.875rem;
  margin: 0 0 24px;
}

/* === UTILITY === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #000;
  font-weight: 800;
  font-size: 0.85rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.35);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: transparent;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.85rem;
  border: 1px solid #232323;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-ghost:hover {
  background: #131313;
  color: var(--text);
  border-color: #333;
}

input, textarea, select {
  width: 100%;
  padding: 10px 14px;
  background: #0f0f0f;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: all 0.15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  background: #121212;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}
input::placeholder, textarea::placeholder { color: #555; }
textarea { resize: vertical; min-height: 100px; line-height: 1.55; }

label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
}

/* === MOBILE === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 40;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

@media (max-width: 900px) {
  .layout-wrap { grid-template-columns: 1fr; }
  .site-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    height: calc(100vh - var(--header-h));
    width: var(--sidebar-w);
    background: #0a0a0a;
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 45;
    padding: 16px 10px 40px 14px;
  }
  .site-sidebar.open { transform: translateX(0); }
  .hamburger { display: flex; }
  .header-search { display: none; }
  .layout-main { padding: 16px 14px 60px; }
  .site-header .brand-text { font-size: 1rem; }
}


/* === CENTERED LAYOUT (Login/Verify) === */
body[data-layout="centered"] .site-sidebar { display: none !important; }
body[data-layout="centered"] .layout-wrap {
  grid-template-columns: 1fr !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
body[data-layout="centered"] .header-search { display: none !important; }
body[data-layout="centered"] .hamburger { display: none !important; }

.auth-card {
  background: #0f0f0f;
  border: 1px solid #1a1a1a;
  border-radius: 14px;
  padding: 28px;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  background: #0a0a0a;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #1a1a1a;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: 7px;
  background: transparent;
  border: none;
  color: #888;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.auth-tab.active {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #000;
}
.auth-tab:hover:not(.active) { color: #e5e5e5; }

.auth-field {
  margin-bottom: 16px;
}
.auth-field label {
  display: block;
  font-size: 0.82rem;
  color: #a3a3a3;
  margin-bottom: 6px;
  font-weight: 600;
}
.auth-field label .optional {
  color: #666;
  font-weight: 400;
  font-size: 0.75rem;
}
.auth-field input {
  width: 100%;
  padding: 11px 14px;
  background: #0a0a0a;
  border: 1px solid #232323;
  border-radius: 9px;
  color: #e5e5e5;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: all 0.15s;
}
.auth-field input:focus {
  border-color: #22c55e;
  background: #0e0e0e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.auth-hint {
  font-size: 0.78rem;
  color: #666;
  margin-top: 6px;
  line-height: 1.5;
}
.auth-hint strong { color: #4ade80; }

.auth-submit {
  width: 100%;
  padding: 12px;
  border-radius: 9px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #000;
  border: none;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  font-family: inherit;
  margin-top: 8px;
  transition: all 0.15s;
}
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-error {
  padding: 11px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 9px;
  color: #fca5a5;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}
.auth-error.show { display: block; }

.auth-title {
  text-align: center;
  margin-bottom: 24px;
}
.auth-title h1 {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.auth-title p {
  color: #666;
  font-size: 0.85rem;
  margin: 0;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.82rem;
  color: #666;
}
.auth-footer a {
  color: #4ade80;
  text-decoration: none;
  font-weight: 600;
}
.auth-footer a:hover { text-decoration: underline; }

/* === LIGHT THEME === */
body[data-theme="light"] {
  --bg: #f8f8f8;
  --bg-card: #ffffff;
  --bg-hover: #f0f0f0;
  --border: #e5e5e5;
  --border-hover: #d4d4d4;
  --text: #1a1a1a;
  --text-dim: #666;
  --text-mute: #999;
  --accent: #16a34a;
  --accent-bright: #22c55e;
}

body[data-theme="light"] {
  background: var(--bg) !important;
  color: var(--text) !important;
}
body[data-theme="light"] .grid-bg {
  background-image:
    linear-gradient(rgba(34, 197, 94, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 197, 94, 0.06) 1px, transparent 1px);
}
body[data-theme="light"] .site-header {
  background: rgba(248, 248, 248, 0.9);
  border-bottom-color: var(--border);
}
body[data-theme="light"] .site-header .brand-text { color: #1a1a1a; }
body[data-theme="light"] .header-search input {
  background: #ffffff;
  border-color: #e5e5e5;
  color: #1a1a1a;
}
body[data-theme="light"] .header-search input:focus {
  background: #ffffff;
}
body[data-theme="light"] .site-sidebar {
  background: var(--bg);
  border-right-color: var(--border);
}
body[data-theme="light"] .side-link {
  color: #555;
}
body[data-theme="light"] .side-link:hover {
  background: #f0f0f0;
  color: #1a1a1a;
}
body[data-theme="light"] .side-link.active {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}
body[data-theme="light"] .side-count {
  background: #f0f0f0;
  color: #888;
}
body[data-theme="light"] .side-label { color: #888; }
body[data-theme="light"] .page-title { color: #1a1a1a; }
body[data-theme="light"] .page-sub { color: #888; }

/* Light theme'de özel sayfa stilleri */
body[data-theme="light"] .thread-main,
body[data-theme="light"] .thread-card,
body[data-theme="light"] .comment,
body[data-theme="light"] .profile-card,
body[data-theme="light"] .auth-card,
body[data-theme="light"] .card,
body[data-theme="light"] .hero-stat {
  background: #ffffff !important;
  border-color: #e5e5e5 !important;
}
body[data-theme="light"] .thread-card:hover {
  background: #f8f8f8 !important;
  border-color: #d4d4d4 !important;
}
body[data-theme="light"] .thread-card-title { color: #1a1a1a; }
body[data-theme="light"] .thread-h1 { color: #1a1a1a !important; }
body[data-theme="light"] .thread-meta { color: #888; }
body[data-theme="light"] .comment-body,
body[data-theme="light"] .rich-content { color: #1a1a1a; }
body[data-theme="light"] .rich-content strong,
body[data-theme="light"] .rich-content b { color: #1a1a1a; }
body[data-theme="light"] .rich-content code { background: #f0f0f0; color: #16a34a; border-color: #d4d4d4; }
body[data-theme="light"] .rich-content pre { background: #f5f5f5; border-color: #e5e5e5; }
body[data-theme="light"] .rich-content pre code { color: #1a1a1a; }
body[data-theme="light"] .rich-content blockquote { background: rgba(34,197,94,0.06); color: #666; }
body[data-theme="light"] .user-card,
body[data-theme="light"] .category-row,
body[data-theme="light"] .user-row {
  background: #ffffff !important;
  border-color: #e5e5e5 !important;
}
body[data-theme="light"] .user-card:hover { background: #f8f8f8 !important; }
body[data-theme="light"] .user-name { color: #1a1a1a; }
body[data-theme="light"] .search-input,
body[data-theme="light"] .auth-field input,
body[data-theme="light"] .form-row input,
body[data-theme="light"] .form-row select,
body[data-theme="light"] .form-row textarea,
body[data-theme="light"] .bio-textarea {
  background: #f8f8f8 !important;
  border-color: #e5e5e5 !important;
  color: #1a1a1a !important;
}
body[data-theme="light"] .auth-card,
body[data-theme="light"] .auth-tabs,
body[data-theme="light"] .code-input { background: #f0f0f0 !important; }
body[data-theme="light"] .auth-tab { color: #888; }
body[data-theme="light"] .auth-tab:hover { color: #1a1a1a; }
body[data-theme="light"] .auth-tab.active { color: #fff; }
body[data-theme="light"] .footer { color: #888; }
body[data-theme="light"] .section-title { color: #1a1a1a; }

/* Tema toggle butonu */
.theme-toggle {
  background: transparent;
  border: 1px solid #232323;
  color: #a3a3a3;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
  padding: 0;
}
.theme-toggle:hover {
  border-color: #22c55e;
  color: #4ade80;
  transform: scale(1.05);
}
body[data-theme="light"] .theme-toggle {
  border-color: #d4d4d4;
  color: #666;
}
body[data-theme="light"] .theme-toggle:hover {
  border-color: #16a34a;
  color: #16a34a;
}
