/* Agentic message styles */
.message.user {
  background: #1a2b1a;
  color: #b8ffb8;
  align-self: flex-end;
  border-radius: 8px 8px 2px 8px;
  margin: 8px 0 8px auto;
  padding: 8px 12px;
  max-width: 70%;
}

.message.apollo {
  background: #222b3a;
  color: #a8c6ff;
  align-self: flex-start;
  border-radius: 8px 8px 8px 2px;
  margin: 8px auto 8px 0;
  padding: 8px 12px;
  max-width: 70%;
}

.message.system {
  background: #222;
  color: #ffb;
  border-radius: 6px;
  margin: 6px 0;
  padding: 6px 10px;
  font-style: italic;
  opacity: 0.8;
}

/* Loading message style */
.message.apollo em {
  color: #7fa7ff;
  font-style: italic;
}
/* This file contains all the CSS styles for the SCP chat interface. */

/* SCP Wiki-inspired color scheme */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');

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

body {
    font-family: 'JetBrains Mono', monospace;
    background: #222; /* SCP Wiki dark gray */
    color: #222;      /* Default text color, overridden in containers */
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.terminal-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: #f5f5f5;
    border: 2px solid #b31b1b;
    box-shadow: 0 0 50px rgba(179, 27, 27, 0.15);
    color: #222;
    min-height: 0; /* Allow flex children to shrink */
}

.header {
    background: #b31b1b;
    padding: 15px 25px;
    border-bottom: 2px solid #b31b1b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #fff;
}

.system-info {
    display: flex;
    gap: 30px;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px rgba(179, 27, 27, 0.7);
    animation: glow 2s ease-in-out infinite alternate;
    letter-spacing: 1px;
}

.status-bar {
    display: flex;
    gap: 20px;
    font-size: 0.8rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b31b1b;
    animation: pulse 2s infinite;
}

.main-interface {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #f5f5f5;
    color: #222;
    min-height: 0; /* Prevent overflow, allow flex children to shrink */
    max-height: 100vh; /* Never exceed viewport */
    box-sizing: border-box;
}

.session-header {
    margin-bottom: 20px;
    padding: 15px;
    background: #eaeaea;
    border: 1px solid #b31b1b;
    border-radius: 5px;
}

.session-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    font-size: 0.85rem;
}

.console {
    flex: 1 1 auto;
    background: #fff;
    border: 1px solid #b31b1b;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: #222;
    min-height: 300px;
    max-height: 100%;
    position: relative;
    height: auto;
}

.console-header {
    background: #b31b1b;
    color: #fff;
    padding: 10px 15px;
    border-bottom: 1px solid #b31b1b;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.messages {
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: 100%;
    min-height: 200px;
    padding: 15px;
    scroll-behavior: smooth;
    font-size: 0.9rem;
    line-height: 1.4;
    background: #fff;
    color: #222;
    box-sizing: border-box;
    overscroll-behavior: contain;
}

.message {
    margin-bottom: 15px;
    animation: fadeIn 0.5s ease-in;
}

.message.system {
    color: #b31b1b;
    border-left: 3px solid #b31b1b;
    padding-left: 10px;
    font-style: italic;
    background: #f5eaea;
}

.message.researcher {
    color: #195fa7;
    margin-left: 20px;
}

.message.apollo {
    color: #222;
    background: #eaeaea;
    padding: 10px;
    border-radius: 3px;
    border-left: 3px solid #b31b1b;
}

.message.apollo::before {
    content: "APOLLO.aic > ";
    color: #b31b1b;
    font-weight: 700;
}

.message.loading {
    color: #b31b1b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.researcher-prompt::before {
    content: "RESEARCHER@SITE-" attr(data-site) " > ";
    color: #195fa7;
    font-weight: 700;
}

.loading-text {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-dots {
    display: flex;
    gap: 3px;
}

.loading-dot {
    width: 4px;
    height: 4px;
    background: #b31b1b;
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

.input-section {
    background: #eaeaea;
    border-top: 1px solid #b31b1b;
    padding: 15px;
    position: static;
    width: 100%;
    z-index: 2;
    box-sizing: border-box;
}

.input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-prompt {
    color: #195fa7;
    font-weight: 700;
    white-space: nowrap;
    font-size: 0.9rem;
}

.command-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #222;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    outline: none;
    padding: 8px;
    border-bottom: 1px solid #b31b1b;
    background: #fff;
}

.command-input::placeholder {
    color: #b31b1b;
    opacity: 0.5;
}

.execute-btn {
    background: #b31b1b;
    border: 1px solid #b31b1b;
    color: #fff;
    padding: 8px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.execute-btn:hover {
    background: #fff;
    color: #b31b1b;
    box-shadow: 0 0 10px rgba(179, 27, 27, 0.2);
}

.execute-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.scp-data-block {
    background: #f5eaea;
    border: 1px solid #b31b1b;
    border-radius: 3px;
    padding: 15px;
    margin: 10px 0;
    font-size: 0.85rem;
    color: #222;
}

.classification-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: 10px;
}

.safe { background: #195fa7; color: #fff; }
.euclid { background: #b3b31b; color: #222; }
.keter { background: #b31b1b; color: #fff; }
.apollyon { background: #222; color: #b31b1b; border: 1px solid #b31b1b; }
.thaumiel { background: #195fa7; color: #fff; }

.clearance-notice {
    background: #f5eaea;
    border: 1px solid #b31b1b;
    padding: 10px;
    margin: 10px 0;
    font-size: 0.8rem;
    color: #b31b1b;
}

.redacted {
    background: #222;
    color: #222;
    padding: 2px 6px;
    margin: 0 2px;
    border-radius: 2px;
    position: relative;
}

.redacted::after {
    content: "█████";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #222;
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timestamp {
    color: #888;
    font-size: 0.7rem;
    margin-left: 10px;
}

/* Animations */
@keyframes glow {
    from { text-shadow: 0 0 10px rgba(179, 27, 27, 0.7); }
    to { text-shadow: 0 0 20px rgba(179, 27, 27, 1), 0 0 30px rgba(179, 27, 27, 0.7); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Scrollbar */
.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: #eaeaea;
}

.messages::-webkit-scrollbar-thumb {
    background: #b31b1b;
    border-radius: 3px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .terminal-container {
        height: 100vh;
        border: none;
        min-height: 0;
    }
    .main-interface {
        padding: 5px;
        min-height: 0;
        max-height: 100vh;
    }
    .console {
        min-height: 150px;
        max-height: 100%;
        height: auto;
    }
    .messages {
        min-height: 100px;
        max-height: 100%;
    }
    .input-section {
        position: static;
        width: 100%;
    }
}