/* Design system variables */
:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 220 91% 65%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 222.2 84% 4.9%;
  --radius: 0.5rem;
}

.dark {
  --background: 222.2 84% 3.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 5.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 5.9%;
  --popover-foreground: 210 40% 98%;
  --primary: 217.2 91.2% 59.8%;
  --primary-foreground: 222.2 84% 4.9%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 50%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 217.2 91.2% 59.8%;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: hsl(var(--foreground));
  min-height: 100vh;
  background: linear-gradient(125deg, hsl(var(--background)), hsl(var(--secondary)));
  padding: 16px;
  position: relative;
}

.container {
  max-width: 400px;
  margin: 0 auto;
  position: relative;
}

/* Enhanced profile settings button */
.profile-settings-container {
  position: absolute;
  top: 0;
  right: 0;
}

.profile-settings-trigger {
  background: linear-gradient(135deg, hsl(var(--card) / 0.9), hsl(var(--muted) / 0.5));
  backdrop-filter: blur(10px);
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: hsl(var(--muted-foreground));
  box-shadow: 0 2px 10px hsl(var(--primary) / 0.1);
  font-size: 13px;
  font-weight: 500;
}

.profile-settings-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px hsl(var(--primary) / 0.15);
  border-color: hsl(var(--primary) / 0.3);
  color: hsl(var(--primary));
  background: linear-gradient(135deg, hsl(var(--card)), hsl(var(--primary) / 0.1));
}

.profile-settings-trigger .settings-icon {
  font-size: 16px;
  animation: spin-slow 8s linear infinite;
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.profile-settings-trigger:hover .settings-icon {
  animation: none;
  transform: rotate(90deg);
  transition: transform 0.3s ease;
}

.profile-settings-trigger .settings-text {
  font-weight: 600;
}

/* Custom SweetAlert2 styles */
.dark-popup {
  border: 1px solid hsl(217.2, 32.6%, 17.5%) !important;
  backdrop-filter: blur(10px) !important;
}

.wide-popup {
  max-width: 90vw !important;
  width: 500px !important;
}

.dark-title {
  color: hsl(210, 40%, 98%) !important;
}

.dark-content {
  color: hsl(215, 20.2%, 65.1%) !important;
}

.swal2-input {
  background: hsl(217.2, 32.6%, 17.5%) !important;
  border: 1px solid hsl(217.2, 32.6%, 25%) !important;
  color: hsl(210, 40%, 98%) !important;
}

.swal2-input:focus {
  border-color: hsl(142, 76%, 36%) !important;
  box-shadow: 0 0 0 3px hsl(142, 76%, 36%, 0.1) !important;
}

.active-badge {
  background: hsl(142, 76%, 36%);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 0 10px hsl(142, 76%, 36%, 0.3);
}

.expired-badge {
  background: hsl(0, 62.8%, 50%);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 10px hsl(0, 62.8%, 50%, 0.3); }
  50% { box-shadow: 0 0 20px hsl(0, 62.8%, 50%, 0.6); }
}

/* Logo section */
.logo {
  text-align: center;
  margin: 20px 0 20px 0;
  position: relative;
}

.logo-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(271 91% 65%));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 0 40px hsl(var(--primary) / 0.5);
}

.logo-icon i {
  font-size: 24px;
  color: hsl(var(--primary-foreground));
}

.greeting {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(271 91% 65%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  font-weight: 400;
}

/* Enhanced subscription section */
.subscription {
  background: linear-gradient(135deg, hsl(var(--card) / 0.9), hsl(var(--muted) / 0.3));
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 20px;
  border: 1px solid hsl(var(--border));
  position: relative;
  box-shadow: 0 4px 20px hsl(var(--primary) / 0.1);
}

.subscription-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.subscription-text {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}

.subscription-plan {
  font-size: 15px;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 10px;
  line-height: 1.4;
}

.subscription-expiry {
  font-size: 14px;
  color: hsl(var(--muted-foreground));
  margin-bottom: 12px;
  margin-top: 15px;
}

/* Enhanced balance section */
.balance-section {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.zone-actions {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.zone-btn {
  background: linear-gradient(135deg, hsl(var(--card) / 0.9), hsl(var(--muted) / 0.3));
  backdrop-filter: blur(10px);
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 13px;
  font-weight: 600;
  color: hsl(var(--foreground));
  box-shadow: 0 2px 10px hsl(var(--primary) / 0.1);
  position: relative;
  overflow: hidden;
}

.zone-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, hsl(var(--primary) / 0.1), hsl(271 91% 65% / 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.zone-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px hsl(var(--primary) / 0.2);
  border-color: hsl(var(--primary) / 0.3);
}

.zone-btn:hover::before {
  opacity: 1;
}

.login-btn {
  background: linear-gradient(135deg, hsl(271, 76%, 53%), hsl(295, 78%, 42%));
  color: white;
  border-color: hsl(271, 76%, 53%);
  box-shadow: 0 4px 15px hsl(271, 76%, 53%, 0.3);
}

.login-btn:hover {
  box-shadow: 0 8px 30px hsl(271, 76%, 53%, 0.4);
}

.contact-btn {
  background: linear-gradient(135deg, hsl(217.2, 91.2%, 59.8%), hsl(271 91% 65%));
  color: white;
  border-color: hsl(217.2, 91.2%, 59.8%);
  box-shadow: 0 4px 15px hsl(217.2, 91.2%, 59.8%, 0.3);
}

.contact-btn:hover {
  box-shadow: 0 8px 30px hsl(217.2, 91.2%, 59.8%, 0.4);
}

.zone-btn i {
  font-size: 15px;
  position: relative;
  z-index: 1;
}

.zone-btn span {
  position: relative;
  z-index: 1;
}

/* Enhanced balance card */
.balance-card {
  flex: 1;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(271 91% 65%));
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 30px hsl(var(--primary) / 0.3);
}

.balance-card::before {
  content: '';
  position: absolute;
  top: -25px;
  right: -25px;
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.balance-header {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
  font-weight: 500;
}

.balance-amount {
  font-size: 26px;
  font-weight: 700;
  color: white;
  margin-bottom: 0;
}

.balance-icon {
  position: absolute;
  top: 8px;
  right: 3px;
  width: 35px;
  height: 35px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.balance-icon i {
  font-size: 16px;
  color: white;
}

/* Enhanced grid layout */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: linear-gradient(135deg, hsl(var(--card) / 0.9), hsl(var(--muted) / 0.3));
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid hsl(var(--border));
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 10px hsl(var(--primary) / 0.1);
  min-height: 85px;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, hsl(var(--primary) / 0.1), hsl(271 91% 65% / 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 35px hsl(var(--primary) / 0.2);
  border-color: hsl(var(--primary) / 0.3);
}

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

.card-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(271 91% 65%));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 15px hsl(var(--primary) / 0.4);
}

.card-icon i {
  font-size: 16px;
  color: white;
}

.card-label {
  font-size: 14px;
  font-weight: 600;
  color: hsl(var(--foreground));
  position: relative;
  z-index: 1;
  line-height: 1.2;
}

/* Auto renewal section */
.auto-renewal {
  background: linear-gradient(135deg, hsl(var(--card) / 0.9), hsl(var(--muted) / 0.3));
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 20px;
  border: 1px solid hsl(var(--border));
  box-shadow: 0 2px 10px hsl(var(--primary) / 0.1);
}

.auto-renewal-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.auto-renewal-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: hsl(var(--foreground));
  font-size: 14px;
}

.auto-renewal-label i {
  color: hsl(var(--primary));
  filter: drop-shadow(0 0 5px hsl(var(--primary) / 0.5));
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: hsl(var(--muted));
  transition: 0.4s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(271 91% 65%));
  box-shadow: 0 0 15px hsl(var(--primary) / 0.4);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.auto-renewal-description {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

/* Enhanced footer stats */
.footer {
  display: flex;
  gap: 16px;
}

.stat-card {
  flex: 1;
  background: linear-gradient(135deg, hsl(var(--card) / 0.9), hsl(var(--muted) / 0.3));
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
  border: 1px solid hsl(var(--border));
  box-shadow: 0 2px 10px hsl(var(--primary) / 0.1);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: hsl(var(--primary));
  margin-bottom: 4px;
  filter: drop-shadow(0 0 5px hsl(var(--primary) / 0.3));
}

.stat-label {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}

/* Profile menu popup styles */
.profile-menu-popup {
  text-align: left !important;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  margin: 8px -16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  border: 1px solid transparent;
  font-size: 14px;
}

.profile-menu-item:hover {
  background: linear-gradient(135deg, hsl(var(--muted) / 0.3), hsl(var(--primary) / 0.05));
  border-color: hsl(var(--border));
  transform: translateX(4px);
}

.profile-menu-item span {
  flex: 1;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-left: 12px;
}

.profile-menu-item i:first-child {
  width: 18px;
  text-align: center;
}

.profile-menu-item i:last-child {
  margin-left: auto;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

/* Expired state styles */
.expired-text {
  color: hsl(0, 62.8%, 50%) !important;
  font-weight: 500;
}

.change-plan-btn {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0.8;
  float: right;
}

.change-plan-btn:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  opacity: 1;
}

/* Device count badge */
.device-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  z-index: 2;
  box-shadow: 0 0 10px hsl(var(--destructive) / 0.5);
}

/* Responsive design */
@media (max-width: 360px) {
  .container {
    padding: 0 8px;
  }
  
  .grid {
    gap: 12px;
  }
  
  .balance-section {
    gap: 12px;
  }
  
  .card {
    padding: 16px 14px;
  }
}