/* Design System & Custom Properties */
:root {
  --bg-dark: #080a10;
  --bg-grid: rgba(241, 101, 34, 0.03);
  --card-bg: rgba(17, 24, 39, 0.7);
  --card-border: rgba(255, 255, 255, 0.07);
  --card-border-focus: rgba(241, 101, 34, 0.4);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --etsy-orange: #f16522;
  --etsy-peach: #ff8c52;
  --accent-gradient: linear-gradient(135deg, #f16522 0%, #ff8c52 100%);
  --accent-glow: rgba(241, 101, 34, 0.35);

  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.2);
  --success-text: #34d399;

  --error-bg: rgba(239, 68, 68, 0.1);
  --error-border: rgba(239, 68, 68, 0.2);
  --error-text: #f87171;

  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.25);
  --warning-text: #fbbf24;

  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* Reset & Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  padding: 2rem 1rem;
}

/* Decorative background grid and ambient glows */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 1;
}

body::after {
  content: '';
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
}

/* Container & Glassmorphism Card */
.container {
  width: 100%;
  max-width: 650px;
  position: relative;
  z-index: 10;
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: rgba(241, 101, 34, 0.2);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 30px rgba(241, 101, 34, 0.05);
}

/* Header & Typography */
header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(241, 101, 34, 0.1);
  padding: 1rem;
  border-radius: 20px;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(241, 101, 34, 0.2);
}

.logo-container svg {
  width: 36px;
  height: 36px;
  fill: var(--etsy-orange);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.975rem;
  line-height: 1.5;
}

/* Alerts and Banners */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 16px;
  margin-bottom: 2rem;
  font-size: 0.925rem;
  line-height: 1.5;
  border: 1px solid transparent;
}

.alert-warning {
  background-color: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning-text);
}

.alert-error {
  background-color: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error-text);
}

.alert-success {
  background-color: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.alert-content {
  flex-grow: 1;
}

.alert-content h3 {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

/* Configuration Status List */
.status-list {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.status-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-family: monospace;
}

.status-value {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
}

.status-value.loaded {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--success-text);
}

.status-value.missing {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--error-text);
}

/* Forms & Buttons */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  text-align: center;
  font-family: var(--font-family);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px 0 rgba(241, 101, 34, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(241, 101, 34, 0.45);
}

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

.btn-primary:disabled {
  background: var(--text-muted);
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Success Flow & Tokens Page Layout */
.token-section {
  margin-top: 2rem;
}

.token-group {
  margin-bottom: 1.5rem;
}

.token-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.token-label-row label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.expiry-pill {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  color: var(--text-muted);
}

.token-box {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-family: monospace;
  font-size: 0.875rem;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  overflow: hidden;
}

.token-box:hover {
  border-color: var(--card-border-focus);
  background: rgba(0, 0, 0, 0.35);
}

.token-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 1rem;
  color: var(--text-primary);
  flex-grow: 1;
}

.copy-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  stroke: var(--text-secondary);
  transition: stroke 0.2s;
}

.token-box:hover .copy-icon {
  stroke: var(--etsy-peach);
}

/* Env Block Configuration Box */
.env-block-container {
  margin-top: 2.25rem;
  border-top: 1px solid var(--card-border);
  padding-top: 1.75rem;
}

.env-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.env-block-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.code-wrapper {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.35);
}

.code-wrapper pre {
  padding: 1.25rem;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #34d399; /* Green highlights for env block */
}

/* Toast/Notification feedback popup */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #111827;
  color: #ffffff;
  border: 1px solid var(--success-border);
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  z-index: 100;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
