/* ============================================
   CEEFAX / TELETEXT SHARED STYLES
   Classic BBC Teletext Aesthetic
   ============================================ */

/* Proper Teletext Font */
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

* {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

body {
  background: #000;
  font-family: 'VT323', 'Courier New', monospace;
  color: #fff;
  position: relative;
  overflow-x: hidden;
  font-size: 20px; /* Larger base font for better readability */
}

/* Enhanced CRT scanline effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.3),
    rgba(0, 0, 0, 0.3) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 9999;
}

/* CRT curvature and glow effect */
body::after {
  content: '';
  position: fixed;
  top: -5%;
  left: -5%;
  width: 110%;
  height: 110%;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 100, 200, 0.1) 0%,
    rgba(0, 0, 0, 0.5) 100%
  );
  pointer-events: none;
  z-index: 9998;
  border-radius: 10% / 5%;
}

.container {
  max-width: 900px;
}

/* ============================================
   CEEFAX CONTAINER
   ============================================ */

.ceefax-container,
.broadcast-container {
  background: #000;
  border: 4px solid #00ffff;
  padding: 0;
  margin: 20px 0;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

/* ============================================
   CEEFAX TOP BAR
   ============================================ */

.ceefax-topbar {
  background: #000;
  color: #fff;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 4px solid #ffff00;
  font-size: 1rem;
  letter-spacing: 2px;
}

.ceefax-logo {
  color: #ffff00;
  font-weight: 900;
  font-size: 1.7rem;
  text-shadow: 3px 3px 0 #cc0000;
  animation: subtle-flicker 3s infinite;
}

@keyframes subtle-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.95; }
}

.ceefax-page {
  color: #00ffff;
  font-weight: 700;
  font-size: 1.5rem;
  animation: flash 2s infinite;
}

@keyframes flash {
  0%, 49%, 100% { opacity: 1; }
  50%, 99% { opacity: 0.3; }
}

.ceefax-datetime {
  color: #00ff00;
  font-weight: 700;
  font-size: 1.1rem;
}

/* ============================================
   CEEFAX HEADERS
   ============================================ */

.broadcast-header,
.ceefax-header {
  background: #0066cc;
  padding: 15px 20px;
  text-align: center;
  border-bottom: 4px solid #00ffff;
}

.broadcast-title,
.ceefax-title {
  color: #ffff00;
  font-size: 2.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin: 0;
  text-shadow: 2px 2px 0 #000;
}

.broadcast-subtitle {
  color: #fff;
  font-size: 1.2rem;
  margin-top: 5px;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000;
}

/* Section Headers */
.section-header {
  background: #ffff00;
  color: #000;
  padding: 15px;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 2px;
  text-align: center;
  border: 4px solid #000;
  margin: 20px 0 0 0;
}

/* ============================================
   DECORATIVE BORDERS
   ============================================ */

.block-border-top {
  background: #ffff00;
  height: 8px;
  margin: 0;
}

.block-border-bottom {
  background: #00ffff;
  height: 8px;
  margin: 0;
}

/* ============================================
   CEEFAX TABLES
   ============================================ */

.broadcast-table,
.ceefax-table {
  width: 100%;
  border-collapse: collapse;
  background: #000;
  margin: 0;
}

.broadcast-table thead,
.ceefax-table thead {
  background: #ffff00;
  color: #000;
}

.broadcast-table thead th,
.ceefax-table thead th {
  color: #000;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 12px 10px;
  text-align: center;
  border: 2px solid #000;
  letter-spacing: 1px;
}

.broadcast-table thead th.text-start,
.ceefax-table thead th.text-start {
  text-align: left;
  padding-left: 15px;
}

.broadcast-table tbody tr,
.ceefax-table tbody tr {
  border: 2px solid #333;
}

.broadcast-table tbody tr td,
.ceefax-table tbody tr td {
  padding: 14px 10px;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid #000;
  letter-spacing: 1px;
}

/* ============================================
   CEEFAX BOTTOM BAR
   ============================================ */

.ceefax-bottombar {
  background: #cc0000;
  color: #ffff00;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 4px solid #ffff00;
  font-size: 1.1rem;
  letter-spacing: 2px;
  font-weight: 700;
}

.ceefax-nav {
  display: flex;
  gap: 30px;
}

.ceefax-nav span {
  text-shadow: 2px 2px 0 #000;
}

/* ============================================
   BUTTONS
   ============================================ */

.admin-btn,
.back-btn {
  background: #ffff00;
  color: #000 !important;
  border: 4px solid #000;
  padding: 15px 40px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 3px;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
  transition: all 0.3s;
}

.admin-btn:hover,
.back-btn:hover {
  background: #00ffff;
  box-shadow: 0 0 30px rgba(0, 255, 255, 1);
  transform: scale(1.05);
}

/* ============================================
   STATS FOOTER
   ============================================ */

.stats-footer {
  background: #cc0000;
  padding: 20px;
  margin-top: 30px;
  text-align: center;
  border: 4px solid #ffff00;
  box-shadow: 0 0 20px rgba(255, 255, 0, 0.5);
}

.stats-footer p {
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  margin: 8px 0;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000;
}

/* ============================================
   CONTROLS SECTION
   ============================================ */

.sort-controls {
  background: #0066cc;
  padding: 20px;
  margin-bottom: 20px;
  border: 4px solid #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.sort-controls label {
  color: #ffff00;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000;
}

.sort-controls select {
  background: #000;
  color: #00ff00;
  border: 3px solid #00ff00;
  font-weight: 700;
  font-family: 'VT323', monospace;
  padding: 8px;
  letter-spacing: 1px;
}

.sort-controls select:focus {
  border-color: #ffff00;
  outline: none;
  box-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Container adjustments for mobile */
.container {
  padding-left: 10px;
  padding-right: 10px;
}

/* Table wrapper for horizontal scroll */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .container {
    margin-top: 1rem !important;
  }

  .ceefax-container,
  .broadcast-container {
    margin: 10px 0;
    border-width: 3px;
  }

  .ceefax-topbar {
    font-size: 0.9rem;
    padding: 8px 10px;
    flex-wrap: wrap;
  }

  .ceefax-logo {
    font-size: 1.1rem;
  }

  .ceefax-page {
    font-size: 1rem;
  }

  .ceefax-datetime {
    font-size: 0.8rem;
    flex-basis: 100%;
    text-align: center;
    margin-top: 5px;
  }

  .ceefax-bottombar {
    font-size: 0.75rem;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 10px;
  }

  .ceefax-nav {
    flex-direction: column;
    gap: 5px;
  }

  .broadcast-title,
  .ceefax-title {
    font-size: 1.4rem;
    letter-spacing: 1px;
  }

  .broadcast-subtitle {
    font-size: 1rem;
  }

  .broadcast-header,
  .ceefax-header {
    padding: 10px;
  }

  .broadcast-table tbody tr td,
  .ceefax-table tbody tr td {
    font-size: 0.95rem;
    padding: 8px 5px;
  }

  .broadcast-table thead th,
  .ceefax-table thead th {
    font-size: 0.9rem;
    padding: 10px 6px;
  }

  .section-header {
    font-size: 1.3rem;
    padding: 10px;
  }

  .sort-controls {
    padding: 15px;
    margin-bottom: 15px;
  }

  .sort-controls label {
    font-size: 1rem;
  }

  .stats-footer {
    padding: 15px;
    margin-top: 20px;
  }

  .stats-footer p {
    font-size: 1rem;
    margin: 5px 0;
  }

  .admin-btn,
  .back-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
    letter-spacing: 2px;
  }

  .block-border-top,
  .block-border-bottom {
    height: 4px;
  }
}
