/* =========================================================
   ATSCADA Training — Embeddable Registration Form
   Thiết kế tối giản, phù hợp nhúng iframe vào WordPress
   ========================================================= */

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

:root {
  --primary:    #0066cc;
  --primary-h:  #0052a3;
  --success:    #16a34a;
  --error:      #dc2626;
  --border:     #d1d5db;
  --border-f:   #0066cc;
  --bg-input:   #ffffff;
  --text:       #111827;
  --text-muted: #6b7280;
  --radius:     6px;
  --font:       'Inter', system-ui, sans-serif;
}

html, body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: transparent;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ───────────────────────────────────────────── */
#form-wrap {
  padding: 8px 4px 16px;
}

/* ── Rows ─────────────────────────────────────────────── */
.form-row { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.form-row.two-col { flex-direction: row; }
.form-row.two-col > * { flex: 1; min-width: 0; }

@media (max-width: 560px) {
  .form-row.two-col { flex-direction: column; }
}

/* ── Form Group ───────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0; }
.form-group:last-child:not(.form-row .form-group) { margin-bottom: 12px; }

label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

.required { color: var(--error); margin-left: 1px; }

/* ── Inputs ───────────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

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

input:focus, select:focus, textarea:focus {
  border-color: var(--border-f);
  box-shadow: 0 0 0 3px rgba(0,102,204,0.12);
}

input.is-error, select.is-error { border-color: var(--error); }
input.is-error:focus, select.is-error:focus {
  box-shadow: 0 0 0 3px rgba(220,38,38,0.1);
}

input::placeholder, textarea::placeholder { color: #9ca3af; }

/* ── Error text ───────────────────────────────────────── */
.err {
  font-size: 11.5px;
  color: var(--error);
  min-height: 0;
  display: none;
}
.err.visible { display: block; }

/* ── Submit Button ────────────────────────────────────── */
button[type="submit"] {
  width: 100%;
  margin-top: 4px;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}

button[type="submit"]:hover:not(:disabled) { background: var(--primary-h); }
button[type="submit"]:active:not(:disabled) { transform: scale(0.99); }
button[type="submit"]:disabled { opacity: 0.65; cursor: not-allowed; }

.btn-spinner svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Note ─────────────────────────────────────────────── */
.note-text {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ── Secondary Button ─────────────────────────────────── */
.btn-secondary {
  margin-top: 12px;
  padding: 8px 20px;
  border: 1.5px solid var(--border-f);
  color: var(--primary);
  background: transparent;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: rgba(0,102,204,0.06); }

/* ── Success State ────────────────────────────────────── */
#success-state { padding: 24px 4px; }

.success-box {
  text-align: center;
  padding: 28px 20px;
  border: 1.5px solid #bbf7d0;
  border-radius: 10px;
  background: #f0fdf4;
}

.success-icon {
  width: 60px;
  height: 60px;
  background: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: var(--success);
}

.success-box h3 {
  font-size: 16px;
  font-weight: 600;
  color: #166534;
  margin-bottom: 8px;
}

.success-box p {
  font-size: 13.5px;
  color: #4b5563;
  max-width: 340px;
  margin: 0 auto;
}

/* ── Toast ────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  max-width: 320px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  animation: slideIn 0.2s ease-out;
  pointer-events: auto;
}
.toast.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.toast.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.toast.info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

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