/* ── PUBLIC SITE — SHARED STYLESHEET ── */
/* Uses the same design system as portal.css */

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

:root {
  --bg:           #020617;
  --card-bg:      #111827;
  --card-border:  #1F2D3D;
  --sidebar-bg:   #0F172A;
  --accent:       #3B82F6;
  --accent-cyan:  #22D3EE;
  --text:         #E5E7EB;
  --text-muted:   #6B7280;
  --border:       #1E293B;
  --radius:       10px;
  --success:      #22c55e;
  --danger:       #ef4444;
  --warning:      #f59e0b;

  /* Public-page aliases (match names used inline) */
  --fg:           #E5E7EB;
  --primary:      #3B82F6;
  --primary-10:   rgba(59,130,246,0.10);
  --primary-20:   rgba(59,130,246,0.20);
  --muted:        #1F2D3D;
  --muted-fg:     #6B7280;
  --card:         #111827;

  --scrollbar-thumb:        rgba(148, 163, 184, 0.22);
  --scrollbar-thumb-hover: rgba(59, 130, 246, 0.4);
  --scrollbar-track:        transparent;
}

html {
  font-size: 16px;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}
html::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
html::-webkit-scrollbar-track {
  background: var(--bg);
}
html::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--bg);
  background-clip: padding-box;
}
html::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  border: 2px solid var(--bg);
  background-clip: padding-box;
}
html::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── STARS CANVAS ── */
#stars-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── HEADER ── */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(2,6,23,0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 max(1.5rem, env(safe-area-inset-right)) 0 max(1.5rem, env(safe-area-inset-left));
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.header-left { display: flex; align-items: center; }

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-self: end;
  flex-shrink: 0;
}

.header-username {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── LOGO ── */
.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--text);
  flex-shrink: 0;
  min-width: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon img { width: 100%; height: 100%; object-fit: contain; }

/* ── NAV (pill bar) ── */
header nav {
  display: flex;
  align-items: center;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.22rem;
  gap: 0.1rem;
}

header nav a {
  position: relative;
  padding: 0.38rem 0.95rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

header nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

header nav a.active {
  color: var(--text);
  background: #162032;
  border: 1px solid rgba(29,78,216,0.25);
  font-weight: 600;
}

/* Mobil: navigering på egen rad med horisontell scroll (döljs inte) */
@media (max-width: 768px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    height: auto;
    min-height: 56px;
    padding: 0.65rem max(1rem, env(safe-area-inset-right)) 0.65rem max(1rem, env(safe-area-inset-left));
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.5rem;
  }
  .header-inner .header-left {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  .header-inner .header-right {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    flex-shrink: 0;
  }
  .header-inner nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 10px), transparent);
  }
  .header-inner nav::-webkit-scrollbar {
    display: none;
  }
}
@media (max-width: 380px) {
  .logo { font-size: 0.92rem; gap: 0.45rem; }
  .btn-login { padding: 0.4rem 0.85rem; font-size: 0.8125rem; }
}

/* ── BUTTONS ── */
.btn-login {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn-login:hover { opacity: 0.88; }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  transition: color 0.15s, background 0.15s;
}
.btn-logout:hover { color: var(--text); background: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  border: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.88; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--muted); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--muted); }

.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.78rem; }
.btn-danger { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #FCA5A5; border-radius: var(--radius); }
.btn-danger:hover { background: rgba(239,68,68,0.22); }

/* ── CARD ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
}

/* ── BACK LINK ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

/* ── PAGE EYEBROW ── */
.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 6px;
  padding: 4px 12px;
  margin-bottom: 0.75rem;
}

/* ── FORM ELEMENTS ── */
input[type="text"],
input[type="number"],
input[type="email"],
textarea,
select {
  width: 100%;
  background: #0D1525;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  padding: 0.65rem 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 100px; }
select option { background: var(--card-bg); color: var(--text); }

/* ── MODAL ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }
.modal {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal::-webkit-scrollbar {
  width: 8px;
}
.modal::-webkit-scrollbar-track {
  background: transparent;
}
.modal::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.modal::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  border: 2px solid transparent;
  background-clip: padding-box;
}
.modal::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
.modal-header { padding: 1.5rem 1.75rem 0; }
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 1.25rem 1.75rem; }
.modal-footer { padding: 0 1.75rem 1.5rem; display: flex; gap: 0.6rem; justify-content: flex-end; }
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { min-height: 200px; resize: vertical; line-height: 1.6; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }

/* ── FOOTER ── */
footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
}

.footer-center {
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  padding: 1.5rem;
}

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── PULSE DOT ── */
.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  position: relative;
  display: inline-block;
}
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0.4;
  animation: pub-pulse 1.8s ease-in-out infinite;
}
@keyframes pub-pulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.8); opacity: 0; }
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.empty-state svg { opacity: 0.3; margin-bottom: 1rem; }
.empty-state p { font-size: 0.9rem; }

/* ── MOBILE — PUBLIC PAGES ── */
@media (max-width: 640px) {
  /* Modal: bottom sheet */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
  .modal-footer { flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; justify-content: center; }

  /* Buttons */
  .btn-lg { padding: 0.65rem 1.4rem; font-size: 0.95rem; }

  /* Form */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  textarea,
  select {
    font-size: 1rem; /* prevent iOS zoom */
  }
}

@media (max-width: 480px) {
  /* Smaller page padding */
  .back-link { margin-bottom: 1.25rem; }

  /* Nav pill: scroll on tiny screens */
  header nav {
    padding: 0.18rem;
  }
  header nav a {
    padding: 0.32rem 0.72rem;
    font-size: 0.8rem;
  }
}

