/* === Reset & Variables (Tokyo Night) === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #1a1b26;
  --bg-secondary: #16161e;
  --bg-surface: #1e1f2e;
  --bg-code: #0d0e17;
  --text-primary: #c0caf5;
  --text-secondary: #565f89;
  --text-muted: #414868;
  --accent-blue: #7aa2f7;
  --accent-purple: #bb9af7;
  --accent-cyan: #7dcfff;
  --accent-green: #9ece6a;
  --accent-red: #f7768e;
  --accent-yellow: #e0af68;
  --border: #292e42;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  overflow-x: hidden;
}

code, .mono {
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', Menlo, monospace;
}

a { color: var(--accent-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === Nav === */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(22, 22, 30, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.nav-logo img {
  height: 32px;
  width: auto;
}
.nav-logo:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); text-decoration: none; }

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  background: var(--accent-blue);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  text-decoration: none;
}
.nav-btn:hover { opacity: 0.9; text-decoration: none; }

.lang-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}

.lang-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn.active {
  background: var(--accent-blue);
  color: var(--bg-primary);
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* === Footer === */
footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-brand {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-blue);
  margin-bottom: 12px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.footer-links a:hover { color: var(--text-primary); }

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === Section Common === */
section { padding: 80px 0; }

.section-label {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-purple);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 48px;
}

/* === Buttons === */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--accent-blue);
  color: var(--bg-primary);
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  text-decoration: none;
  width: 100%;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); text-decoration: none; }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-decoration: none;
}
.btn-secondary:hover {
  border-color: var(--accent-blue);
  background: rgba(122, 162, 247, 0.05);
  text-decoration: none;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  color: var(--accent-red);
  border: 1px solid rgba(247, 118, 142, 0.3);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-danger:hover {
  background: rgba(247, 118, 142, 0.1);
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* === Forms === */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent-blue);
}
.form-input::placeholder {
  color: var(--text-muted);
}

.form-error {
  font-size: 0.8rem;
  color: var(--accent-red);
  margin-top: 6px;
  display: none;
}
.form-error.show {
  display: block;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* === Cards === */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
}

.card-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

/* === Auth Card (centered layout) === */
.auth-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 40px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo img {
  height: 40px;
}

.auth-title {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.auth-link a {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* === Alert messages === */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: none;
}
.alert.show { display: block; }
.alert-success {
  background: rgba(158, 206, 106, 0.1);
  border: 1px solid rgba(158, 206, 106, 0.3);
  color: var(--accent-green);
}
.alert-error {
  background: rgba(247, 118, 142, 0.1);
  border: 1px solid rgba(247, 118, 142, 0.3);
  color: var(--accent-red);
}
.alert-info {
  background: rgba(122, 162, 247, 0.1);
  border: 1px solid rgba(122, 162, 247, 0.3);
  color: var(--accent-blue);
}

/* === Spinner === */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(22, 22, 30, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* === Page Content === */
.page-content {
  padding-top: 80px;
  min-height: 100vh;
}

/* === Tables (admin) === */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(41, 46, 66, 0.5);
  color: var(--text-primary);
}

.data-table tr:hover td {
  background: rgba(122, 162, 247, 0.03);
}

/* === Badges === */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-active {
  background: rgba(158, 206, 106, 0.15);
  color: var(--accent-green);
}
.badge-canceled {
  background: rgba(247, 118, 142, 0.15);
  color: var(--accent-red);
}
.badge-free {
  background: rgba(86, 95, 137, 0.2);
  color: var(--text-secondary);
}
.badge-past-due {
  background: rgba(224, 175, 104, 0.15);
  color: var(--accent-yellow);
}
.badge-admin {
  background: rgba(187, 154, 247, 0.15);
  color: var(--accent-purple);
}

/* === Stat Cards === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === Pricing Cards === */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
  display: flex;
  flex-direction: column;
}

.pricing-card.featured {
  border-color: var(--accent-blue);
  position: relative;
}
.pricing-card.featured::before {
  content: attr(data-badge);
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-blue);
  color: var(--bg-primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 12px;
}

.pricing-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.pricing-price {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.pricing-price .currency { font-size: 1.2rem; vertical-align: super; }
.pricing-price .period { font-size: 0.9rem; color: var(--text-secondary); font-weight: 400; }

.pricing-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.pricing-features {
  list-style: none;
  margin-bottom: 32px;
  flex: 1;
}

.pricing-features li {
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pricing-features li::before {
  content: '\2713';
  color: var(--accent-green);
  font-weight: 700;
  flex-shrink: 0;
}

.pricing-features li.disabled {
  color: var(--text-muted);
}
.pricing-features li.disabled::before {
  content: '\2717';
  color: var(--text-muted);
}

/* === Pricing legal note === */
.pricing-legal {
  margin-top: 32px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}
.pricing-legal a {
  color: var(--accent-cyan);
  text-decoration: underline;
}

/* === Dashboard layout === */
.dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.dashboard-wide {
  max-width: 1100px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.dashboard-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
}

/* === User avatar === */
.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  flex-shrink: 0;
}

/* === User info row === */
.user-info-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.user-info-text h3 {
  font-size: 1rem;
  font-weight: 600;
}
.user-info-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* === Detail rows === */
.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(41, 46, 66, 0.5);
}
.detail-row:last-child { border-bottom: none; }

.detail-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.detail-value {
  font-size: 0.9rem;
  font-weight: 600;
}

/* === Empty state === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}
.empty-state p {
  font-size: 0.95rem;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(22, 22, 30, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
}

.modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* === Responsive === */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 16px;
  }
  .nav-hamburger { display: block; }

  .section-title { font-size: 1.6rem; }

  .pricing-grid { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px; }
}
