/* ============================================
   Phoenix Theme — Components
   Reusable UI component classes
   ============================================ */

/* ─── Page Layout ─── */

.page {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 60px var(--page-padding) 100px;
}

.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--page-padding);
}

/* ─── Back Link ─── */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: var(--font-weight-med);
  transition: color var(--transition-fast);
  margin-bottom: 32px;
}
.back-link:hover {
  color: var(--text-secondary);
}

/* ─── Typography ─── */

.page-title {
  font-size: 2.5rem;
  font-weight: var(--font-weight-semi);
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.page-sub {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 40px;
  line-height: 1.5;
}

.section-title {
  font-size: 1.25rem;
  font-weight: var(--font-weight-semi);
  margin-bottom: 16px;
  letter-spacing: -0.2px;
}

/* ─── Card ─── */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

.card-hover:hover {
  border-color: var(--blue-border);
  background: var(--bg-surface-hover);
  transform: translateY(-2px);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

.card-elevated {
  box-shadow: var(--shadow-card);
}

/* ─── Card Grid ─── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  width: 100%;
}

.card-grid .card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
}
.card-grid .card-item:hover {
  border-color: var(--blue-border);
  background: var(--bg-surface-hover);
  transform: translateY(-2px);
}
.card-grid .card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  line-height: 1;
}
.card-grid .card-title {
  font-size: 1.15rem;
  font-weight: var(--font-weight-semi);
  margin-bottom: 6px;
}
.card-grid .card-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
}
.card-grid .card-meta {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* ─── Tags / Badges ─── */

.tag {
  display: inline-block;
  background: var(--blue-subtle);
  color: var(--blue);
  padding: 2px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: var(--font-weight-med);
  line-height: 1.5;
}

.tag-amber {
  background: var(--amber-subtle);
  color: var(--amber);
}

.tag-green {
  background: rgba(48,209,88,0.08);
  color: var(--green);
}

/* ─── Buttons ─── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: var(--font-weight-semi);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 0 #1a5ab0;
}
.btn-primary:hover {
  background: #4a8aff;
}

.btn-amber {
  background: var(--amber);
  color: #1a1400;
  box-shadow: 0 2px 0 #b87a14;
}
.btn-amber:hover {
  background: #fbb43d;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.btn-ghost:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn-full {
  width: 100%;
}

/* ─── Form Elements ─── */

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: var(--font-weight-med);
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: var(--font-weight-med);
  outline: none;
  transition: border-color var(--transition-fast);
}
.form-input:focus {
  border-color: var(--border-focus);
}
.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast);
}
.form-input-wrap:focus-within {
  border-color: var(--border-focus);
}
.form-input-wrap .prefix {
  padding-left: 14px;
  color: var(--text-tertiary);
  font-weight: var(--font-weight-med);
  font-size: 0.9rem;
  pointer-events: none;
  white-space: nowrap;
}
.form-input-wrap .form-input {
  border: none;
  background: transparent;
  padding-left: 6px;
}

/* ─── Slider ─── */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border-hover);
  outline: none;
  margin-top: 8px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  border: 3px solid var(--bg-surface);
  box-shadow: 0 0 0 1px var(--blue-border);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  border: 3px solid var(--bg-surface);
}

/* ─── Form Row ─── */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 520px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .page-title {
    font-size: 1.8rem;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Results / Stats ─── */

.results-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-muted);
}

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

.stat-grid .stat-item {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-grid .stat-full {
  grid-column: span 2;
}

.stat-grid .stat-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-grid .stat-value {
  font-size: 1.35rem;
  font-weight: var(--font-weight-bold);
  color: var(--green);
}

.stat-grid .stat-value.amber {
  color: var(--amber);
}

.stat-grid .stat-value.blue {
  color: var(--blue);
}

.stat-grid .stat-value.purple {
  color: var(--purple);
}

.stat-grid .stat-value.large {
  font-size: 1.6rem;
}

.stat-grid .stat-value.med {
  font-size: 1.1rem;
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .stat-grid .stat-full {
    grid-column: span 1;
  }
}

/* ─── Toggle / Breakdown ─── */

.toggle-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 12px 0 4px;
  font-family: var(--font-sans);
  transition: color var(--transition-fast);
}
.toggle-btn:hover {
  color: var(--text-secondary);
}

.breakdown {
  margin-top: 10px;
  display: none;
}
.breakdown.open {
  display: block;
}

.breakdown table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.breakdown th {
  text-align: left;
  color: var(--text-tertiary);
  font-weight: var(--font-weight-med);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-hover);
}
.breakdown td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-muted);
  color: var(--text-secondary);
}
.breakdown td:last-child {
  text-align: right;
  font-weight: var(--font-weight-med);
  color: var(--text-primary);
}
.breakdown tr:last-child td {
  border-bottom: none;
}

/* ─── Footer ─── */

.footer-tag {
  margin-top: 20px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-faint);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Extended site footer */
.site-footer {
  margin-top: 80px;
  padding: 48px 0;
  border-top: 1px solid var(--border-default);
  text-align: center;
}

.site-footer-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.site-footer-main a {
  color: var(--text-tertiary);
  font-size: 0.82rem;
  text-decoration: none;
  transition: color var(--transition-fast);
}
.site-footer-main a:hover {
  color: var(--text-secondary);
}

.site-footer .sep {
  color: var(--border-hover);
  font-size: 0.7rem;
}

.site-footer-block {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.6;
  margin-bottom: 6px;
}

.site-footer-label {
  display: inline-block;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-size: 0.6rem;
  margin-right: 10px;
}

.site-footer-link {
  color: var(--text-tertiary);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-hover);
  transition: color var(--transition-fast);
}
.site-footer-link:hover {
  color: var(--text-secondary);
}

/* ─── Footer Privacy / Security / Copyright blocks ─── */

.footer-block {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.footer-label {
  display: inline-block;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-size: 0.6rem;
  margin-right: 10px;
}

.footer-link {
  color: var(--text-tertiary);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-hover);
  transition: color var(--transition-fast);
}
.footer-link:hover {
  color: var(--text-secondary);
}

@media (max-width: 520px) {
  .site-footer {
    margin-top: 48px;
    padding: 32px 0;
  }
  .site-footer-main {
    gap: 14px;
    flex-direction: column;
  }
}

/* ─── Animations ─── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.animate-in {
  animation: fadeIn 0.5s ease-out both;
}

.animate-in-d1 { animation-delay: 0.1s; }
.animate-in-d2 { animation-delay: 0.2s; }
.animate-in-d3 { animation-delay: 0.3s; }
