/* Global styles and CSS variables */
:root {
  --color-bg-dark: #0a0a0c;
  --color-bg-panel: #121216;
  --color-border: #22222a;
  
  --color-green: #00ff66;
  --color-green-glow: rgba(0, 255, 102, 0.25);
  
  --color-amber: #ff9900;
  --color-amber-glow: rgba(255, 153, 0, 0.25);

  --color-cyan: #00e5ff;
  --color-cyan-glow: rgba(0, 229, 255, 0.25);

  --color-crt-glass: rgba(18, 18, 22, 0.95);
  --font-terminal: 'Share Tech Mono', 'Courier New', Courier, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-bg-dark);
  color: var(--color-green);
  font-family: var(--font-terminal);
  overflow-x: hidden;
  height: 100vh;
  position: relative;
  letter-spacing: 0.5px;
}

/* CRT Screen Scanline Overlay Effect */
.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 4px;
  z-index: 10000;
  pointer-events: none;
  opacity: 0.8;
}

.crt-overlay::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: radial-gradient(circle, transparent 60%, rgba(0,0,0,0.6) 100%);
  z-index: 10001;
  pointer-events: none;
}

/* Scanline moving animation */
@keyframes scanline-anim {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

.crt-overlay::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100px;
  background: linear-gradient(to bottom, transparent, rgba(0, 255, 102, 0.05), transparent);
  animation: scanline-anim 8s linear infinite;
  z-index: 10002;
  pointer-events: none;
}

/* Main Control Room Layout */
.control-room {
  display: grid;
  grid-template-rows: auto 1fr 140px;
  height: 100vh;
  padding: 10px;
  gap: 10px;
}

/* Header styling */
.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--color-bg-panel);
  border: 1px solid var(--color-border);
  padding: 10px 20px;
  border-radius: 4px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.header-logo {
  font-size: 24px;
  font-weight: bold;
  text-shadow: 0 0 8px var(--color-green-glow);
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.status-indicator.online {
  background-color: var(--color-green);
  color: var(--color-green);
}

.header-meta {
  font-size: 14px;
}

.label {
  color: #777;
}

/* Monitor Wall Grid */
.monitor-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 15px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Individual CRT Monitor styling */
.crt-monitor {
  position: relative;
  background-color: #0c0c0e;
  border: 10px solid #282830;
  border-radius: 20px;
  box-shadow: 
    0 10px 25px rgba(0, 0, 0, 0.9), 
    inset 0 0 30px rgba(0, 0, 0, 0.95);
  cursor: pointer;
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.crt-monitor:hover {
  transform: scale(1.02);
  border-color: #383842;
}

/* Glass screen curvature overlay */
.crt-monitor::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(
    circle at 50% 15%,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(0, 0, 0, 0.4) 100%
  );
  z-index: 5;
  pointer-events: none;
}

/* Screen glow classes */
.crt-monitor.glow-green {
  box-shadow: 0 0 15px rgba(0, 255, 102, 0.15), inset 0 0 15px rgba(0, 255, 102, 0.1);
}
.crt-monitor.glow-amber {
  box-shadow: 0 0 15px rgba(255, 153, 0, 0.15), inset 0 0 15px rgba(255, 153, 0, 0.1);
  color: var(--color-amber);
  border-color: #3a2e1f;
}
.crt-monitor.glow-amber:hover {
  border-color: #4d3d2a;
}
.crt-monitor.glow-cyan {
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.15), inset 0 0 15px rgba(0, 229, 255, 0.1);
  color: var(--color-cyan);
  border-color: #1f363a;
}
.crt-monitor.glow-cyan:hover {
  border-color: #2a474d;
}

/* Monitor Header */
.monitor-header {
  padding: 8px 12px;
  background-color: rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: bold;
}

.bot-designation {
  text-shadow: 0 0 4px currentColor;
}

.bot-status {
  padding: 2px 6px;
  border-radius: 2px;
  background-color: rgba(0, 0, 0, 0.6);
  font-size: 10px;
}

.status-online { color: var(--color-green); }
.status-offline { color: #555; }

/* Monitor Screen Content */
.monitor-screen {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  overflow: hidden;
  position: relative;
}

.bot-title {
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 0 6px currentColor;
  margin-bottom: 2px;
}

.bot-vibe {
  color: #777;
  font-style: italic;
  font-size: 11px;
  line-height: 1.3;
}

/* Latest Post Panel inside monitor */
.latest-post-panel {
  flex: 1;
  background-color: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.05);
  padding: 8px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.post-header {
  font-size: 10px;
  color: #555;
  margin-bottom: 4px;
}

.post-body {
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.post-footer {
  font-size: 9px;
  text-align: right;
  color: #444;
  margin-top: 4px;
}

/* Color preview card inside the HTML color screen */
.color-preview-block {
  flex: 1;
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.color-preview-overlay {
  background-color: rgba(0, 0, 0, 0.7);
  padding: 4px 8px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: bold;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Handheld Console styling (Default Hidden) */
.handheld-console {
  display: none;
}

/* Console Logger style */
.console-logger {
  background-color: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.95);
}

.console-title {
  font-size: 11px;
  font-weight: bold;
  color: #444;
  border-bottom: 1px solid #1c1c22;
  padding-bottom: 3px;
}

.console-output {
  flex: 1;
  font-size: 12px;
  overflow-y: auto;
  line-height: 1.5;
  color: #00aa44;
}

/* Dialogue styling */
dialog {
  background-color: var(--color-bg-panel);
  color: var(--color-green);
  border: 2px solid var(--color-border);
  border-radius: 8px;
  width: 90%;
  max-width: 650px;
  height: 85vh;
  margin: auto;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.95);
  font-family: var(--font-terminal);
  outline: none;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.dialog-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--color-border);
}

.dialog-header h2 {
  font-size: 18px;
  text-shadow: 0 0 6px currentColor;
}

.close-btn {
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
}

.dialog-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bot-meta-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: rgba(0, 0, 0, 0.3);
  padding: 12px 15px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

.meta-row {
  display: flex;
  font-size: 13px;
}

.meta-label {
  width: 120px;
  color: #777;
}

.meta-val {
  flex: 1;
}

/* Tab Bar */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--color-border);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: #555;
  font-family: var(--font-terminal);
  font-size: 14px;
  padding: 10px;
  cursor: pointer;
  transition: color 0.2s, border-bottom 0.2s;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: #aaa;
}

.tab-btn.active {
  color: inherit;
  border-bottom: 2px solid currentColor;
  text-shadow: 0 0 6px currentColor;
}

.tab-content {
  display: none;
  flex: 1;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Feed List styling */
.feed-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 40vh;
  padding-right: 5px;
}

.feed-item {
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--color-border);
  padding: 12px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-item-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #555;
}

.feed-item-text {
  font-size: 13px;
  line-height: 1.5;
}

.feed-item-color-preview {
  height: 35px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 5px;
}

.bsky-link {
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Radar Calendar View styling */
.calendar-grid-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-header button {
  background: none;
  border: 1px solid var(--color-border);
  color: inherit;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--font-terminal);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: #444;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 5px;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.02);
  border-radius: 3px;
  font-size: 11px;
  color: #555;
  padding: 4px;
  position: relative;
}

.calendar-day.current-month {
  color: #aaa;
}

.calendar-day.has-posts {
  border-color: currentColor;
  box-shadow: inset 0 0 5px currentColor;
  cursor: pointer;
}

.calendar-day-num {
  font-weight: bold;
}

.calendar-dots {
  display: flex;
  gap: 2px;
  height: 5px;
  margin-bottom: 2px;
}

.dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Responsive Handheld view for Mobile */
@media (max-width: 600px) {
  .control-room {
    grid-template-rows: auto 1fr 100px;
    padding: 5px;
    gap: 5px;
  }

  .monitor-wall {
    display: none;
  }

  .handheld-console {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
  }

  .handheld-viewscreen {
    flex: 1;
    background-color: #000;
    border: 6px solid #202025;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.95);
  }

  .handheld-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 5px 0;
  }

  .handheld-btn {
    background-color: #22222a;
    border: 2px solid #33333f;
    color: #888;
    border-radius: 6px;
    padding: 8px 4px;
    font-family: var(--font-terminal);
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 3px 0 #111;
    transition: transform 0.1s, box-shadow 0.1s;
    text-align: center;
  }

  .handheld-btn:active {
    transform: translateY(3px);
    box-shadow: 0 0 0 #111;
  }

  .handheld-btn.active {
    color: inherit;
    border-color: currentColor;
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 3px 0 currentColor;
  }

  .console-logger {
    display: none; /* Hide log terminal on mobile to save viewport space */
  }

  dialog {
    width: 95%;
    height: 90vh;
  }

  .bot-meta-panel {
    padding: 8px 10px;
  }

  .meta-label {
    width: 90px;
  }
}
