/* ============================================
   Captive Portal Styles
   Premium, modern WiFi login experience
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --primary: #3370ff;
  --primary-dark: #245bdb;
  --primary-light: #5b8fff;
  --accent: #00d6b9;
  --accent-dark: #00b89e;
  --bg-gradient-start: #0f0c29;
  --bg-gradient-mid: #1a1545;
  --bg-gradient-end: #24243e;
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.45);
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%);
  color: var(--text-primary);
  overflow: hidden;
}

/* ============================================
   Animated Background
   ============================================ */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.bg-animation .circle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
  opacity: 0.08;
  animation: floatBubble 20s infinite;
}

.bg-animation .circle:nth-child(1) {
  width: 500px;
  height: 500px;
  top: -100px;
  left: -100px;
  animation-delay: 0s;
  animation-duration: 25s;
}

.bg-animation .circle:nth-child(2) {
  width: 350px;
  height: 350px;
  top: 60%;
  right: -50px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  animation-delay: -5s;
  animation-duration: 30s;
}

.bg-animation .circle:nth-child(3) {
  width: 200px;
  height: 200px;
  bottom: -50px;
  left: 30%;
  animation-delay: -10s;
  animation-duration: 20s;
}

@keyframes floatBubble {
  0%, 100% { transform: translateY(0) translateX(0) scale(1); }
  25% { transform: translateY(-30px) translateX(20px) scale(1.05); }
  50% { transform: translateY(-10px) translateX(-15px) scale(0.95); }
  75% { transform: translateY(-40px) translateX(10px) scale(1.02); }
}

/* Grid pattern overlay */
.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0;
}

/* ============================================
   Main Container
   ============================================ */
.portal-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

/* ============================================
   Card
   ============================================ */
.portal-card {
  width: 100%;
  max-width: 440px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 48px 40px;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.6s ease-out;
}

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

/* ============================================
   Logo & Header
   ============================================ */
.portal-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
}

.portal-logo .wifi-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(51, 112, 255, 0.3);
  position: relative;
  overflow: hidden;
}

.portal-logo .wifi-icon::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.1) 50%, transparent 60%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) translateY(-100%); }
  100% { transform: translateX(100%) translateY(100%); }
}

.portal-logo .wifi-icon svg {
  width: 36px;
  height: 36px;
  fill: white;
  position: relative;
  z-index: 1;
}

.portal-header {
  text-align: center;
  margin-bottom: 36px;
}

.portal-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.portal-header p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================
   Lark Login Button
   ============================================ */
.lark-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(51, 112, 255, 0.35);
}

.lark-login-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.5s;
}

.lark-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(51, 112, 255, 0.5);
}

.lark-login-btn:hover::before {
  left: 100%;
}

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

.lark-login-btn .lark-icon {
  width: 24px;
  height: 24px;
}

.lark-login-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.lark-login-btn.loading .btn-text {
  display: none;
}

.lark-login-btn.loading .btn-loader {
  display: inline-block;
}

.btn-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Divider
   ============================================ */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 28px 0;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.divider span {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================
   Info Section
   ============================================ */
.portal-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-item .icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-item .icon.blue {
  background: rgba(51, 112, 255, 0.15);
  color: var(--primary-light);
}

.info-item .icon.green {
  background: rgba(0, 214, 185, 0.15);
  color: var(--accent);
}

.info-item .icon.yellow {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.info-item .icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.info-item .info-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.info-item .info-text strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================
   Success State
   ============================================ */
.success-card {
  text-align: center;
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--success), #10b981);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(52, 211, 153, 0.3);
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.success-icon svg {
  width: 40px;
  height: 40px;
  fill: white;
}

.success-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.success-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.credentials-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
  text-align: left;
}

.credentials-box .cred-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.credentials-box .cred-row + .cred-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.credentials-box .cred-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.credentials-box .cred-value {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
}

.countdown-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 24px;
}

.countdown-bar .bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  animation: countdown 10s linear forwards;
}

@keyframes countdown {
  from { width: 100%; }
  to { width: 0%; }
}

/* ============================================
   Error State
   ============================================ */
.error-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 12px;
  margin-bottom: 24px;
  animation: shakeX 0.5s ease-out;
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

.error-message .error-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: var(--danger);
  margin-top: 2px;
}

.error-message .error-text {
  font-size: 13px;
  color: var(--danger);
  line-height: 1.5;
}

/* ============================================
   Footer
   ============================================ */
.portal-footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 12px;
}

.portal-footer a {
  color: var(--primary-light);
  text-decoration: none;
}

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
  .portal-card {
    padding: 36px 24px;
    border-radius: 20px;
  }

  .portal-header h1 {
    font-size: 20px;
  }

  .lark-login-btn {
    padding: 14px 20px;
    font-size: 15px;
  }
}

/* ============================================
   Hidden utility
   ============================================ */
.hidden {
  display: none !important;
}
