/* ===== RENK & ATMOSFER ===== */
:root {
  --primary: #4a6fa5;
  --accent: #6fb3a2;
  --bg: #f3f4f6;
  --card: #ffffff;
  --border: #e3e7ee;
  --text: #2f3640;
  --muted: #7f8c8d;
  --shadow: 0 8px 20px rgba(0,0,0,.06);

  --btn-primary: #2c7be5;
  --btn-primary-hover: #1a5dcc;
  --btn-success: #28a745;
  --btn-success-hover: #1e7e34;
  --btn-secondary: #6c757d;
  --btn-secondary-hover: #5a6268;
}

/* ===== LAYOUT ===== */
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 20px;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
}
.page {
  max-width: 980px;
  margin: 0 auto;
}

/* ===== KART ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card h2{
  margin: 0;
  font-size: 16px;
  color: var(--primary);
}
.muted { color: var(--muted); font-size: 13px; }
.hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* ===== TOPBAR ===== */
.topbar{
  display:flex;
  gap: 14px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
}
.topbar-left { flex: 1; min-width: 260px; }
.topbar-right { display:flex; gap: 10px; flex-wrap: wrap; }

/* ===== FORM ===== */
.field { display:flex; flex-direction:column; gap: 6px; }
.field-label { font-size: 13px; color: var(--text); }

select, input[type="text"], input[type="date"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  outline: none;
}
textarea{
  min-height: 90px;
  resize: vertical;
  line-height: 1.4;
}

.grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 900px){
  .grid { grid-template-columns: 1fr; }
}

/* ===== BUTONLAR (tek yer) ===== */
.btn{
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  transition: background-color .2s ease, transform .1s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(0.98); }
.btn:hover { box-shadow: 0 6px 14px rgba(0,0,0,.15); }

.btn-primary{ background: var(--btn-primary); }
.btn-primary:hover{ background: var(--btn-primary-hover); }

.btn-success{ background: var(--btn-success); }
.btn-success:hover{ background: var(--btn-success-hover); }

.btn-secondary{ background: var(--btn-secondary); }
.btn-secondary:hover{ background: var(--btn-secondary-hover); }

.action-buttons { display:flex; gap: 10px; flex-wrap: wrap; }

/* ===== SORU KARTI ===== */
.question {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  line-height: 1.65;
  margin-bottom: 20px;
}

.scale-title {
  color: var(--primary);
  font-weight: 700;
}

/* ===== SEÇENEKLER ===== */
.options label {
  display: inline-block;
  margin-right: 14px;
  margin-top: 6px;
  cursor: pointer;
}
input[type="radio"] { accent-color: var(--accent); }

.optText{
  color: var(--text) !important;
  font-size: 14px !important;
  display: inline !important;
}

/* Scale 15 gibi çift kolon */
.dual-options { display: flex; gap: 18px; margin-top: 8px; }
.side { flex: 1; border: 1px solid #ddd; padding: 10px; border-radius: 8px; }
.side-title { font-weight: 700; margin-bottom: 8px; }

/* ===== SONUÇ ===== */
#resultArea {
  background: #eef6f4;
  border-left: 5px solid var(--accent);
  padding: 16px;
  border-radius: 10px;
  white-space: pre-wrap;
}

/* ===== ARŞİV ===== */
#archiveList{ display:flex; flex-direction:column; gap: 10px; }

.archive-item{
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display:flex;
  justify-content:space-between;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,.04);
}
.archive-actions{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.tiny{ font-size: 12px; color: var(--muted); }

/* ===== PRINT UYUMLU ===== */
@media print {
  body { background: #fff; padding: 0; }
  .card { box-shadow: none; border: none; padding: 0; margin: 0; }
  .question { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }

  /* UI kontrolleri basılmasın */
  .topbar,
  #reportMetaCard,
  #archiveCard,
  #btnPrint,
  #btnWord,
  #submitBtn,
  #btnSaveReport,
  #btnOpenArchive {
    display: none !important;
  }
}
/* ===== Rapor kartı aksiyonları ===== */
.actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  align-items: center;
}

/* Butonların satır içi boyları eşitlensin */
.actions .btn,
.archive-actions .btn{
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
}

/* Arşiv kartında sol metin alanı taşmasın */
.archive-item > div:first-child{
  min-width: 0;
}
.archive-item b{
  display: block;
  line-height: 1.25;
}
.archive-item .tiny{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 520px;
}

/* Mobilde arşiv item daha düzgün */
@media (max-width: 700px){
  .archive-item{
    flex-direction: column;
    align-items: stretch;
  }
  .archive-actions{
    justify-content: flex-start;
  }
  .archive-item .tiny{
    max-width: 100%;
    white-space: normal;
  }
}
#archiveList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.archive-item {
  position: relative;   /* ABSOLUTE varsa ezip geçer */
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}

.archive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* ===== YENİ RENDERER (qcard) GÖRÜNÜM FIX ===== */
.qcard{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.qtitle{
  font-weight: 800;      /* daha koyu */
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 14px;   /* seçeneklerden uzaklaşsın */
}

.opts{
  display: grid;         /* seçenekler alt alta, düzenli */
  gap: 10px;             /* seçenekler arası boşluk */
}

.opt{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
}

.opt:hover{
  background: rgba(0,0,0,0.03);
}
/* ===== SORU METNİ + BOŞLUK (ZORLA) ===== */

/* Eski renderer yapısı */
.question > p{
  font-weight: 800 !important;
  margin-bottom: 14px !important;
}
.question .options{
  margin-top: 10px !important;
}
.question .options label{
  display: block !important;
  margin: 8px 0 !important;
}

/* Yeni renderer yapısı */
.qtitle{ font-weight:800; color:#1f2a37; margin-bottom:12px; }
.opts{ display:flex; flex-wrap:wrap; gap:12px 18px; padding-top:6px; }
.opt{ display:inline-flex; align-items:center; gap:8px; }
.optLabel{ font-weight:600; }
.report-title{ font-size:18px; font-weight:900; margin:10px 0; }
.report-section{ margin-top:14px; }
.qtitle--number-only {
  margin-bottom: 6px;
  font-weight: 700;
}
/* Beck ve benzeri soru bazlı seçenekli testlerde daha temiz görünüm */
.qcard {
  border: 1px solid #e3e8ef;
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 14px;
}

.qtitle--number-only {
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--text);
}

.opts {
  display: grid;
  gap: 8px;
}

.opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #dfe6ef;
  border-radius: 10px;
  background: #fafbfc;
  cursor: pointer;
  transition: all 0.15s ease;
}

.opt:hover {
  background: #f2f6fb;
  border-color: #bfd0e4;
}

.opt input[type="radio"] {
  margin-top: 3px;
  flex: 0 0 auto;
}

.opt span {
  line-height: 1.5;
  color: var(--text);
}

.opt:has(input[type="radio"]:checked) {
  background: #eaf3ff;
  border-color: #7ea7d8;
  box-shadow: 0 0 0 1px rgba(126, 167, 216, 0.15);
}
.opt:has(input[type="radio"]:checked) span {
  font-weight: 600;
}
.opt {
  transition: all 0.2s ease;
}
