:root {
  /* 2026-10-01 (kullanıcı talebi: "TGS'nin web sitesiyle uyumlu hale getir") - TGS_WEB'in
     style.css'indeki RESMİ TGS Kırmızısı paletiyle (--primary-red/--primary-dark/--accent-red
     vb.) birebir eşlendi - bu dosya TÜM training-app sayfalarında ortak kullanıldığı için
     (sidebar, butonlar, formlar, kayit.php dahil) burada yapılan değişiklik sitenin tamamını
     kapsıyor, tek bir sayfaya özel geçersiz kılma eklemek yerine kök kaynaktan düzeltildi. */
  --primary: #8b151b;
  --primary-hover: #a31d23;
  --secondary: #10B981;
  --background: #fafafa;
  --surface: #FFFFFF;
  --text: #0f172a;
  --text-muted: #64748b;
  --danger: #8b151b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 2026-10-01 (kullanıcı talebi: "web sayfasına dön" butonu) - auth-container pozisyonlu
   (relative) yapılıp sol üste sabitlenen bir geri dönüş linki eklendi; index.php/kayit.php'nin
   ikisinde de kullanılıyor. */
.back-to-site-btn {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
  z-index: 10;
}

.back-to-site-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Authentication Layout */
.auth-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 100vh;
  background: linear-gradient(135deg, #8b151b 0%, #4a090c 100%);
  padding: 1rem;
  gap: 2rem;
}

/* 2026-10-01 (kullanıcı talebi: kayit.php'nin sol tarafına logo+tanıtım metni) -
   .auth-container'ın (index.php/forgot_password.php/reset_password.php ile PAYLAŞILAN)
   yanına EK bir kardeş eleman olarak eklenir - o sayfalarda bu sınıf hiç kullanılmadığı için
   onların tek-sütunlu görünümüne dokunmaz. Dar ekranlarda (flex-wrap sayesinde) forma göre
   ÜSTTE yığılır, gizlenmez. */
.auth-brand-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: #ffffff;
  max-width: 360px;
  padding: 1rem;
}

.auth-brand-panel img {
  max-width: 170px;
  height: auto;
  margin-bottom: 1.5rem;
}

.auth-brand-panel p {
  font-size: 0.95rem;
  line-height: 1.65;
  opacity: 0.95;
}

.auth-brand-panel a {
  color: #ffffff;
  font-weight: 700;
  text-decoration: underline;
}

.auth-card {
  background: var(--surface);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 400px;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s;
  background-color: #F9FAFB;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

/* Dashboard Layout */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background-color: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.sidebar-brand img {
  max-width: 120px;
  height: auto;
}

.sidebar-brand span {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: all 0.2s;
  font-weight: 500;
}

.nav-item:hover, .nav-item.active {
  background-color: rgba(79, 70, 229, 0.1);
  color: var(--primary);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
}

.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-error {
  background-color: #FEF2F2;
  color: var(--danger);
  border: 1px solid #FECACA;
}

.alert-success {
  background-color: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  border: 1px solid var(--border);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
}
.stat-title {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

/* TGS Portal Integration */
body.hide-sidebar .sidebar {
  display: none !important;
}

body.hide-sidebar .main-content {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 1rem !important;
}

body.hide-sidebar .dashboard {
  display: block;
}

/* Mobile Responsiveness & Layout Overrides */
@media (max-width: 768px) {
  /* Force tables to be scrollable in container and have minimum width */
  .table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .table-container table {
    min-width: 800px !important;
  }
  
  /* Convert inline display: flex form group inputs into columns */
  .form-group[style*="display: flex"],
  .form-group[style*="display:flex"] {
    flex-direction: column !important;
    gap: 1rem !important;
  }
  .form-group[style*="display: flex"] > div,
  .form-group[style*="display:flex"] > div {
    width: 100% !important;
  }
  .form-group[style*="display: flex"] input,
  .form-group[style*="display:flex"] input {
    max-width: none !important;
  }

  /* Two-column grids inside training panels (like course viewer) should stack */
  div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  
  header.page-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1rem !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
}
