/* --- Optimized Hacker Style --- */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  /* Color Palette */
  --bg-main: #000000;
  --bg-card: #0a0a0a;
  --bg-input: #111111;
  --bg-hover: #1a1a1a;
  
  --text-primary: #00FF00;
  --text-secondary: #00cc00;
  --text-danger: #FF3333;
  --text-on-primary: #000000;

  --border-color: #00FF00;
  --focus-ring: rgba(0, 255, 0, 0.25);

  /* Effects */
  --shadow-glow: 0 0 10px rgba(0, 255, 0, 0.5), 0 0 20px rgba(0, 255, 0, 0.3);
  --shadow-card: 0 8px 24px rgba(0, 255, 0, 0.1);
  --text-glow: 0 0 8px rgba(0, 255, 0, 0.7);
}

/* --- Base & Typography --- */
html {
  background-color: var(--bg-main);
  font-size: 16px;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, var(--bg-main) 0%, #050505 100%);
  color: var(--text-primary);
  font-family: 'MuzaiPixel', 'Press Start 2P', 'Courier New', Courier, monospace;
  text-shadow: var(--text-glow);
  min-height: 100vh;
}

h1, h2 {
  font-weight: 400;
  letter-spacing: -1px;
}

h1 { 
  font-size: 2.2em; 
  margin-bottom: 0.5em; 
  text-align: center;
  text-shadow: var(--shadow-glow);
}

h2 { 
  font-size: 1.4em; 
  margin-top: 2.5em; 
  margin-bottom: 1.5em; 
  color: var(--text-secondary); 
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

a:hover {
  color: #33ff33;
  text-shadow: var(--shadow-glow);
  text-decoration: underline;
}

code {
  background-color: var(--bg-input);
  padding: 4px 8px;
  font-size: 0.9em;
  border: 1px solid var(--border-color);
  text-shadow: none;
}

/* --- Layout --- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2.5em;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-with-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr auto;
  gap: 1.2em;
  align-items: end;
}

/* --- Components --- */
.message {
  padding: 1.2em 1.5em;
  margin-bottom: 1.5em;
  font-size: 0.9em;
  border: 1px solid;
}

.message-error { 
  background-color: rgba(255, 51, 51, 0.1); 
  color: var(--text-danger); 
  border-color: rgba(255, 51, 51, 0.3);
}

.message-success { 
  background-color: rgba(0, 255, 0, 0.1); 
  color: var(--text-primary); 
  border-color: rgba(0, 255, 0, 0.3);
}

input, select, button {
  padding: 14px 18px;
  border: 1px solid var(--border-color);
  font-size: 0.9em;
  background-color: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  transition: all 0.3s ease;
  border-radius: 0;
  -webkit-appearance: none;
}

input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
  background-color: var(--bg-card);
}

button {
  cursor: pointer;
  color: var(--text-on-primary);
  border: none;
  text-shadow: none;
}

.btn-primary {
  background-color: var(--text-primary);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
}

.btn-primary:hover {
  background-color: #33ff33;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--text-primary);
}

.btn-secondary:hover {
  background-color: rgba(0, 255, 0, 0.1);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.btn-danger {
  background-color: var(--text-danger);
  padding: 10px 16px;
  font-size: 0.9em;
  box-shadow: 0 2px 8px rgba(255, 51, 51, 0.3);
}

.btn-danger:hover {
  background-color: #cc0000;
  transform: translateY(-1px);
}

/* --- Table --- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0, 255, 0, 0.1);
}

th, td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

th {
  background-color: var(--bg-input);
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 0.8em;
  text-transform: uppercase;
}

tbody tr:hover {
  background-color: var(--bg-hover);
}

tr:last-child td { 
  border-bottom: none; 
}

/* --- Views & Modals --- */
#admin-view { 
  display: none; 
}

.hidden { 
  display: none; 
}

#login-view { 
  text-align: center; 
}

#admin-secret {
  width: calc(100% - 36px);
  margin-bottom: 1.5em;
  text-align: center;
}

.footer-link {
  text-align: center;
  margin-top: 3em;
  font-size: 0.9em;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: var(--bg-card);
  margin: 15% auto;
  padding: 2.5em;
  border: 1px solid var(--border-color);
  width: 80%;
  max-width: 500px;
  box-shadow: var(--shadow-glow);
}

.close {
  color: var(--text-secondary);
  float: right;
  font-size: 28px;
  font-weight: bold;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.close:hover,
.close:focus {
  color: var(--text-primary);
  text-shadow: var(--shadow-glow);
  text-decoration: none;
  cursor: pointer;
}

/* --- Typewriter Effect --- */
.typing {
  border-right: .12em solid var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
  vertical-align: bottom;
  animation: blink-caret .75s step-end infinite;
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: var(--text-primary); }
}

/* --- CRT Scanline & Flicker Effect --- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.2),
    rgba(0, 0, 0, 0.2) 1px,
    transparent 1px,
    transparent 4px
  );
  z-index: 9999;
  opacity: 0.6;
  animation: scanline 10s linear infinite;
}

@keyframes scanline {
  from { background-position: 0 0; }
  to { background-position: 0 -100vh; }
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(0,255,0,0.15) 0%, rgba(0,0,0,0) 80%);
  animation: flicker 0.1s linear infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.7; }
}

/* --- Layout Enhancements --- */
.container {
  max-width: 1400px; /* Wider container for more info */
}

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr; /* Give more space to the line chart */
  gap: 2rem;
  margin-top: 2rem;
}

.chart-container {
  height: 400px; /* Ensure consistent height */
}