/* ============================================================
   IPTelco Signup — CSS
   Style: Ticket-Automation dark/clean, IPTelco green accent
   No CDN, no inline styles, CSP-compatible
   ============================================================ */

:root {
  --bg:          #f0f2f5;
  --surface:     #ffffff;
  --surface-2:   #f7f8fa;
  --border:      #dde1ea;
  --text:        #1a1d27;
  --text-muted:  #5a6278;
  --accent:      #00a844;
  --accent-dark: #007a32;
  --accent-dim:  rgba(0, 168, 68, 0.12);
  --error:       #d93025;
  --warning:     #c07a00;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 4px 24px rgba(0,0,0,0.10);
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:   'IBM Plex Mono', 'Consolas', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0f1117;
    --surface:     #1a1d27;
    --surface-2:   #22263a;
    --border:      #2e3347;
    --text:        #e2e8f0;
    --text-muted:  #8892a4;
    --accent:      #00c851;
    --accent-dark: #009933;
    --accent-dim:  rgba(0, 200, 81, 0.12);
    --error:       #ff4d4d;
    --warning:     #f59e0b;
    --shadow:      0 4px 24px rgba(0,0,0,0.4);
  }
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ---- Page shell ---- */
.page-wrapper {
  width: 100%;
  max-width: 560px;
}

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  animation: fadeUp 0.4s ease;
}

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

/* ---- Logo / header ---- */
.form-header {
  text-align: center;
  margin-bottom: 2rem;
}

.form-header img {
  height: 52px;
  margin-bottom: 1rem;
}

.form-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.form-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* ---- Form elements ---- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group:has(input[type="date"]) {
  cursor: pointer;
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.form-input,
.form-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  padding: 0.65rem 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input.input-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(255, 77, 77, 0.15);
}

.field-error {
  display: none;
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 0.35rem;
  font-weight: 500;
}

.field-error.visible {
  display: block;
}

.plan-grid.group-error,
.radio-group.group-error,
.checkbox-group.group-error {
  outline: 2px solid var(--error);
  outline-offset: 4px;
  border-radius: 6px;
}

.form-input::placeholder { color: var(--text-muted); opacity: 0.6; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238892a4' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* ---- Radio group (locations) ---- */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.radio-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.radio-option input[type="radio"] {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.radio-option span {
  font-size: 0.9rem;
  color: var(--text);
}

/* ---- Checkboxes ---- */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  cursor: pointer;
}

.checkbox-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.checkbox-option a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.checkbox-option a:hover { text-decoration: underline; }

/* ---- Plan pricing badge ---- */
.plan-price {
  font-size: 0.75rem;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-top: 0.3rem;
}

/* ---- Plan card grid ---- */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 160px));
  gap: 0.75rem;
  justify-content: center;
}

.plan-loading {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
  text-align: center;
  width: 100%;
  grid-column: 1 / -1;
}

.plan-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.9rem 0.75rem;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  text-align: center;
  width: 100%;
  transition: box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  color: var(--accent);
}

.plan-card input[type="radio"] {
  display: none;
}

.plan-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.3;
}

.plan-card-price {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--accent);
  opacity: 0.85;
}

.plan-card:hover {
  box-shadow: 0 0 12px 3px rgba(0, 255, 0, 0.35);
  background: rgba(0, 255, 0, 0.06);
}

.plan-card:has(input:checked) {
  background: rgba(0, 255, 0, 0.12);
  border-color: var(--accent);
  box-shadow: 0 0 16px 4px rgba(0, 255, 0, 0.5);
}

.plan-card:has(input:checked) .plan-card-name,
.plan-card:has(input:checked) .plan-card-price {
  color: #fff;
}

/* ---- Submit button ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  width: 100%;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-dark); color: #fff; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Toast notifications ---- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 360px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  font-size: 0.875rem;
}

.toast.toast-error  { border-left: 3px solid var(--error); }
.toast.toast-success { border-left: 3px solid var(--accent); }
.toast.toast-warning { border-left: 3px solid var(--warning); }

.toast-title {
  font-weight: 600;
  margin-bottom: 0.2rem;
  color: var(--text);
}

.toast-body { color: var(--text-muted); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---- Success page ---- */
.success-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 1.75rem;
}

.success-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

.success-body {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ---- Failed page ---- */
.failed-icon {
  width: 64px;
  height: 64px;
  background: rgba(255,77,77,0.12);
  border: 2px solid var(--error);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 1.75rem;
}

/* ---- Divider ---- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ---- Terms page ---- */
.terms-page body { justify-content: flex-start; padding: 2rem; }

.terms-container {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.terms-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

.terms-content h1 { font-size: 1.4rem; margin-bottom: 1rem; color: var(--accent); }
.terms-content h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
.terms-content p  { margin-bottom: 0.75rem; color: var(--text-muted); }
.terms-content ol, .terms-content ul { padding-left: 1.5rem; color: var(--text-muted); }
.terms-content li { margin-bottom: 0.5rem; }
.terms-content a  { color: var(--accent); text-decoration: none; }
.terms-content a:hover { text-decoration: underline; }

.terms-footer { text-align: center; }

/* ---- Loading spinner ---- */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  body { padding: 1rem 0.75rem; justify-content: flex-start; }
  .card { padding: 1.75rem 1.25rem; }
  .form-header h1 { font-size: 1.2rem; }
}
