/* =============================================================================
   Reportify – Stylesheet
   Mobile-First · Dark + Light Theme
   ========================================================================== */

/* ----------- Theme Variables --------------------------------------------- */
:root,
:root[data-theme="dark"] {
  --bg: #0b0f1a;
  --bg-elev: #131826;
  --bg-elev-2: #1b2236;
  --border: #262e44;
  --text: #e6e9f2;
  --text-dim: #98a0b3;
  --accent: #6c8cff;
  --accent-hover: #8aa4ff;
  --accent-soft: #1d2a55;
  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --bg-glow-1: #1a2347;
  --bg-glow-2: #1a2a3d;
  --radius: 12px;
  --radius-sm: 8px;
}

:root[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-elev: #ffffff;
  --bg-elev-2: #f0f3fa;
  --border: #dde2ed;
  --text: #1a2030;
  --text-dim: #5a6478;
  --accent: #4f6cd6;
  --accent-hover: #3f5cc6;
  --accent-soft: #e0e7ff;
  --success: #22a05a;
  --danger: #d04444;
  --warning: #d18c00;
  --shadow: 0 6px 20px rgba(20, 30, 60, 0.08);
  --bg-glow-1: #dbe5ff;
  --bg-glow-2: #d6ecf5;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(ellipse 100% 50% at 80% 0%, var(--bg-glow-1) 0%, transparent 100%),
    radial-gradient(ellipse 100% 60% at 0% 100%, var(--bg-glow-2) 0%, transparent 100%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding: 16px;
  transition: background 0.25s, color 0.25s;
}

/* ----------- Toolbar (Sprache + Theme) ----------------------------------- */
.toolbar {
  max-width: 560px;
  margin: 0 auto 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.lang-switch, .theme-toggle {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
}
.lang-switch:hover, .theme-toggle:hover { border-color: var(--accent); }
.lang-switch select {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  padding: 0 2px;
}

/* ----------- Container --------------------------------------------------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #4f6cd6);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
}

header h1 { font-size: 1.05rem; font-weight: 600; }
header p { color: var(--text-dim); font-size: 0.82rem; margin-top: 2px; }

/* ----------- Progress Bar + Step-Text ------------------------------------ */
.progress-wrap {
  padding: 14px 22px 0;
}
.progress {
  display: flex;
  gap: 6px;
}
.progress span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-elev-2);
  transition: background 0.25s;
}
.progress span.done { background: var(--accent); }

.progress-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 8px;
  text-align: right;
}

/* ----------- Main / Screens ---------------------------------------------- */
main { padding: 18px 22px 22px; }

.screen { display: none; }
.screen.active {
  display: block;
  animation: fade 0.25s ease-out;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

h2 { font-size: 1.25rem; margin-bottom: 6px; }

.lead {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 18px;
}
.lead.small { font-size: 0.85rem; }

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 22px;
  margin-bottom: 10px;
}

/* ----------- Form Fields ------------------------------------------------- */
.field { margin-bottom: 14px; }

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

.field .hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}

input[type="text"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, background 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 96px;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  padding: 8px 0;
}

.checkbox input {
  margin-top: 2px;
  accent-color: var(--accent);
}

.checkbox a { color: var(--accent); }

/* ----------- File Drop Zone ---------------------------------------------- */
.file-drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  background: var(--bg-elev-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: block;
}

.file-drop:hover,
.file-drop.dragover {
  border-color: var(--accent);
}

.file-drop input { display: none; }

.file-drop .icon { font-size: 1.6rem; margin-bottom: 6px; }
.file-drop .label { font-size: 0.92rem; font-weight: 600; }
.file-drop .sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.file-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.85rem;
}

.file-item .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item .size {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.file-item button {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 1rem;
}

/* ----------- Buttons ----------------------------------------------------- */
.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.actions.narrow { max-width: 280px; margin-left: auto; margin-right: auto; }

button.btn {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  font-family: inherit;
}

button.btn:active { transform: translateY(1px); }
button.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elev-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); }

/* ----------- Alerts ------------------------------------------------------ */
.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  margin-bottom: 14px;
  border: 1px solid;
}

.alert-info {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--text);
}

:root[data-theme="dark"] .alert-info {
  background: rgba(108, 140, 255, 0.08);
  color: #c8d3ff;
}

.alert-error {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

.alert-warn {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--warning);
}

/* ----------- FAQ (Accordion) --------------------------------------------- */
.faq {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.faq details {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
  overflow: hidden;
}

.faq summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-size: 1.1rem;
  color: var(--text-dim);
  transition: transform 0.2s;
}
.faq details[open] summary::after { content: "−"; }

.faq details > p {
  padding: 0 12px 12px;
  font-size: 0.86rem;
  color: var(--text-dim);
  line-height: 1.55;
}

/* ----------- Hilfsangebote / Help Card ----------------------------------- */
.help-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 8px;
}

.help-card .help-intro {
  font-size: 0.86rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.help-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-card li {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.help-card .help-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.help-card .help-meta {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.help-card a {
  color: var(--accent);
  text-decoration: none;
}
.help-card a:hover { text-decoration: underline; }

.help-emergency {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--danger);
  font-weight: 600;
}

/* ----------- Confirmation ------------------------------------------------ */
.success { text-align: center; padding: 16px 0; }

.success .check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  display: grid;
  place-items: center;
  font-size: 2rem;
  margin: 0 auto 14px;
}

.success h2 { color: var(--text); }

.ref {
  margin: 18px auto;
  padding: 14px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-width: 320px;
}

.ref .label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.ref .number {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}

/* ----------- Upload Progress -------------------------------------------- */
.upload-progress {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 8px;
}

.upload-progress .row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.upload-progress .ok { color: var(--success); }
.upload-progress .fail { color: var(--danger); }

/* ----------- Footer ------------------------------------------------------ */
footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 18px;
  padding: 12px;
}

footer a { color: var(--text-dim); text-decoration: underline; }

/* ----------- Mobile ------------------------------------------------------ */
@media (max-width: 480px) {
  body { padding: 8px; }
  header { padding: 16px 16px 12px; }
  main { padding: 14px 16px 18px; }
  .progress-wrap { padding: 12px 16px 0; }
  .toolbar { padding: 0 8px; }
}

/* =============================================================================
   Neue Felder: Altersangabe, E-Mail Opt-in, Admin-Link in Toolbar
   ============================================================================= */

/* ----------- Altersfeld (Schritt 2) --------------------------------------- */
input[type="number"]#reporter_age {
  width: 120px;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s;
  /* Pfeile ausblenden für cleanes Design */
  -moz-appearance: textfield;
}
input[type="number"]#reporter_age::-webkit-inner-spin-button,
input[type="number"]#reporter_age::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"]#reporter_age:focus {
  outline: none;
  border-color: var(--accent);
}

/* ----------- E-Mail Opt-in Feld ------------------------------------------ */
#email-field {
  animation: fade 0.2s ease-out;
  border-left: 2px solid var(--accent);
  padding-left: 12px;
  margin-left: 2px;
}

#email-field input[type="email"] {
  width: 100%;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
#email-field input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
}

#email-field .hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}
#email-field .hint::before {
  content: "🔒";
  font-size: 0.7rem;
}

/* ----------- Admin-Link in Toolbar --------------------------------------- */
.toolbar a.theme-toggle {
  opacity: 0.45;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  transition: opacity 0.15s, border-color 0.15s;
}
.toolbar a.theme-toggle:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}

/* ----------- Checkbox Highlight wenn aktiv ------------------------------- */
.checkbox:has(input:checked) {
  color: var(--text);
}
.checkbox:has(#notify_on_action:checked) span {
  color: var(--accent);
  font-weight: 500;
}

/* ----------- Mobile Anpassungen für neue Felder -------------------------- */
@media (max-width: 480px) {
  input[type="number"]#reporter_age {
    width: 100%;
  }
  #email-field {
    padding-left: 8px;
  }
}
