/* --------------------------
GLOBAL RESETS & BASE STYLES
-------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Google Fonts Fallback - Ensures Render.com compatibility */
@font-face {
  font-family: 'VT323';
  src: url('https://fonts.gstatic.com/s/vt323/v17/pxiKyp0ihIEF2isfFJU.woff2') format('woff2');
  font-display: swap;
}

body {
  font-family: 'VT323', 'Courier New', monospace;
  background-color: #000000;
  color: #00FF00;
  padding: 2rem 1rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  line-height: 1.4;
  min-height: 100vh;
  /* CRT Scanline Effect - Visible on all renderers */
  background-image: linear-gradient(transparent 50%, rgba(0, 255, 0, 0.1) 50%);
  background-size: 100% 4px;
  background-attachment: fixed;
  animation: crt-flicker 0.15s infinite alternate;
  /* Prevent rendering glitches */
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------
MAIN TERMINAL CONTAINER
-------------------------- */
.terminal-container {
  width: 100%;
  max-width: 700px;
  border: 3px solid #00FF00;
  background-color: #000000;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.4);
  position: relative;
  z-index: 1;
  animation: terminal-boot 1.2s ease-out forwards;
}

/* --------------------------
HEADER & FOOTER
-------------------------- */
.terminal-header,
.terminal-footer {
  padding: 0.8rem 1rem;
  background-color: #000000;
  border-bottom: 2px solid #00FF00;
  font-size: 1.3rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-footer {
  border-top: 2px solid #00FF00;
  border-bottom: none;
  font-size: 1rem;
}

/* Blinking Cursors */
.header-blink,
.blink-cursor {
  animation: blink 1s infinite alternate;
  transform: translateZ(0); /* Hardware acceleration */
}

/* --------------------------
STATUS PANEL
-------------------------- */
.status-panel {
  padding: 1.5rem 1rem;
  border-bottom: 1px dashed #00AA00;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  font-size: 1.2rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.label {
  color: #00AA00;
  text-transform: uppercase;
  min-width: 120px;
}

.value {
  margin-right: auto;
  word-break: break-all;
}

.status-indicator {
  font-weight: bold;
  text-shadow: 0 0 2px #00FF00;
}

/* Status Dot */
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #FF0000;
  margin-left: 1rem;
  animation: red-blink 1s infinite alternate;
  opacity: 1;
}

.dot.online {
  background-color: #00FF00;
  animation: green-pulse 0.8s infinite alternate;
}

/* Copy Button */
.copy-btn {
  background-color: #000000;
  border: 1px solid #00FF00;
  color: #00FF00;
  padding: 0.2rem 0.6rem;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}

.copy-btn:hover {
  background-color: #00FF00;
  color: #000000;
  box-shadow: 0 0 8px #00FF00;
}

.copy-btn.copied {
  background-color: #00FF00;
  color: #000000;
  animation: copy-flash 0.5s ease-out;
}

/* --------------------------
MOTD PANEL
-------------------------- */
.motd-panel {
  padding: 1.5rem 1rem;
  border-bottom: 1px dashed #00AA00;
}

.panel-title {
  display: block;
  color: #00AA00;
  text-transform: uppercase;
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
}

#server-motd {
  font-size: 1.1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.3;
  /* Ensure text doesn't clip */
  max-height: 150px;
  overflow-y: auto;
}

/* --------------------------
CONSOLE LOG
-------------------------- */
.console-log {
  padding: 1.5rem 1rem;
}

#log-output {
  font-size: 1rem;
  line-height: 1.3;
  max-height: 200px;
  overflow-y: auto;
  /* Scrollbar styling for visibility */
  scrollbar-width: thin;
  scrollbar-color: #00AA00 #000000;
}

#log-output::-webkit-scrollbar {
  width: 8px;
}

#log-output::-webkit-scrollbar-track {
  background: #000000;
  border: 1px solid #00AA00;
}

#log-output::-webkit-scrollbar-thumb {
  background: #00AA00;
}

.log-line {
  display: block;
  margin-bottom: 0.3rem;
}

/* --------------------------
ANIMATIONS
-------------------------- */
@keyframes crt-flicker {
  from { opacity: 0.97; }
  to { opacity: 1; }
}

@keyframes terminal-boot {
  0% { opacity: 0; transform: scale(0.95); box-shadow: none; }
  50% { opacity: 0.5; box-shadow: 0 0 10px rgba(0, 255, 0, 0.2); }
  100% { opacity: 1; transform: scale(1); box-shadow: 0 0 20px rgba(0, 255, 0, 0.4); }
}

@keyframes blink {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes red-blink {
  0% { background-color: #CC0000; box-shadow: 0 0 3px #CC0000; }
  100% { background-color: #FF0000; box-shadow: 0 0 6px #FF0000; }
}

@keyframes green-pulse {
  0% { background-color: #00AA00; box-shadow: 0 0 3px #00AA00; }
  100% { background-color: #00FF00; box-shadow: 0 0 8px #00FF00; }
}

@keyframes copy-flash {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); box-shadow: 0 0 10px #00FF00; }
  100% { transform: scale(1); }
}

/* --------------------------
MOBILE RESPONSIVENESS
-------------------------- */
@media (max-width: 500px) {
  .terminal-header,
  .terminal-footer {
    font-size: 1.1rem;
    white-space: normal;
    text-align: center;
  }

  .label {
    min-width: 100%;
  }

  .value {
    width: 100%;
  }

  .copy-btn {
    width: 100%;
  }

  .dot {
    margin-left: 0;
    position: absolute;
    right: 1rem;
  }

  .status-row {
    position: relative;
    padding-right: 2rem;
  }
}

/* --------------------------
RENDER.COM SPECIFIC FIXES
-------------------------- */
/* Prevent CDN caching issues */
.terminal-container * {
  backface-visibility: hidden;
}

/* Ensure border rendering */
.terminal-container,
.status-panel,
.motd-panel,
.console-log {
  border-collapse: separate;
}

/* Fix text rendering on Render's servers */
body,
.terminal-header,
.terminal-footer,
.status-row,
.panel-title,
#server-motd,
.log-line {
  text-rendering: optimizeSpeed;
}
    border-bottom: 2px solid #00FF00;
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.terminal-footer {
    border-top: 2px solid #00FF00;
    border-bottom: none;
    font-size: 1rem;
}

/* Blinking Elements */
.header-blink, .blink-cursor {
    animation: blink 1s infinite alternate;
}

/* Status Panel */
.status-panel {
    padding: 1.5rem 1rem;
    border-bottom: 1px dashed #00AA00;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 1.2rem;
}

.label {
    color: #00AA00;
    text-transform: uppercase;
}

.value {
    margin-right: auto;
    margin-left: 1rem;
}

.status-indicator {
    font-weight: bold;
}

/* Status Dot */
.dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #FF0000;
    margin-left: 1rem;
    animation: red-blink 1s infinite alternate;
}

.dot.online {
    background-color: #00FF00;
    animation: green-pulse 0.8s infinite alternate;
}

/* Copy Button */
.copy-btn {
    background-color: #000;
    border: 1px solid #00FF00;
    color: #00FF00;
    padding: 0.2rem 0.6rem;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background-color: #00FF00;
    color: #000;
    box-shadow: 0 0 8px #00FF00;
}

.copy-btn.copied {
    background-color: #00FF00;
    color: #000;
    animation: copy-flash 0.5s ease-out;
}

/* MOTD Panel */
.motd-panel {
    padding: 1.5rem 1rem;
    border-bottom: 1px dashed #00AA00;
}

.panel-title {
    display: block;
    color: #00AA00;
    text-transform: uppercase;
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
}

#server-motd {
    font-size: 1.1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.3;
}

/* Console Log */
.console-log {
    padding: 1.5rem 1rem;
}

#log-output {
    font-size: 1rem;
    line-height: 1.3;
}

.log-line {
    display: block;
    margin-bottom: 0.3rem;
}

/* Animations */
@keyframes crt-flicker {
    from { opacity: 0.97; }
    to { opacity: 1; }
}

@keyframes terminal-boot {
    0% { opacity: 0; transform: scale(0.95); box-shadow: none; }
    50% { opacity: 0.5; box-shadow: 0 0 10px rgba(0, 255, 0, 0.2); }
    100% { opacity: 1; transform: scale(1); box-shadow: 0 0 20px rgba(0, 255, 0, 0.4); }
}

@keyframes blink {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes red-blink {
    0% { background-color: #CC0000; box-shadow: 0 0 3px #CC0000; }
    100% { background-color: #FF0000; box-shadow: 0 0 6px #FF0000; }
}

@keyframes green-pulse {
    0% { background-color: #00AA00; box-shadow: 0 0 3px #00AA00; }
    100% { background-color: #00FF00; box-shadow: 0 0 8px #00FF00; }
}

@keyframes copy-flash {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 0 10px #00FF00; }
    100% { transform: scale(1); }
}

/* Mobile Responsive */
@media (max-width: 500px) {
    .status-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .value {
        margin-left: 0;
        width: 100%;
    }

    .copy-btn {
        width: 100%;
    }
}
