:root {
  /* Main Typography colors */
  --font-color: #ebdbb2;           /* Gruvbox light foreground */
  --input-color: #fabd2f;          /* Gruvbox Yellow (Gold) */
  --highlight: #8392a5;            /* Gruvbox Blue for table headers */
  --shadow: rgba(250, 189, 47, 0.4);
  
  /* Status and alert colors */
  --color-error: #fb4934;          /* Gruvbox Red */
  --color-error-bg: rgba(251, 73, 52, 0.1);

  /* Font configurations */
  --terminal-font: 'Custom', 'Courier New', monospace;
  --terminal-font-size: clamp(12px, 2.2vw, 20px);
  --content-font-size: clamp(10px, 2.2vw, 18px);
  --header-font-size: clamp(20px, 2.5vw, 34px);
  --content-header-font-size: clamp(18px, 2.2vw, 34px);
  --left-right-space: 15px;
  --terminal-left-right-space: 40px;

  /* Gruvbox Backgrounds */
  --background: linear-gradient(0deg, #1d2021 0%, #282828 90%, #1d2021 100%);
  --background2: rgba(184, 187, 38, 0.15); /* Gruvbox Green with transparency */
  --black-transparent: rgba(40, 40, 40, 0.95); /* bg0 */
  --text-glow: 0 0 6px rgba(250, 189, 47, 0.4); 
  --color-odd-row: #282828;        /* bg1 */
  --color-even-row: #32302f;       /* bg0_soft */
  --border-muted: #7c6f64;         /* Gray */
}

@font-face {
    font-family: 'Custom';
    src: url('../data/F25_Bank_Printer.ttf');
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* swap is nice */
}

body {
  background-attachment: fixed;
  font-family: var(--terminal-font);
  color: var(--font-color);
  font-size: var(--content-font-size);
  text-shadow: var(--text-glow);
  background: var(--background);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Custom TUI Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--background);
  border-left: 1px solid var(--border-muted);
}
::-webkit-scrollbar-thumb {
  background: var(--border-muted);
  border: 1px solid var(--background);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--input-color);
}

p { margin: 0; padding: 0; }
pre { font-family: var(--terminal-font); font-size: var(--content-font-size); }

a { font-size: var(--content-font-size); color: var(--input-color); text-decoration: none; }
a:hover { color: var(--font-color); text-shadow: 0 0 8px var(--input-color); }

/* --- BOOT SCREEN --- */
#boot-screen {
  position: fixed;
  width: 100vw;
  height: 100vh;
  background: var(--background);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  padding: 20px;
  box-sizing: border-box;
  overflow: hidden;
  align-items: center;
  align-content: center;
}
#boot-terminal {
  font-family: monospace;
  font-size: var(--terminal-font);
  color: var(--font-color);
  text-shadow: var(--text-glow);
  white-space: pre-wrap;
  line-height: 1.4;
}
#vortex-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-family: monospace;
  white-space: pre;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  pointer-events: none; /* Makes the layer clickable-through */
}

/* --- MAIN CONTAINER STRUCTURE (TUI GRID ADAPTION) --- */
.contents {
  display: flex;
  justify-content: center;
  position: relative;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.main {
  position: relative;
  display: grid; /* Grid for side-by-side tables */
  grid-template-columns: repeat(2, 1fr); /* Base: 2-column layout */
  background: var(--black-transparent);
  width: 80vw;
  border: 2px solid var(--border-muted);
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
  padding: 10px;
  box-sizing: border-box;
}

/* All direct children of .main span full width, EXCEPT repo containers */
.main > *:not(.container-repos) {
  grid-column: span 2;
}

.tui-logo {
  min-height: 30px;
  height: 5vw;
  max-height: 50px;
}

/* --- TUI DASHBOARD HEADER & BUTTONS --- */
.header {
  padding: var(--left-right-space);
  font-size: var(--header-font-size);
  max-height: 100px;
  background: var(--background);
  border: 1px solid var(--border-muted);
}
.header-left { min-width: 50%; width: 50%; float: left; text-align: left; }
.header-right { min-width: 50%; width: 50%; float: left; text-align: right; }

.link-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin: var(--left-right-space);
  gap: 8px;
}
.link-buttons a, .link-buttons button {
  display: inline-block;
  font-family: var(--terminal-font);
  font-size: var(--content-font-size);
  color: var(--input-color);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border-muted);
  border-radius: 0; /* Sharp, square TUI edges */
  background: var(--color-even-row);
  text-shadow: var(--text-glow);
  cursor: pointer;
}
.link-buttons a:hover, .link-buttons button:hover {
  background: var(--highlight);
  color: var(--background);
  border-color: var(--input-color);
  text-shadow: none;
}

/* --- NO-JS NOTIFICATION --- */
.container-type-text {
  margin: var(--left-right-space);
  font-size: var(--content-font-size);
  align-content: center;
  text-align: center;
  padding: 6px;
}
.type-text { 
  font-size: var(--content-font-size); 
  display: inline-block; 
  white-space: pre-wrap;
  color: var(--highlight);
  font-weight: bold; 
}

/* --- SEPARATORS & INTERACTIVE TERMINAL BOX --- */
.space {
  border: none;
  border-bottom: 2px dashed var(--border-muted); /* Clean ASCII separator line */
  margin: var(--left-right-space);
  align-items: center;
  text-align: center;
}

.status-bar { 
  border-bottom: 1px solid var(--color-error);
  width: 100%;
  text-align: center;
  align-items: center;
  background: var(--color-error-bg);
  margin-bottom: 15px;
}

/* --- HIGH DENSITY TUI DATA BOXES (2-COLUMNS EFFECT) --- */
.container-repos, .container-software, .container-registry {
  margin: 5px var(--left-right-space);
  border: 1px solid var(--border-muted);
  padding: 12px;
  background: var(--background);
}
.container-repos:hover, .container-software:hover {
  border-color: var(--input-color);
}

.container-header {
  font-size: var(--content-header-font-size);
  color: var(--highlight);
  font-weight: bold;
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: 8px;
}
.subtext { font-size: 11px; color: var(--border-muted); font-weight: normal; }

/* -------------------------------------------------------------------------- */
/* MODERN REPOSITORY CARD SYSTEM & CONTAINERS (UNIFORM STACKED LAYOUT)
/* -------------------------------------------------------------------------- */
.container-repos, .container-registry {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  border-radius: 1rem;
  min-width: 0;
  word-wrap: break-word;
  overflow: hidden;
  box-sizing: border-box;
}

.container-repos:hover {
  border-color: rgba(250, 189, 47, 0.2);
}

.container-header {
  font-size: var(--content-header-font-size);
  color: var(--cyber-yellow);
  font-weight: 800;
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.subtext {
  font-size: var(--content-font-size);
  color: var(--text-muted);
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.repo-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

/* Individual Repository Cards - Stacked by default everywhere */
.repo-card {
  background: rgba(20, 20, 20, 0.4);
  border: 1px solid rgba(124, 111, 100, 0.3);
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  position: relative;
  transition: all 0.2s ease;
  box-sizing: border-box;
  width: 100%;
}

.repo-card:hover {
  background: rgba(40, 40, 40, 0.6);
  border-color: var(--cyber-yellow);
  transform: translateX(4px);
  box-shadow: -4px 0 0 var(--cyber-yellow);
}

/* Floating Rank Index Badge */
.repo-rank {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: var(--content-font-size);
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  min-width: 32px;
  text-align: center;
}

.repo-card:hover .repo-rank {
  color: var(--bg-main);
  background: var(--cyber-yellow);
}

/* Text Container (Full Width) */
.repo-info {
  width: 100%;
  min-width: 0;
}

.repo-name {
  font-size: var(--content-header-font-size);
  font-weight: 700;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.repo-desc {
  font-size: var(--content-font-size);
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Bottom Stats Dashboard Line (Full Width with dashed divider) */
.repo-stats {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  font-size: var(--content-font-size);
  border-top: 1px dashed rgba(124, 111, 100, 0.2);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.stat-item {
  font-weight: bold;
  white-space: nowrap;
}

.stat-item.stars {
  color: var(--cyber-yellow);
}

.stat-item.forks {
  color: var(--neon-cyan);
}

/* Pushes the language badge beautifully to the bottom-right corner */
.stat-lang {
  font-weight: bold;
  color: var(--lang-color, var(--text-main));
  margin-left: auto;
  text-align: right;
}

.error-msg, .empty-msg {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@keyframes blink { 50% { opacity: 0; } }

/* --- MEDIA QUERIES --- */
@media (max-width: 1800px) {
  .main {
    width: 90vw;
  }
}
@media (max-width: 1000px) {
  .main {
    width: 100%;
    border: none;
    grid-template-columns: 1fr; /* Cleanly reverts to single column on mobile */
  }
  .main > *:not(.container-repos) {
    grid-column: span 1;
  }
  .terminal-header, #terminal {
    margin-left: 0;
    margin-right: 0;
  }
}
@media (max-width: 600px) {
  .space .header-left, .space .header-right {
    width: 100%;
    text-align: center;
    align-items: center;
    float: none;
  }
  .main  {
    padding: 0;
  }
}