/* Rufweiche – Stylesheet */
/* Mobile-first, kein Framework */

:root {
  --color-primary:   #0c4a35;
  --color-primary-d: #083526;
  --color-on:        #166534;
  --color-on-bg:     #dcfce7;
  --color-off:       #374151;
  --color-off-bg:    #f3f4f6;
  --color-error:     #b91c1c;
  --color-error-bg:  #fee2e2;
  --color-warn:      #92400e;
  --color-warn-bg:   #fef3c7;
  --color-green:     #16a34a;
  --color-gray:      #6b7280;
  --color-amber:     #d97706;
  --color-red:       #dc2626;
  --radius:          12px;
  --shadow:          0 2px 12px rgba(0,0,0,0.08);
  --font:            system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: #f8fafc;
  color: #1e293b;
  min-height: 100dvh;
  line-height: 1.5;
}

/* ── Layout ── */

.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

.app-header {
  background: var(--color-primary);
  color: white;
  padding: 0 1rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.app-logo {
  display: flex;
  flex-direction: column;
  gap: 0;
  text-decoration: none;
  line-height: 1.2;
}

.logo-brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
  letter-spacing: -0.01em;
}

.logo-accent {
  color: #fbbf24;
}

.logo-sub {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.app-nav { display: flex; gap: 0.5rem; }
.nav-link {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.nav-link:hover, .nav-link.active {
  color: white;
  background: rgba(255,255,255,0.15);
}

.app-main {
  flex: 1;
  padding: 1.5rem 1rem;
}

.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
  padding: 1rem;
  border-top: 1px solid #e2e8f0;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--color-primary);
  color: white;
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
}
.btn-secondary:hover { background: #cbd5e1; }

.btn-danger {
  background: var(--color-error);
  color: white;
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-small { padding: 0.4rem 1rem; font-size: 0.875rem; }
.btn-large { width: 100%; padding: 1rem; font-size: 1.1rem; }

.btn-on {
  background: #16a34a;
  color: white;
  font-size: 1.1rem;
  width: 100%;
  padding: 1.25rem;
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(22,163,74,0.3);
}
.btn-on:hover { filter: brightness(1.05); }
.btn-on--active {
  box-shadow: 0 0 0 3px #16a34a, 0 4px 14px rgba(22,163,74,0.4);
}

.btn-off {
  background: #374151;
  color: white;
  font-size: 1.1rem;
  width: 100%;
  padding: 1.25rem;
  border-radius: 16px;
}
.btn-off:hover { filter: brightness(1.1); }
.btn-off--active {
  box-shadow: 0 0 0 3px #374151;
}

/* ── Main View ── */

.main-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.status-card.status-green  { background: var(--color-on-bg);   border-left: 4px solid var(--color-green); }
.status-card.status-gray   { background: var(--color-off-bg);  border-left: 4px solid var(--color-gray); }
.status-card.status-amber  { background: var(--color-warn-bg); border-left: 4px solid var(--color-amber); }
.status-card.status-red    { background: var(--color-error-bg);border-left: 4px solid var(--color-red); }

.status-icon {
  font-size: 2rem;
  line-height: 1;
  width: 2.5rem;
  text-align: center;
  flex-shrink: 0;
}
.status-label { font-weight: 700; font-size: 1.2rem; }
.status-desc  { font-size: 0.875rem; color: #64748b; margin-top: 0.15rem; }

.action-buttons { display: flex; flex-direction: column; gap: 0.75rem; }

.info-strip { display: flex; flex-direction: column; gap: 0.5rem; }
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
}
.info-error  { background: var(--color-error-bg);  color: var(--color-error); }
.info-action { background: #f0fdf4; color: #166534; }
.info-icon   { flex-shrink: 0; }

.settings-link { text-align: center; }
.settings-link a { color: #64748b; font-size: 0.875rem; text-decoration: none; }
.settings-link a:hover { color: var(--color-primary); text-decoration: underline; }

/* ── Wizard ── */

.wizard-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.wizard-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.wizard-welcome-icon { font-size: 3.5rem; text-align: center; }
.wizard-title        { font-size: 1.5rem; font-weight: 700; text-align: center; }
.wizard-step-title   { font-size: 1.2rem; font-weight: 700; }
.wizard-intro        { color: #475569; line-height: 1.6; }
.wizard-step-desc    { color: #64748b; font-size: 0.95rem; }

/* Progress Bar */
.wizard-progress {
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
}
.wizard-progress::-webkit-scrollbar { display: none; }

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.progress-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.progress-step--active .progress-dot {
  background: var(--color-primary);
  color: white;
}
.progress-step--done .progress-dot {
  background: var(--color-green);
  color: white;
}
.progress-label {
  font-size: 0.65rem;
  color: #94a3b8;
  white-space: nowrap;
}
.progress-step--active .progress-label { color: var(--color-primary); font-weight: 600; }
.progress-step--done   .progress-label { color: var(--color-green); }

.progress-line {
  height: 2px;
  flex: 1;
  min-width: 12px;
  background: #e2e8f0;
  margin-bottom: 16px;
}
.progress-line--done { background: var(--color-green); }

/* Choice Grid */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.choice-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.choice-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
}
.choice-card:hover { border-color: #94a3b8; background: #f8fafc; }
.choice-card--selected { border-color: var(--color-primary); background: #eff6ff; }
.choice-label { font-weight: 600; font-size: 0.9rem; }
.choice-hint  { font-size: 0.75rem; color: #64748b; }

/* Form */
.form-fields { display: flex; flex-direction: column; gap: 1rem; }
.form-group  { display: flex; flex-direction: column; gap: 0.35rem; }
.form-label  { font-size: 0.9rem; font-weight: 600; color: #334155; }
.required    { color: var(--color-error); margin-left: 2px; }
.form-help   { font-size: 0.8rem; color: #64748b; line-height: 1.4; }

.input {
  padding: 0.65rem 0.9rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font);
  color: #1e293b;
  background: white;
  width: 100%;
  transition: border-color 0.15s;
  outline: none;
}
.input:focus { border-color: var(--color-primary); }

/* Wizard Nav */
.wizard-nav {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.wizard-nav .btn { flex: 1; min-width: 100px; }

/* Test Results */
.test-result {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
}
.test-ok   { background: #f0fdf4; border: 1px solid #bbf7d0; }
.test-fail { background: var(--color-error-bg); border: 1px solid #fca5a5; }
.test-result-icon { font-size: 1.5rem; flex-shrink: 0; }
.test-result-msg  { font-weight: 600; }
.test-result-detail { font-size: 0.85rem; color: #475569; white-space: pre-line; margin-top: 0.25rem; }

/* Rules */
.rules-section { display: flex; flex-direction: column; gap: 0.5rem; }
.rules-title   { font-size: 0.95rem; font-weight: 700; }
.rules-hint    { font-size: 0.85rem; color: #64748b; }
.rules-list    { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.rule-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.rule-active { background: #f0fdf4; border-color: #bbf7d0; }
.rule-status { font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 99px;
               background: #e2e8f0; color: #475569; }
.rule-active .rule-status { background: #bbf7d0; color: #166534; }

.rules-select-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.rule-select-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: border-color 0.15s;
  font-size: 0.9rem;
}
.rule-select-item:hover { border-color: #94a3b8; }
.rule-select-item input[type="radio"] { margin-top: 2px; flex-shrink: 0; }

/* Boxes */
.error-box {
  background: var(--color-error-bg);
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--color-error);
  font-size: 0.9rem;
}
.info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #1e40af;
  font-size: 0.875rem;
  line-height: 1.5;
}
.recommendation-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.rec-title  { font-size: 0.75rem; text-transform: uppercase; color: #64748b; letter-spacing: 0.05em; }
.rec-name   { font-weight: 700; font-size: 1.05rem; color: #166534; }
.rec-desc   { font-size: 0.875rem; color: #374151; }
.rec-warning {
  font-size: 0.8rem;
  color: var(--color-warn);
  background: var(--color-warn-bg);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  margin-top: 0.25rem;
}

/* Settings */
.settings-view       { display: flex; flex-direction: column; gap: 1.5rem; }
.page-title          { font-size: 1.3rem; font-weight: 700; }
.settings-section    { background: white; border-radius: var(--radius); box-shadow: var(--shadow);
                       padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.settings-section h2 { font-size: 1rem; font-weight: 700; color: #334155; }
.settings-section--danger h2 { color: var(--color-error); }

.health-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
}
.health-ok   { background: #f0fdf4; color: #166534; }
.health-fail { background: var(--color-error-bg); color: var(--color-error); }
.latency     { margin-left: auto; font-size: 0.8rem; color: #64748b; }

.cfg-table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
.cfg-table th { text-align: left; color: #64748b; padding: 0.3rem 0; width: 40%; font-weight: 500; }
.cfg-table td { color: #1e293b; }

.inline-form { display: flex; gap: 0.5rem; align-items: center; }
.inline-form .input { max-width: 220px; }

.backend-badge {
  display: inline-block;
  background: #eff6ff;
  color: var(--color-primary);
  border: 1px solid #bfdbfe;
  border-radius: 99px;
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.advanced-details summary {
  cursor: pointer;
  font-size: 0.875rem;
  color: #64748b;
  padding: 0.5rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.advanced-details summary::-webkit-details-marker { display: none; }
.method-form { padding-top: 0.75rem; display: flex; flex-direction: column; gap: 0.75rem; }

.wizard-done-card { text-align: center; padding: 2rem; }
.done-icon { font-size: 4rem; color: var(--color-green); }

.muted { color: #94a3b8; }
.rule-id { font-size: 0.8rem; }

/* ── Desktop Breakpoint ── */
@media (min-width: 600px) {
  .app-wrapper { max-width: 600px; }
  .choice-grid { grid-template-columns: repeat(3, 1fr); }
  .action-buttons { flex-direction: row; }
  .action-buttons form { flex: 1; }
}

/* ── Speedport / Wählcode-Spezifisch ── */

.recommendation-box--ok   { background: #f0fdf4; border: 1px solid #bbf7d0; }
.recommendation-box--warn { background: #fffbeb; border: 1px solid #fde68a; }
.recommendation-box--warn .rec-title { color: var(--color-warn); }
.recommendation-box--warn .rec-name  { color: #92400e; }

.how-it-works  { background: #f8fafc; border-radius: 10px; padding: 1rem; }
.how-title     { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.5rem; color: #334155; }
.how-steps     { padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; }
.how-steps li  { font-size: 0.9rem; color: #475569; line-height: 1.5; }

.req-list      { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.req-list li   { font-size: 0.8rem; background: rgba(255,255,255,0.6); border-radius: 99px;
                 padding: 0.15rem 0.6rem; color: #475569; border: 1px solid rgba(0,0,0,0.08); }

.dial-code-box {
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.dial-code-box--on  { background: #f0fdf4; border: 2px solid #4ade80; }
.dial-code-box--off { background: #f1f5f9; border: 2px solid #94a3b8; }
.dial-code-label    { font-size: 0.85rem; color: #64748b; font-weight: 500; }
.dial-code-value    { font-family: 'Courier New', monospace; font-size: 2rem; font-weight: 700;
                      letter-spacing: 0.05em; color: #1e293b; }
.dial-code-hint     { font-size: 0.8rem; color: #64748b; line-height: 1.4; }

.code-display       { background: #f8fafc; border-radius: 10px; padding: 1rem;
                      display: flex; flex-direction: column; gap: 0.5rem; }
.code-display-title { font-size: 0.85rem; font-weight: 600; color: #334155; }
.code-row           { display: flex; align-items: center; gap: 0.75rem; }
.code-label         { font-size: 0.85rem; color: #64748b; width: 140px; flex-shrink: 0; }
.code-value         { font-family: 'Courier New', monospace; font-size: 1.1rem; font-weight: 700;
                      background: white; border: 1px solid #e2e8f0; border-radius: 6px;
                      padding: 0.2rem 0.6rem; color: #1e293b; }

.code-preview       { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px;
                      padding: 1rem; margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.code-preview-title { font-size: 0.85rem; font-weight: 600; color: #166534; }
.code-hint          { font-size: 0.8rem; color: #64748b; }

.input--large       { font-size: 1.1rem; padding: 0.8rem 1rem; }
