/* ============================================================
   STYLE.CSS — M-NEXUS (sci-fi academic look, blue tones)
   Main hub — shared visual system across all modules
   ============================================================ */

/* ------------------------------------------------------------
   THEME SYSTEM
   Today only "scifi-blue" exists (your current theme). To add a
   new theme later:
     1. Duplicate the block below
     2. Rename it, e.g: :root[data-theme="scifi-red"]
     3. Edit the color values inside that block
     4. Add the name in js/themes.js -> AVAILABLE_THEMES
   The plain :root selector (no attribute) is a fallback in case
   JS hasn't run yet — it mirrors the same default theme.
   ------------------------------------------------------------ */
:root,
:root[data-theme="scifi-blue"] {
  --color-bg-black:    #050a14;
  --color-bg:          #0a1628;
  --color-panel:       #0e1f38;
  --color-panel-light: #142b4d;
  --color-border:      #1f4068;
  --color-cyan:        #4fd6ff;
  --color-cyan-soft:   #8be9ff;
  --color-accent-blue: #2b6cff;
  --color-text-bright: #e7f2ff;
  --color-text-muted:  #93b3da;
  --color-success:     #3ddc97;
  --color-error:       #ff5a6a;
  --font-display: 'Orbitron', sans-serif;
  --font-body:    'Rajdhani', sans-serif;
}

/* EXAMPLE of a second theme (kept commented out, not active yet —
   uncomment and adjust whenever you want to enable theme switching):

:root[data-theme="example-green"] {
  --color-bg-black:    #050f0a;
  --color-bg:          #0a2818;
  --color-panel:       #0e3824;
  --color-panel-light: #144d33;
  --color-border:      #1f6840;
  --color-cyan:        #4dffb3;
  --color-cyan-soft:   #8bffd0;
  --color-accent-blue: #2bff8c;
  --color-text-bright: #e7fff2;
  --color-text-muted:  #93dab3;
  --color-success:     #3ddc97;
  --color-error:       #ff5a6a;
  --font-display: 'Orbitron', sans-serif;
  --font-body:    'Rajdhani', sans-serif;
}
*/

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { font-size: 18px; }

body {
  background: var(--color-bg-black);
  color: var(--color-text-bright);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Holographic grid background */
.background-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(79, 214, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 214, 255, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  background-color: var(--color-bg-black);
}
.background-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, rgba(43, 108, 255, 0.18), transparent 60%),
              radial-gradient(ellipse at bottom, rgba(79, 214, 255, 0.10), transparent 60%);
}

/* ---------------- Header ---------------- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(14, 31, 56, 0.9), rgba(10, 22, 40, 0.6));
  backdrop-filter: blur(4px);
}
.header-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-slot {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-panel);
}
.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}
h1 {
  font-family: var(--font-display);
  font-size: clamp(15px, 4vw, 19px);
  letter-spacing: 1.2px;
  color: var(--color-text-bright);
  line-height: 1.3;
}
h1 span { color: var(--color-cyan); }
.subtitle {
  color: var(--color-text-muted);
  font-size: clamp(11px, 2.6vw, 13px);
  letter-spacing: 0.6px;
  margin-top: 2px;
  text-transform: uppercase;
}

/* ---------------- Tabs ---------------- */
.tabs {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 20px 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-button {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-bottom: none;
  padding: 12px 18px;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  transition: all 0.18s ease;
}
.tab-button:hover { color: var(--color-cyan-soft); }
.tab-button.active {
  color: var(--color-cyan);
  background: var(--color-panel-light);
  border-color: var(--color-cyan);
  box-shadow: 0 -2px 14px rgba(79, 214, 255, 0.18) inset;
}

/* ---------------- Main container ---------------- */
.main-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px 70px;
  background: var(--color-panel-light);
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}

.tab-panel { padding: 26px 0 6px; }
.hidden { display: none !important; }

/* ---------------- Module grid ---------------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--color-panel), var(--color-bg));
  border: 1px solid var(--color-border);
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.module-card:hover,
.module-card:focus-visible {
  border-color: var(--color-cyan);
  box-shadow: 0 0 18px rgba(79, 214, 255, 0.18);
  transform: translateY(-2px);
}
.module-card:focus-visible { outline: 2px solid var(--color-cyan); outline-offset: 2px; }
.module-card:active { transform: scale(0.99); }

.module-card.inactive { cursor: not-allowed; opacity: 0.5; }
.module-card.inactive:hover { border-color: var(--color-border); box-shadow: none; transform: none; }

.module-icon {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  background: var(--color-panel-light);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}
.module-icon img { width: 100%; height: 100%; object-fit: cover; }

.module-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.module-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.module-code {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 1px;
  color: var(--color-cyan-soft);
}

.status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-active   { background: rgba(61, 220, 151, 0.15); color: var(--color-success); border: 1px solid var(--color-success); }
.badge-inactive { background: rgba(147, 179, 218, 0.1); color: var(--color-text-muted); border: 1px solid var(--color-border); }

.module-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-bright);
  letter-spacing: 0.3px;
}

.module-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  flex-grow: 1;
}

.module-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-cyan);
  margin-top: 4px;
}
.module-card.inactive .module-link { color: var(--color-text-muted); }

.empty-state {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  padding: 20px 4px;
}

/* ---------------- Footer ---------------- */
.site-footer {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  padding: 24px;
  letter-spacing: 0.5px;
}

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */
@media (max-width: 600px) {
  html { font-size: 17px; }
  .header-inner { padding: 12px 16px; }
  .tabs { padding: 12px 16px 0; gap: 3px; }
  .tab-button { padding: 10px 14px; font-size: 0.7rem; }
  .main-container { padding: 0 14px 60px; }
  .tab-panel { padding: 20px 0 6px; }
}

@media (max-width: 480px) {
  .module-grid { grid-template-columns: 1fr; gap: 10px; }
  .module-icon { aspect-ratio: 21 / 9; font-size: 1.7rem; }
}

@media (min-width: 481px) and (max-width: 680px) {
  .module-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 360px) {
  html { font-size: 16px; }
}
