/* ====================================================
   E-Mothership Portal — CSS
   Space/dark theme
   ==================================================== */

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

:root {
  --bg-base:        #07080f;
  --bg-surface:     #0d0f1c;
  --bg-card:        #111327;
  --bg-card-hover:  #161931;
  --bg-alt:         #0a0c18;
  --border:         rgba(99, 112, 255, 0.15);
  --border-hover:   rgba(99, 112, 255, 0.45);

  --accent-1:       #6370ff;  /* indigo */
  --accent-2:       #a45cff;  /* purple */
  --accent-3:       #3de8c8;  /* teal */

  --text-primary:   #e8eaf6;
  --text-secondary: #8891b8;
  --text-muted:     #4a5080;

  --status-ok:      #22d4a0;
  --status-warn:    #f5a623;
  --status-down:    #ff4f6b;
  --status-unknown: #4a5080;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.45), 0 0 0 1px var(--border);
  --shadow-card-hover: 0 8px 40px rgba(99,112,255,0.18), 0 0 0 1px var(--border-hover);

  --font-body: 'Inter', system-ui, sans-serif;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── Starfield ── */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

/* Everything sits above starfield */
header, section, footer, .modal-overlay { position: relative; z-index: 1; }

/* ── Typography ── */
h1, h2, h3 { font-family: var(--font-display); }

.gradient-text {
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 60%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

a { text-decoration: none; color: inherit; }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 8, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-icon {
  font-size: 28px;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.brand-tagline {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover { color: var(--text-primary); background: rgba(99,112,255,0.1); }

.btn-access {
  padding: 8px 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-access:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Hero ── */
.hero {
  padding: 100px 24px 80px;
  text-align: center;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(99,112,255,0.13) 0%, transparent 70%);
}

.hero-inner { max-width: 720px; margin: 0 auto; }

.hero-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 100px;
  background: rgba(99,112,255,0.12);
  border: 1px solid rgba(99,112,255,0.3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent-1);
  margin-bottom: 28px;
}

.hero-title {
  font-size: clamp(36px, 7vw, 68px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 48px;
  line-height: 1.7;
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 40px;
}

.meta-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.meta-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-3);
}

.meta-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }

.meta-divider { width: 1px; height: 40px; background: var(--border); }

/* ── Sections ── */
.service-section { padding: 80px 24px; }
.service-section.alt-bg { background: var(--bg-alt); }

.section-inner { max-width: 1200px; margin: 0 auto; }

.section-header { margin-bottom: 40px; }

.section-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.section-desc { font-size: 16px; color: var(--text-secondary); }

/* ── Cards Grid ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* ── Service Card ── */
.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,112,255,0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}
.service-card:hover::before { opacity: 1; }

/* Status dot */
.card-status-dot {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--status-unknown);
  transition: background 0.4s;
}
.card-status-dot.online  { background: var(--status-ok);   box-shadow: 0 0 8px var(--status-ok); }
.card-status-dot.offline { background: var(--status-down); }
.card-status-dot.checking { background: var(--status-warn); animation: pulse-warn 1.2s ease-in-out infinite; }

@keyframes pulse-warn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Card icon */
.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-icon svg { width: 24px; height: 24px; }

/* Per-service accent colors */
.jellyfin-icon  { background: rgba(0, 164, 220, 0.15); color: #00a4dc; }
.calibre-icon   { background: rgba(255, 165, 0, 0.15);  color: #ffa500; }
.komga-icon     { background: rgba(255, 90, 90, 0.15);  color: #ff5a5a; }
.audio-icon     { background: rgba(61, 232, 200, 0.15); color: var(--accent-3); }
.plane-icon     { background: rgba(99, 112, 255, 0.15); color: var(--accent-1); }
.war-icon       { background: rgba(164, 92, 255, 0.15); color: var(--accent-2); }
.portainer-icon { background: rgba(19, 209, 138, 0.15); color: #13d18a; }
.nginx-icon     { background: rgba(9, 179, 69, 0.15);   color: #09b345; }
.obico-icon     { background: rgba(255, 120, 50, 0.15); color: #ff7832; }
.patent-icon    { background: rgba(99, 112, 255, 0.15); color: var(--accent-1); }
.neo4j-icon     { background: rgba(0, 120, 255, 0.15);  color: #0078ff; }
.hma-icon       { background: rgba(180, 120, 40, 0.15); color: #c8922a; }

.card-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }

.card-title { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }

.card-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: rgba(99,112,255,0.1);
  color: var(--accent-1);
  border: 1px solid rgba(99,112,255,0.2);
}
.admin-tag { background: rgba(255,79,107,0.1); color: #ff4f6b; border-color: rgba(255,79,107,0.2); }

.card-arrow {
  position: absolute;
  bottom: 22px;
  right: 22px;
  font-size: 18px;
  color: var(--text-muted);
  transition: color 0.2s, transform 0.2s;
}
.service-card:hover .card-arrow { color: var(--accent-1); transform: translate(3px, -1px); }

/* ── Admin Section ── */
.admin-section .section-header { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.admin-section .section-title,
.admin-section .section-desc { flex: 1 0 100%; }

.btn-unlock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 8px;
  background: rgba(255,79,107,0.1);
  border: 1px solid rgba(255,79,107,0.3);
  color: #ff4f6b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn-unlock:hover { background: rgba(255,79,107,0.18); border-color: rgba(255,79,107,0.6); }

.admin-cards.locked {
  position: relative;
  pointer-events: none;
  user-select: none;
}
.admin-cards.locked::after {
  content: 'Admin access required';
  position: absolute;
  inset: -16px;
  background: rgba(10, 12, 24, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-lg);
  letter-spacing: 0.5px;
}
.admin-cards:not(.locked) { pointer-events: auto; }
.admin-cards:not(.locked)::after { display: none; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(7, 8, 15, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay[hidden] { display: none; }

.modal {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: modal-in 0.25s ease;
}
.modal-sm { max-width: 380px; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.12); }

.modal-title { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.modal-desc  { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; line-height: 1.6; }

/* ── Form ── */
.access-form { display: flex; flex-direction: column; gap: 18px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.form-group input,
.form-group select {
  padding: 11px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(99,112,255,0.15);
}
.form-group select { appearance: none; cursor: pointer; }
.form-group select option { background: var(--bg-card); }

.checkbox-group { display: flex; flex-direction: column; gap: 10px; }
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.checkbox-group input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent-1); cursor: pointer; }

.btn-submit {
  padding: 13px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-submit:hover { opacity: 0.9; transform: translateY(-1px); }

.form-note { font-size: 12px; color: var(--text-muted); text-align: center; }

.pin-error { color: var(--status-down); font-size: 13px; font-weight: 600; text-align: center; }

/* Success state */
.form-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  text-align: center;
}
.form-success[hidden] { display: none; }
.success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(34, 212, 160, 0.15);
  border: 2px solid var(--status-ok);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--status-ok);
}
.form-success h3 { font-size: 20px; font-weight: 700; }
.form-success p  { font-size: 14px; color: var(--text-secondary); }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  background: var(--bg-base);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text-muted); }

.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: 13px; color: var(--text-muted); transition: color 0.2s; }
.footer-links a:hover { color: var(--text-primary); }

.footer-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--status-ok);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-ok);
  box-shadow: 0 0 6px var(--status-ok);
  animation: pulse-ok 2.5s ease-in-out infinite;
}

@keyframes pulse-ok {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(99,112,255,0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,112,255,0.5); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .header-nav .nav-link { display: none; }
  .hero { padding: 64px 20px 60px; }
  .hero-meta { padding: 16px 24px; gap: 20px; }
  .service-section { padding: 60px 20px; }
  .cards-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .modal { padding: 28px 24px; }
}

@media (max-width: 480px) {
  .hero-title { letter-spacing: -0.8px; }
  .hero-meta { flex-direction: column; gap: 16px; }
  .meta-divider { display: none; }
}
