/* ==========================================================================
   PhyLearn Unified Authentication & Registration Stylesheet
   Shared by: login (index.php), student register, tutor register,
   forgot-password, reset-password, and email verification.
   ========================================================================== */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --surface3: #e2e8f0;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent2: #06b6d4;
  --accent-dim: #eef2ff;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --error: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --grad: linear-gradient(135deg, #4f46e5 0%, #3b82f6 50%, #06b6d4 100%);
  --grad-accent: linear-gradient(135deg, #4f46e5, #6366f1);
  --orb1-color: #c7d2fe;
  --orb2-color: #a5f3fc;
  --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Tutor Purple Theme Variant */
body.tutor-theme {
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-dim: #f5f3ff;
  --grad: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #06b6d4 100%);
  --grad-accent: linear-gradient(135deg, #7c3aed, #6366f1);
  --orb1-color: #ddd6fe;
  --orb2-color: #fed7aa;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  padding: 32px 16px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(79, 70, 229, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 70, 229, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  z-index: 0;
}

body.tutor-theme::before {
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.03) 1px, transparent 1px);
}

/* Ambient Floating Orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  animation: floatOrb 10s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.orb1 {
  width: 450px;
  height: 450px;
  background: var(--orb1-color);
  top: -120px;
  left: -80px;
}

.orb2 {
  width: 380px;
  height: 380px;
  background: var(--orb2-color);
  bottom: -80px;
  right: -60px;
  animation-delay: -5s;
}

@keyframes floatOrb {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-24px);
  }
}

/* Floating Math Drift Background */
.math-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.math-bg span {
  position: absolute;
  font-family: 'DM Mono', monospace;
  color: rgba(79, 70, 229, 0.3);
  font-size: 14px;
  animation: driftMath 18s linear infinite;
  white-space: nowrap;
}

@keyframes driftMath {
  0% {
    transform: translateY(105vh);
  }

  100% {
    transform: translateY(-20px);
  }
}

/* Container & Layout */
.page {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 520px;
}

.page-wide {
  max-width: 560px;
}

.page-sm {
  max-width: 460px;
}

/* Logo Header */
.logo-wrap {
  text-align: center;
  margin-bottom: 24px;
}

.logo-wrap a {
  text-decoration: none;
  color: inherit;
  display: inline-block;
}

.logo-icon {
  width: 58px;
  height: 58px;
  background: var(--grad);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 12px;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.25);
  transition: transform 0.2s ease;
}

body.tutor-theme .logo-icon {
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.25);
}

.logo-wrap a:hover .logo-icon {
  transform: translateY(-2px);
}

.logo-title {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1.1;
}

.logo-sub {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

/* Primary Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 34px 30px;
  box-shadow: var(--shadow-lg);
}

.card-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  margin-bottom: 14px;
}

.title,
.card-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.desc,
.card-desc {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 22px;
  line-height: 1.5;
}

/* Form Controls */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 24px 18px;
  }

  .logo-title {
    font-size: 28px;
  }
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

.pw-toggle-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pw-toggle-btn:hover {
  color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 14px 11px 40px;
  background: #ffffff;
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.15s ease;
  outline: none;
}

input.has-toggle {
  padding-right: 40px;
}

textarea {
  padding-left: 14px;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

select {
  padding-left: 14px;
  cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

body.tutor-theme input:focus,
body.tutor-theme select:focus,
body.tutor-theme textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: var(--grad-accent);
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  margin-top: 8px;
  text-decoration: none;
}

body.tutor-theme .btn {
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
}

body.tutor-theme .btn:hover {
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.35);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* Information Notices */
.approval-notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 22px;
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.5;
}

.approval-notice i {
  font-size: 18px;
  color: #d97706;
  margin-top: 2px;
  flex-shrink: 0;
}

.tutor-banner {
  background: #fdf4ff;
  border: 1px dashed #d946ef;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #86198f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.tutor-banner a {
  color: #c026d3;
  font-weight: 700;
  text-decoration: none;
}

.tutor-banner a:hover {
  text-decoration: underline;
}

/* Dividers & Portal Links */
.divider {
  text-align: center;
  margin: 22px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: var(--border);
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.portal-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.portal-btn {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface2);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.portal-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.demo-creds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.demo-btn {
  padding: 10px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  font-family: inherit;
}

.demo-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.demo-btn strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  margin-bottom: 2px;
}

/* Footer Links */
.footer-links {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Device Session Warning Toast */
.device-warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #d97706;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
  width: 100%;
}

/* Status Icons for Email Verification & Result Cards */
.status-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 20px;
}

.status-success {
  background: #ecfdf5;
  color: #10b981;
}

.status-error {
  background: #fef2f2;
  color: #ef4444;
}

.status-warning {
  background: #fffbeb;
  color: #f59e0b;
}

.status-idle {
  background: #eff6ff;
  color: #3b82f6;
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  box-shadow: none;
  border: 1px solid var(--border);
  margin-top: 10px;
}

.btn-secondary:hover {
  background: #e2e8f0;
  box-shadow: none;
  transform: translateY(-1px);
}

.resend-box {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: left;
}

.resend-box label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}