/* Apple iOS Style Framework for MiniApp v2 */
:root {
  --bg-color: #F2F2F7;
  --card-bg: #FFFFFF;
  --card-border: rgba(60, 60, 67, 0.08);
  --separator-color: rgba(60, 60, 67, 0.12);
  --text-primary: #000000;
  --text-secondary: #8E8E93;
  --text-tertiary: #C7C7CC;
  
  /* Apple System Colors */
  --apple-blue: #007AFF;
  --apple-blue-light: #E5F1FF;
  --apple-green: #34C759;
  --apple-green-light: #EAFCEB;
  --apple-red: #FF3B30;
  --apple-red-light: #FFEBEA;
  --apple-orange: #FF9500;
  --apple-purple: #AF52DE;
  --apple-gray: #E5E5EA;

  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-power: 0 10px 25px rgba(0, 122, 255, 0.15);
  --shadow-power-active: 0 12px 30px rgba(52, 199, 89, 0.3);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  --transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 95px;
  user-select: none;
}

.container {
  padding: 16px;
  max-width: 440px;
  margin: 0 auto;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 8px 12px;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pz-logo {
  height: 30px;
  width: auto;
}

.brand-text-img {
  height: 16px;
  width: auto;
}

/* Apple Power Card */
.power-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.power-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px 0 24px;
}

.power-btn {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, #FFFFFF 0%, #F2F2F7 100%);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), inset 0 2px 3px rgba(255, 255, 255, 1), inset 0 -2px 4px rgba(0, 0, 0, 0.05);
  color: var(--apple-blue);
  font-size: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  position: relative;
}

.power-btn svg {
  width: 44px;
  height: 44px;
  stroke: var(--apple-blue);
  stroke-width: 2.5;
  transition: var(--transition);
}

.power-btn::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--apple-gray);
  transition: var(--transition);
}

.power-btn:active {
  transform: scale(0.95);
}

.power-btn.active {
  background: linear-gradient(180deg, #34C759 0%, #28A745 100%);
  color: #FFFFFF;
  box-shadow: var(--shadow-power-active);
}

.power-btn.active svg,
.power-btn.connecting svg {
  stroke: #FFFFFF;
}

.power-btn.active::before {
  border-color: #A3E9B7;
}

.power-btn.connecting {
  background: linear-gradient(180deg, #FF9500 0%, #E08200 100%);
  color: #FFFFFF;
  animation: applePulse 1.4s infinite ease-in-out;
}

.power-btn.connecting::before {
  border-color: #FFE0B2;
}

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

.connection-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.connection-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* iOS Grouped Section Header */
.section-header {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: -0.1px;
  margin: 20px 0 8px 12px;
}

/* Apple Quick Action Grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.quick-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
}

.quick-card:active {
  transform: scale(0.96);
  opacity: 0.8;
}

.quick-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin: 0 auto 8px;
}

.icon-blue { background: var(--apple-blue-light); color: var(--apple-blue); }
.icon-green { background: var(--apple-green-light); color: var(--apple-green); }
.icon-purple { background: #F5F0FF; color: var(--apple-purple); }

.quick-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

/* iOS Grouped List (Settings / Servers / Options) */
.list-group {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--separator-color);
  cursor: pointer;
  transition: var(--transition);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:active {
  background: #F8F8FC;
}

.list-item.selected {
  background: var(--apple-blue-light);
}

.item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-flag {
  font-size: 22px;
  line-height: 1;
}

.item-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.item-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

.item-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.chevron {
  color: var(--text-tertiary);
  font-size: 16px;
  font-weight: 600;
}

.radio-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.list-item.selected .radio-check {
  border-color: var(--apple-blue);
  background: var(--apple-blue);
}

.list-item.selected .radio-check::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFFFFF;
}

/* Tariff Cards (Apple Style) */
.tariff-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  position: relative;
}

.tariff-card:active {
  transform: scale(0.98);
}

.tariff-card.selected {
  border-color: var(--apple-blue);
  background: var(--apple-blue-light);
}

.tariff-badge {
  position: absolute;
  top: -10px;
  right: 14px;
  background: var(--apple-blue);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-full);
}

.tariff-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.tariff-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

.tariff-price {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--apple-blue);
}

/* Apple Buttons */
.btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  outline: none;
}

.btn:active {
  transform: scale(0.98);
  opacity: 0.85;
}

.btn-primary {
  background: var(--apple-blue);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.btn-success-copied {
  background: #34C759 !important;
  background-color: #34C759 !important;
  color: #FFFFFF !important;
  border-color: #34C759 !important;
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.35) !important;
}

.btn-outline {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
}

/* Apple iOS Bottom Tab Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-around;
  padding: 8px 10px 18px;
  z-index: 100;
  max-width: 440px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.1px;
  width: 25%;
  padding: 6px 0;
  border-radius: 14px;
  transition: var(--transition);
}

.nav-icon {
  font-size: 20px;
  line-height: 1;
}

.nav-item.active {
  color: var(--apple-blue);
  background: var(--apple-blue-light);
  font-weight: 700;
}

/* Apple Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.qr-box {
  width: 180px;
  height: 180px;
  margin: 0 auto 20px;
  background: var(--bg-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
}
