/* ==============================================================================
   m3connect Captive Portal Stylesheet (Corporate Design & CNA Optimized)
   ============================================================================== */

:root {
  /* m3connect Official Color Palette */
  --m3-surface-1: #061518;       /* Deep petrol background */
  --m3-surface-2: #0A1E22;       /* Dark petrol card background */
  --m3-surface-card: rgba(10, 30, 34, 0.85);
  --m3-surface-hover: rgba(224, 236, 237, 0.08);
  
  --m3-cyan: #5ecad8;            /* m3connect Dynamic Cyan */
  --m3-coral: #ff451d;           /* m3connect Vibrant Coral / CTA */
  --m3-coral-hover: #ff5e3b;
  
  --m3-text-primary: #EFF5F6;    /* Crisp snow white */
  --m3-text-secondary: #b4b9ba;  /* Slate gray */
  --m3-text-muted: #6e7b7d;
  
  --m3-border: rgba(239, 245, 246, 0.12);
  --m3-border-focus: rgba(94, 202, 216, 0.5);
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--m3-surface-1);
  color: var(--m3-text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Background Ambient Glow */
.background-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
}

.glow-cyan {
  width: 450px;
  height: 450px;
  background: var(--m3-cyan);
  top: -100px;
  right: -100px;
}

.glow-coral {
  width: 400px;
  height: 400px;
  background: var(--m3-coral);
  bottom: -100px;
  left: -100px;
}

/* Layout Wrapper */
.portal-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: auto;
}

/* Header */
.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.brand-container {
  display: flex;
  align-items: center;
}

.m3-logo-full {
  height: 28px;
  width: auto;
  max-width: 210px;
  display: block;
}

/* Language Switcher */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--m3-border);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--m3-text-secondary);
  cursor: pointer;
  padding: 2px 4px;
  font-family: inherit;
  font-weight: inherit;
  transition: var(--transition);
}

.lang-btn.active {
  color: var(--m3-cyan);
}

.lang-divider {
  color: var(--m3-border);
  font-size: 11px;
}

/* Card */
.portal-card {
  background: var(--m3-surface-card);
  border: 1px solid var(--m3-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.portal-card-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.wifi-icon-badge, .success-icon-badge {
  width: 64px;
  height: 64px;
  background: rgba(94, 202, 216, 0.1);
  border: 1px solid rgba(94, 202, 216, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--m3-cyan);
  margin-bottom: 4px;
}

.success-icon-badge {
  background: rgba(0, 208, 132, 0.12);
  border-color: rgba(0, 208, 132, 0.3);
  color: #00d084;
}

.portal-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--m3-text-primary);
}

.portal-subtitle {
  font-size: 14px;
  color: var(--m3-text-secondary);
}

/* Network Badge */
.network-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--m3-border);
  border-radius: 30px;
  padding: 8px 16px;
  font-size: 13px;
}

.badge-dot {
  width: 8px;
  height: 8px;
  background: var(--m3-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--m3-cyan);
}

.badge-label {
  color: var(--m3-text-secondary);
}

.badge-ssid {
  color: var(--m3-text-primary);
  font-weight: 600;
}

/* Form & Checkbox */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.terms-group {
  display: flex;
  align-items: flex-start;
}

.checkbox-container {
  display: flex;
  align-items: flex-start;
  position: relative;
  padding-left: 28px;
  cursor: pointer;
  font-size: 13px;
  color: var(--m3-text-secondary);
  user-select: none;
  line-height: 1.4;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 1px;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--m3-border);
  border-radius: 4px;
  transition: var(--transition);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--m3-cyan);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--m3-cyan);
  border-color: var(--m3-cyan);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid #061518;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.terms-text a {
  color: var(--m3-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.terms-text a:hover {
  color: #fff;
}

/* One-Click Connect Button */
.btn-connect {
  background: var(--m3-coral);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(255, 69, 29, 0.35);
  transition: var(--transition);
}

.btn-connect:hover {
  background: var(--m3-coral-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(255, 69, 29, 0.45);
}

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

.btn-connect:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Spinner inside button */
.btn-spinner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spinner-svg {
  animation: rotate 2s linear infinite;
  width: 20px;
  height: 20px;
}

.spinner-svg .path {
  stroke: #ffffff;
  stroke-linecap: round;
  animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
  100% { transform: rotate(360deg); }
}

@keyframes dash {
  0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* Collapsible Technical Details */
.tech-details-container {
  border-top: 1px solid var(--m3-border);
  padding-top: 16px;
}

.tech-details-toggle {
  background: none;
  border: none;
  color: var(--m3-text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 0;
  transition: var(--transition);
}

.tech-details-toggle:hover {
  color: var(--m3-text-secondary);
}

.chevron-icon {
  transition: transform 0.2s ease;
}

.tech-details-toggle.open .chevron-icon {
  transform: rotate(180deg);
}

.tech-details-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.tech-row {
  display: flex;
  justify-content: space-between;
}

.tech-label {
  color: var(--m3-text-muted);
}

.tech-value {
  color: var(--m3-text-secondary);
  font-family: monospace;
}

/* Success Card */
.success-card {
  text-align: center;
  align-items: center;
}

.redirect-counter {
  font-size: 14px;
  color: var(--m3-text-secondary);
  margin-bottom: 8px;
}

.redirect-counter strong {
  color: var(--m3-cyan);
}

/* Footer */
.portal-footer {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--m3-text-muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.footer-links a {
  color: var(--m3-text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--m3-cyan);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  background: var(--m3-surface-2);
  border: 1px solid var(--m3-border);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  color: var(--m3-text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--m3-text-muted);
  cursor: pointer;
}

.modal-body {
  font-size: 14px;
  color: var(--m3-text-secondary);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-modal-ok {
  background: var(--m3-cyan);
  color: var(--m3-surface-1);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  align-self: flex-end;
}
