/* SaseKY Test Quiz — vanilla CSS, mobile-first */

:root {
  --primary: #1F3A5F;
  --primary-light: #2E5077;
  --accent: #2E7D8A;
  --bg: #F4F6F9;
  --surface: #ffffff;
  --border: #B0BEC5;
  --border-light: #E0E5EA;
  --text: #1A1A1A;
  --text-muted: #555;
  --text-light: #888;
  --ok: #2E7D32;
  --partial: #F57C00;
  --failed: #C62828;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--text);
  background: var(--bg); height: 100%;
}

body { min-height: 100vh; }

.hidden { display: none !important; }

a { color: var(--accent); }
a:hover { color: var(--primary); }

.req { color: var(--failed); }

/* Yükleniyor */
.loading-screen {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; z-index: 1000;
}
.spinner {
  width: 40px; height: 40px; border: 4px solid var(--border-light);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Ekran wrapper */
.screen { min-height: 100vh; }
.container {
  max-width: 720px; margin: 0 auto; padding: 24px 16px 80px;
}

/* Karşılama */
.welcome-header {
  text-align: center; margin-bottom: 32px; padding-top: 24px;
}
.welcome-header h1 {
  margin: 0; color: var(--primary); font-size: 32px; font-weight: 700;
}
.subtitle { color: var(--accent); font-size: 18px; margin: 8px 0 0; }

.info-box {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; margin-bottom: 24px; box-shadow: var(--shadow);
}
.info-box h2 { margin: 0 0 12px; color: var(--primary); font-size: 18px; }
.info-box p { margin: 0 0 12px; color: var(--text-muted); font-size: 14px; }
.info-box p:last-child { margin-bottom: 0; }

.resume-banner {
  display: flex; align-items: center; gap: 12px;
  background: #FFF3E0; border: 1px solid #FFB74D;
  padding: 16px; border-radius: var(--radius); margin-bottom: 20px;
}
.resume-icon { font-size: 24px; color: #F57C00; }
.resume-text { flex: 1; font-size: 14px; }
.resume-text strong { display: block; color: var(--primary); }

.welcome-form {
  background: var(--surface); padding: 24px;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.field { margin-bottom: 16px; }
.field label {
  display: block; font-weight: 500; margin-bottom: 6px; font-size: 14px;
}
.field input[type="text"],
.field input[type="email"],
.field select,
.field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 15px; font-family: inherit;
  background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 60px; }
.field .hint { display: block; font-size: 12px; color: var(--text-light); margin-top: 4px; }

.radios { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 4px; }
.radios label { font-weight: normal; font-size: 14px; }
.radios input { margin-right: 6px; }

.honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; }

.btn {
  display: inline-block; padding: 10px 20px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: inherit; text-align: center;
  transition: background 0.15s;
}
.btn:hover { background: var(--bg); }
.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-light); }
.btn-block { width: 100%; padding: 12px; font-size: 16px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg {
  background: #FFEBEE; color: var(--failed);
  padding: 10px; border-radius: 6px; margin: 12px 0; font-size: 14px;
}

.resume-link-wrap {
  text-align: center; margin-top: 16px;
}
.resume-link-wrap a { font-size: 13px; color: var(--text-muted); }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 16px;
}
.modal-content {
  background: #fff; border-radius: var(--radius);
  padding: 24px; max-width: 480px; width: 100%; box-shadow: var(--shadow);
}
.modal-content h3 { margin: 0 0 12px; color: var(--primary); }
.modal-content input {
  width: 100%; padding: 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 15px; margin-top: 8px;
}
.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px;
}

/* Quiz Header */
.quiz-header {
  background: var(--primary); color: #fff;
  padding: 12px 16px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.menu-toggle {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.3);
  width: 36px; height: 36px; border-radius: 6px; font-size: 18px; cursor: pointer;
}
.quiz-header h1 { margin: 0; font-size: 16px; font-weight: 600; flex-shrink: 0; }
.progress { flex: 1; min-width: 100px; }
.progress span { font-size: 12px; color: rgba(255,255,255,0.85); }
.progress-bar {
  height: 4px; background: rgba(255,255,255,0.2);
  border-radius: 2px; overflow: hidden; margin-top: 4px;
}
#progress-fill { height: 100%; background: #4FC3F7; transition: width 0.3s; }
.quiz-actions { display: flex; gap: 8px; }
.quiz-actions .btn { padding: 8px 14px; font-size: 13px; }
.quiz-actions .btn-ghost { color: rgba(255,255,255,0.85); }
.quiz-actions .btn-ghost:hover { background: rgba(255,255,255,0.1); }

/* Quiz Body */
.quiz-body { display: flex; min-height: calc(100vh - 60px); }

.sidebar {
  width: 300px; background: var(--surface);
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  position: sticky; top: 60px;
}
#toc { padding: 16px 12px; }
.toc-section {
  margin-bottom: 4px;
}
.toc-section-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 8px; font-weight: 600; font-size: 14px;
  background: var(--bg); border-radius: 4px; cursor: pointer;
  user-select: none;
}
.toc-section-header:hover { background: #E8EEF4; }
.toc-section-header .arrow {
  font-size: 11px; transition: transform 0.2s;
}
.toc-section.expanded .arrow { transform: rotate(90deg); }
.toc-section-progress {
  margin-left: auto; font-size: 12px; color: var(--text-muted);
  font-weight: normal;
}
.toc-scenarios { display: none; padding: 4px 0 4px 12px; }
.toc-section.expanded .toc-scenarios { display: block; }
.toc-scenario {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; font-size: 13px; border-radius: 4px;
  cursor: pointer; color: var(--text-muted);
}
.toc-scenario:hover { background: var(--bg); }
.toc-scenario.active {
  background: var(--accent); color: #fff;
}
.toc-scenario.answered { color: var(--text); }
.toc-scenario .status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
}
.toc-scenario.answered.ok    .status-dot { background: var(--ok); border-color: var(--ok); }
.toc-scenario.answered.partial .status-dot { background: var(--partial); border-color: var(--partial); }
.toc-scenario.answered.failed .status-dot { background: var(--failed); border-color: var(--failed); }
.toc-scenario.active .status-dot { background: #fff; border-color: #fff; }

.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 40;
}

/* Quiz Main */
.quiz-main {
  flex: 1; padding: 24px;
  max-width: 800px; margin: 0 auto;
  width: 100%;
}

#scenario-container {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); margin-bottom: 16px;
}

.scenario-id {
  display: inline-block; background: var(--primary); color: #fff;
  padding: 4px 10px; border-radius: 4px; font-weight: 600; font-size: 13px;
  margin-bottom: 8px;
}
.scenario-title {
  margin: 0 0 16px; font-size: 20px; font-weight: 600; color: var(--text);
}
.scenario-section {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light);
}
.scenario-section:first-of-type { border-top: 0; padding-top: 0; }
.scenario-section h4 {
  margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--primary);
}
.scenario-steps { padding-left: 20px; margin: 0; }
.scenario-steps li { margin-bottom: 6px; font-size: 14px; }
.scenario-note {
  background: #FFF8E1; border-left: 3px solid #FFB300;
  padding: 10px 12px; font-size: 13px; color: var(--text-muted);
  margin: 12px 0 0; border-radius: 4px;
  font-style: italic;
}

.expected-list { list-style: none; padding: 0; margin: 0; }
.expected-list li {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 0; font-size: 14px;
}
.expected-list input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; }

.outcome-radios {
  display: grid; gap: 8px; margin: 8px 0;
}
.outcome-radios label {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 14px;
}
.outcome-radios label:has(input:checked) {
  border-color: var(--accent); background: #E8F4F8;
}
.outcome-radios .icon-ok    { color: var(--ok); }
.outcome-radios .icon-partial { color: var(--partial); }
.outcome-radios .icon-failed  { color: var(--failed); }

.description-field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; font-family: inherit;
  min-height: 80px; resize: vertical;
}
.description-field .hint {
  display: block; font-size: 12px; color: var(--text-light); margin-top: 4px;
}
.description-field.required textarea { border-color: var(--partial); }

.attachments-list {
  list-style: none; padding: 0; margin: 8px 0;
}
.attachments-list li {
  display: flex; align-items: center; gap: 8px; padding: 8px;
  background: var(--bg); border-radius: 4px; font-size: 13px; margin-bottom: 4px;
}
.attachments-list li .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachments-list li .file-size { color: var(--text-light); font-size: 12px; }
.attachments-list li button {
  background: transparent; border: none; color: var(--failed); cursor: pointer; font-size: 18px;
}
.upload-btn {
  display: inline-block; padding: 8px 14px; border: 1px dashed var(--border);
  border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-muted);
}
.upload-btn:hover { background: var(--bg); }
.upload-btn input { display: none; }
.upload-info { display: block; font-size: 12px; color: var(--text-light); margin-top: 4px; }
.upload-error { color: var(--failed); font-size: 13px; margin-top: 4px; }

.scenario-nav {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 0;
}
.scenario-nav button { flex-shrink: 0; }
.autosave-indicator {
  flex: 1; text-align: center; font-size: 12px; color: var(--text-light);
  transition: opacity 0.3s; opacity: 0;
}
.autosave-indicator.show { opacity: 1; }
.autosave-indicator.saving { color: var(--accent); }
.autosave-indicator.error { color: var(--failed); }

/* Teşekkür */
.thanks-container { text-align: center; padding-top: 60px; }
.thanks-icon {
  width: 80px; height: 80px; line-height: 80px; border-radius: 50%;
  background: var(--ok); color: #fff; font-size: 48px;
  margin: 0 auto 24px;
}
#thanks-summary { text-align: left; }

/* Mobile */
@media (max-width: 880px) {
  .quiz-header h1 { display: none; }
  .sidebar {
    position: fixed; top: 60px; left: 0; bottom: 0;
    width: 280px; z-index: 50; transform: translateX(-100%);
    transition: transform 0.25s; max-height: none;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .quiz-main { padding: 16px; }
  .quiz-actions .btn { padding: 6px 10px; font-size: 12px; }
}

@media (max-width: 480px) {
  .welcome-header h1 { font-size: 26px; }
  .container { padding: 16px 12px 60px; }
  .quiz-header h1, .progress { display: none; }
  .quiz-actions { margin-left: auto; }
  #scenario-container { padding: 16px; }
}
