/* ===== User Page - Dark Netflix Theme ===== */
:root {
  --bg: #0a0a0f;
  --bg-card: rgba(22, 22, 32, 0.85);
  --bg-input: rgba(18, 18, 28, 0.9);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text: #f0f0f5;
  --text-sec: #9898a8;
  --text-muted: #5a5a6e;
  --red: #E50914;
  --red-glow: rgba(229, 9, 20, 0.3);
  --blue: #6366f1;
  --purple: #a855f7;
  --green: #22c55e;
  --orange: #f59e0b;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 10%, rgba(229, 9, 20, 0.08), transparent),
    radial-gradient(ellipse 500px 350px at 80% 80%, rgba(99, 102, 241, 0.06), transparent);
  pointer-events: none;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 32px;
  animation: fadeIn 0.6s ease-out;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 12px var(--red-glow));
}

.logo h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, #E50914 0%, #ff6b6b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle { color: var(--text-sec); font-size: 0.875rem; }

/* Input Card */
.input-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  animation: fadeIn 0.6s ease-out 0.1s both;
}

.input-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}
.input-label svg { color: var(--red); }

.key-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.key-input::placeholder { color: var(--text-muted); font-weight: 400; letter-spacing: 0; }
.key-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-glow); }

.input-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition);
  outline: none;
  white-space: nowrap;
}

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, #E50914 0%, #B20710 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(229, 9, 20, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(229, 9, 20, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-sec);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }

.btn-full { width: 100%; margin-top: 20px; }

/* Loading */
.loading-section { display: flex; justify-content: center; padding: 60px 0; }
.loader { text-align: center; }
.loader-ring {
  width: 48px; height: 48px;
  border: 3px solid rgba(229, 9, 20, 0.15);
  border-top-color: var(--red);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
.loader-text { color: var(--text-sec); font-size: 0.9rem; animation: pulse 1.5s ease-in-out infinite; }

/* Error */
.error-card {
  background: var(--bg-card);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  animation: fadeIn 0.4s ease-out;
}
.error-card h3 { color: #ef4444; font-size: 1.1rem; margin: 16px 0 8px; }
.error-card p { color: var(--text-sec); font-size: 0.85rem; margin-bottom: 24px; }

/* Account Card */
.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  backdrop-filter: blur(20px);
  animation: fadeIn 0.5s ease-out;
}

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

.account-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--green);
}

.status-dot {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  animation: pulseGlow 2s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

.account-plan {
  background: linear-gradient(135deg, rgba(229, 9, 20, 0.15), rgba(229, 9, 20, 0.05));
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  border: 1px solid rgba(229, 9, 20, 0.2);
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 0.8rem; color: var(--text-sec); font-weight: 500; }
.detail-value { font-size: 0.8rem; color: var(--text); font-weight: 600; text-align: right; }

.expiry-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-top: 12px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--orange);
}
.expiry-info svg { flex-shrink: 0; }

/* Devices Card */
.devices-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  backdrop-filter: blur(20px);
  animation: fadeIn 0.5s ease-out 0.1s both;
}

.devices-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.devices-header svg { color: var(--red); }
.devices-header h2 { font-size: 1rem; font-weight: 700; flex: 1; }

.device-count {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.devices-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.device-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.device-item:hover { background: rgba(255, 255, 255, 0.04); transform: translateY(-2px); }

.device-icon-wrap {
  width: 56px; height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.device-icon-pc {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.04));
  color: var(--blue);
  border: 1px solid rgba(99, 102, 241, 0.15);
}
.device-icon-phone {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(168, 85, 247, 0.04));
  color: var(--purple);
  border: 1px solid rgba(168, 85, 247, 0.15);
}
.device-icon-tv {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04));
  color: var(--orange);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.device-name { font-size: 0.8rem; font-weight: 600; }

.device-actions {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-copy,
.btn-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-sec);
  font-size: 0.7rem;
  font-weight: 500;
  transition: all var(--transition);
  outline: none;
}

.btn-open {
  background: rgba(229, 9, 20, 0.12);
  border-color: rgba(229, 9, 20, 0.2);
  color: #ff6b6b;
  font-weight: 700;
}

.btn-copy:hover,
.btn-open:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn-copy:disabled,
.btn-open:disabled,
.btn-copy.is-disabled,
.btn-open.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-copy.copied { background: rgba(34, 197, 94, 0.12); color: var(--green); border-color: rgba(34, 197, 94, 0.3); }

/* Refresh button */
.refresh-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition);
  outline: none;
}
.btn-refresh:hover { background: rgba(99, 102, 241, 0.2); }
.btn-refresh:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-refresh .spinner { width: 14px; height: 14px; border-width: 2px; border-color: rgba(99, 102, 241, 0.3); border-top-color: var(--blue); }

.refresh-info { font-size: 0.7rem; color: var(--text-muted); }

/* Warning */
.devices-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--text-sec);
  line-height: 1.5;
}
.devices-warning svg { color: var(--orange); flex-shrink: 0; }
.devices-warning strong { color: var(--orange); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(34, 197, 94, 0.95);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: rgba(239, 68, 68, 0.95); box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3); }

@media (max-width: 480px) {
  .container { padding: 20px 12px 48px; }
  .logo h1 { font-size: 1.4rem; }
  .input-card, .devices-card, .account-card { padding: 18px; }
  .devices-grid { gap: 8px; }
  .device-item { padding: 14px 8px 12px; }
  .device-icon-wrap { width: 44px; height: 44px; }
  .device-icon-wrap svg { width: 22px; height: 22px; }
  .device-name { font-size: 0.72rem; }
  .btn-copy, .btn-open { font-size: 0.65rem; padding: 5px 8px; }
}
