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

body {
  width: 360px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #0e0e1a;
  color: #e2e8f0;
}

.popup-container {
  display: flex;
  flex-direction: column;
}

.popup-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 16px 20px;
  color: white;
}

.popup-header h1 {
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #a78bfa, #667eea, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.popup-header svg {
  flex-shrink: 0;
  stroke: #a78bfa;
}

.popup-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px 14px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  animation: pulse 2s infinite;
}

.status-indicator.configured .status-dot {
  background: #48bb78;
  box-shadow: 0 0 8px rgba(72, 187, 120, 0.5);
}

.status-indicator.error .status-dot {
  background: #fc8181;
  box-shadow: 0 0 8px rgba(252, 129, 129, 0.5);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-text {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
}

.toggle-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s;
}

.toggle-section:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toggle-label span {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.toggle-label small {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: rgba(255, 255, 255, 0.5);
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background: rgba(167, 139, 250, 0.4);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background-color: #a78bfa;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
}

.stats-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px;
}

.stats-section h3 {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #e2e8f0;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 2px;
}

.button-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* no margin needed - parent gap handles it */
}

.button-section .btn {
  width: 100%;
}

.btn {
  padding: 11px 18px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn-primary {
  background: rgba(167, 139, 250, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.btn-primary:hover {
  background: rgba(167, 139, 250, 0.3);
  border-color: rgba(167, 139, 250, 0.5);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
}

/* ===== SCRIPT SECTION ===== */

.script-section {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.script-section .toggle-section {
  border: none;
  border-radius: 0;
  margin: 0;
}

.script-select-section {
  background: rgba(255, 255, 255, 0.02);
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.script-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  cursor: pointer;
  transition: border-color 0.2s;
}

.script-select:focus {
  outline: none;
  border-color: rgba(167, 139, 250, 0.4);
}

.script-select:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.script-select option {
  background: #1a1a2e;
  color: #e2e8f0;
}

.script-info {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 6px;
  min-height: 14px;
}

.script-info .script-active {
  color: #68d391;
  font-weight: 600;
}

/* ===== LICENSE SCREENS ===== */

.license-card {
  text-align: center;
}

.license-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.license-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.9);
}

.license-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 20px;
  line-height: 1.5;
}

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

.password-wrapper {
  position: relative;
  width: 100%;
}

.password-wrapper .license-input {
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  color: rgba(255,255,255,0.35);
  transition: color 0.15s;
}

.password-toggle:hover {
  color: rgba(167,139,250,0.8);
}

.license-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
  outline: none;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

.license-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.license-input:focus {
  border-color: rgba(167, 139, 250, 0.5);
  background: rgba(255, 255, 255, 0.06);
}

.license-btn {
  width: 100%;
}

.license-divider {
  display: flex;
  align-items: center;
  margin: 14px 0;
  color: rgba(255, 255, 255, 0.2);
  font-size: 11px;
}

.license-divider::before,
.license-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.license-divider span {
  padding: 0 12px;
}

.license-message {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  min-height: 0;
}

.license-message:empty {
  display: none;
}

.license-error {
  background: rgba(252, 129, 129, 0.1);
  color: #fc8181;
  border: 1px solid rgba(252, 129, 129, 0.2);
}

.license-success {
  background: rgba(72, 187, 120, 0.1);
  color: #68d391;
  border: 1px solid rgba(72, 187, 120, 0.2);
}

.license-key-display {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  font-family: 'SF Mono', 'Courier New', monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 14px;
  word-break: break-all;
  user-select: all;
}

/* Licence info bar */

.license-info-bar {
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  text-align: center;
}

.license-info-status {
  font-size: 12px;
  font-weight: 600;
  color: #68d391;
  display: block;
  margin-bottom: 4px;
}

.license-info-email {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  display: block;
  margin-bottom: 8px;
}

.license-info-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.btn-link {
  background: none;
  border: none;
  color: #818cf8;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.btn-link:hover {
  opacity: 1;
  color: #a78bfa;
}

.btn-link-danger {
  color: #fc8181;
}

.btn-link-danger:hover {
  color: #feb2b2;
}

/* Auth toggle */
.auth-toggle {
  margin-top: 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
