/* === CSS Variables === */
:root {
  --bg: #080d17;
  --surface: #111A24;
  --surface-hover: #1a2533;
  --accent: #0EA5E9;
  --accent-hover: #0b8cc7;
  --text: #FFFFFF;
  --text-muted: #8899AA;
  --border: #2a3f50;
  --radius: 8px;
  --max-width: 1200px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* === Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

a:hover {
  color: var(--accent-hover);
}

/* === Typography === */
h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h3 { font-size: clamp(1.15rem, 3vw, 1.5rem); }

/* === Container === */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  border: 2px solid transparent;
  font-family: var(--font);
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: var(--text);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--text);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: var(--text);
}

/* === Header / Nav === */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.logo img {
  display: inline;
}

.logo:hover {
  color: var(--text);
}

.logo span {
  color: var(--accent);
}

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

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links .btn {
  padding: 0.6rem 1.5rem;
  font-size: 0.95rem;
}

.nav-links .btn-primary {
  color: var(--text);
}

/* Mobile Dashboard button wrapper */
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Auth-aware nav items (populated by nav.js) */
.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* User dropdown (logged-in state, populated by nav.js) */
.nav-user-dropdown {
  position: relative;
}

.nav-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}

.nav-user-trigger:hover {
  border-color: var(--accent);
  color: var(--text);
}

.nav-user-trigger i {
  font-size: 1.1rem;
}

.nav-user-trigger .fa-circle-user {
  color: var(--accent);
}

.nav-user-trigger .chevron {
  font-size: 0.7rem;
  margin-left: 0.15rem;
  transition: transform 0.2s;
}

.nav-user-dropdown.open .chevron {
  transform: rotate(180deg);
}

.nav-user-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  overflow: hidden;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.nav-user-dropdown.open .nav-user-menu {
  display: block;
}

.nav-user-menu a,
.nav-user-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: none;
  border: none;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-user-menu hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.35rem 0;
}

.nav-delete-account {
  color: var(--text-muted);
}

.nav-delete-account:hover {
  background: var(--surface-hover);
  color: #dc2626;
}

.nav-user-menu a:hover,
.nav-user-menu button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-cta-btn {
  padding: 0.55rem 1.25rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Hamburger */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
  z-index: 101;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* === Utility === */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }

/* === Modal overlay (logout confirmation, etc.) === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.modal-box h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.modal-msg {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.modal-actions .btn {
  min-width: 120px;
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
}

/* Danger button variant */
.btn-danger {
  background: #dc2626;
  color: var(--text);
  border-color: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* Optional label hint */
.field-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* === Site Footer === */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2.5rem 0 1.5rem;
  margin-top: 3rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: flex-start;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.footer-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-brand img {
  display: inline;
}

.footer-brand:hover {
  color: var(--text);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-bottom {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive footer */
@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1.25rem;
  }

  .footer-brand {
    justify-self: center;
  }

  .footer-links {
    justify-content: center;
  }
}

/* === Delete Account Modal === */
.del-modal-left {
  text-align: left;
}

.del-modal-form-group {
  margin-bottom: 1.25rem;
}

.del-modal-form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.del-modal-form-group input[type="password"] {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color 0.2s;
  outline: none;
}

.del-modal-form-group input[type="password"]:focus {
  border-color: var(--accent);
}

.del-modal-warning {
  background: rgba(220, 38, 38, 0.1);
  border-left: 3px solid #dc2626;
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: #fca5a5;
  text-align: left;
  line-height: 1.5;
}

.del-modal-error {
  color: #ef4444;
  font-size: 0.85rem;
  margin-top: 0.3rem;
  text-align: left;
}

.del-modal-banner {
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid #dc2626;
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  color: #fca5a5;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  text-align: left;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  accent-color: #dc2626;
  cursor: pointer;
}

/* Delete modal step transitions */
.del-modal-step {
  display: none;
}

.del-modal-step.active {
  display: block;
}

/* Spinner inside danger button */
.btn-danger-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
