/* ISP Billing Portal - Improved with Dark/Light Mode */

/* ============================================
   THEME VARIABLES - Dark & Light Mode
   ============================================ */

:root[data-theme="light"] {
  --primary: #0066FF;
  --primary-dark: #0052CC;
  --primary-light: #3385FF;
  --secondary: #00D9FF;
  --gcash: #007DFF;
  --gcash-dark: #0066cc;
  --success: #059669;
  --success-light: #10B981;
  --success-dark: #047857;
  --warning: #D97706;
  --warning-light: #F59E0B;
  --info: #2563EB;
  --danger: #DC2626;
  
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --border: #E2E8F0;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 30px rgba(0, 102, 255, 0.12);
  
  --network-opacity: 0.04;
}

:root[data-theme="dark"],
:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;
  --secondary: #0ea5e9;
  --gcash: #007DFF;
  --gcash-dark: #0066cc;
  --success: #10b981;
  --success-light: #34d399;
  --success-dark: #059669;
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --info: #6366f1;
  --danger: #ef4444;
  
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #334155;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.15);
  
  --network-opacity: 0.06;
}

:root {
  --radius: 16px;
  --radius-sm: 12px;
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-primary);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.5s ease;
}

.theme-toggle:hover svg {
  transform: rotate(20deg);
}

/* Animated Background Pattern */
.background-pattern {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: var(--network-opacity);
  background-image: 
    radial-gradient(circle at 20% 50%, var(--primary) 1px, transparent 1px),
    radial-gradient(circle at 80% 80%, var(--secondary) 1px, transparent 1px),
    radial-gradient(circle at 40% 20%, var(--primary-light) 1px, transparent 1px);
  background-size: 50px 50px, 80px 80px, 60px 60px;
  background-position: 0 0, 40px 60px, 130px 270px;
  animation: patternMove 20s linear infinite;
}

@keyframes patternMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

/* Container */
.container {
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.container.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* Card Variations */
.status-card, .success-card, .logout-card {
  max-width: 580px;
  margin: 0 auto;
}

/* Card */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, transparent 70%);
  animation: glowPulse 8s ease-in-out infinite;
  pointer-events: none;
}

.success-card .card-glow {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
}

.logout-card .card-glow {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.08) 0%, transparent 70%);
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

/* WiFi Icon (Login) */
.wifi-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
  animation: iconFloat 3s ease-in-out infinite;
}

/* Logo image — flexible, no fixed box */
.wifi-icon.has-logo {
  width: auto;
  height: auto;
  max-width: 180px;
  background: none;
  border-radius: 0;
  box-shadow: none;
  animation: none;
}

.wifi-icon.has-logo img {
  max-width: 180px;
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.wifi-icon svg {
  width: 32px;
  height: 32px;
}

/* Status Icon (Connected) */
.status-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--success), var(--success-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
  position: relative;
  animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.status-icon svg {
  width: 40px;
  height: 40px;
  position: relative;
  z-index: 2;
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border: 3px solid var(--success);
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  opacity: 0;
}

.pulse-ring.delay-1 {
  animation-delay: 1s;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}

/* Title */
.title {
  font-family: 'DM Sans', sans-serif;
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.status-card .title {
  color: var(--success);
}

.subtitle {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Form Elements */
.login-form {
  position: relative;
  z-index: 1;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s ease;
  outline: none;
}

.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

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

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), #38bdf8);
  color: white;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4);
}

.btn-gcash {
  background: linear-gradient(135deg, var(--gcash), var(--gcash-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(0, 125, 255, 0.3);
  margin-top: 20px;
}

.btn-gcash:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 125, 255, 0.4);
}

.btn-logout {
  background: linear-gradient(135deg, #64748b, #475569);
  color: white;
  box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

.btn-logout:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(100, 116, 139, 0.4);
  background: linear-gradient(135deg, #475569, #334155);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--bg-main);
  border-color: var(--primary);
}

.btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-icon {
  width: 20px;
  height: 20px;
}

/* Status Badges */
.status-badge {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-sm);
  position: relative;
  z-index: 1;
  margin-bottom: 24px;
}

.status-badge.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.due {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.expired {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-badge .status-icon {
  width: 48px;
  height: 48px;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  box-shadow: none;
  animation: none;
  margin: 0;
}

.status-text {
  flex: 1;
}

.status-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.status-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* Details Card */
.details-card {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.detail-value {
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}

/* Alerts */
.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}

.alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 32px 0;
  position: relative;
  z-index: 1;
}

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

.divider span {
  padding: 0 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Footer */
.footer-text {
  text-align: center;
  position: relative;
  z-index: 1;
  margin-top: 24px;
}

.footer-text p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

/* Input hints */
.input-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .theme-toggle {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
  }

  .container {
    max-width: 100%;
  }

  .card {
    padding: 32px 24px;
  }

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

/* Utility Classes */
.hidden {
  display: none;
}

/* ============================================
   PAYMENT PACKAGES
   ============================================ */

.packages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 32px 0;
  position: relative;
  z-index: 1;
}

.package-card {
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.package-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.package-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.package-card:hover::before {
  opacity: 1;
}

.package-card.featured {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(14, 165, 233, 0.05));
}

.package-card.featured::before {
  opacity: 1;
}

.package-card.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(14, 165, 233, 0.05));
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.package-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.package-badge.popular {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-color: transparent;
}

.package-price {
  font-family: 'DM Sans', sans-serif;
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1;
}

.package-duration {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.package-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.selected-plan-info {
  background: var(--bg-main);
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-top: 24px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row span {
  color: var(--text-muted);
  font-size: 14px;
}

.info-row strong {
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   SOA CUSTOMIZER
   ============================================ */

.customizer-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  margin-bottom: 24px;
}

.customizer-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 12px;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-group-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-group-inline .btn {
  flex: 1;
  min-width: 150px;
}

@media (max-width: 768px) {
  .packages {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .btn-group-inline {
    flex-direction: column;
  }
  
  .btn-group-inline .btn {
    width: 100%;
  }
}

/* ========================
   SELECT DROPDOWN FIX
   Fix dark mode dropdown options visibility
   ======================== */
select option {
  background-color: var(--bg-card, #1e293b);
  color: var(--text-primary, #f8fafc);
}

/* Light mode override */
:root[data-theme="light"] select option,
.light select option {
  background-color: #ffffff;
  color: #0F172A;
}
