/* =========================================================
   Marspedia — page-specific styles
   ========================================================= */

/* Page scrolling */
body[data-page-id="marspedia"] {
    overflow: hidden; /* single-page fit */
}

/* Mars surface canvas — full-screen background */
#mars-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.marspedia-header {
    position: relative;
    z-index: var(--z-ui);
    border-bottom: 1px solid rgba(255, 100, 50, 0.2);
}

/* Main — fills remaining viewport exactly */
.marspedia-main {
    position: relative;
    z-index: var(--z-ui);
    display: flex;
    flex-direction: column;
    align-items: center;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    padding: 16px 16px 12px;
    box-sizing: border-box;
    width: 100%;
}

/* Chat container — fills all available space */
.marspedia-chat-container {
    width: 100%;
    max-width: 780px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: rgba(18, 5, 2, 0.78);
    border: 1px solid rgba(255, 100, 50, 0.28);
    border-radius: 10px;
    overflow: hidden;
    backdrop-filter: blur(18px);
    box-shadow: 0 0 50px rgba(200, 60, 20, 0.18), inset 0 1px 0 rgba(255,120,60,0.07);
}

/* Chat log — scrollable, takes remaining height */
.marspedia-chat-log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 20px 12px;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

.marspedia-chat-log::-webkit-scrollbar { width: 3px; }
.marspedia-chat-log::-webkit-scrollbar-track { background: transparent; }
.marspedia-chat-log::-webkit-scrollbar-thumb { background: rgba(255,100,50,0.3); border-radius: 2px; }

/* Messages */
.marspedia-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 100, 50, 0.07);
    flex-shrink: 0;
}

.marspedia-msg:last-child { border-bottom: none; }

.marspedia-msg-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 2px;
    opacity: 0.45;
}

.marspedia-msg--ai .marspedia-msg-label  { color: #ff7040; }
.marspedia-msg--user .marspedia-msg-label { color: rgba(255, 200, 170, 0.7); }

.marspedia-msg p {
    margin: 0;
    font-size: clamp(0.8rem, 1.4vw, 0.92rem);
    line-height: 1.62;
    color: rgba(255, 228, 210, 0.92);
}

.marspedia-msg--user p {
    color: rgba(255, 200, 170, 0.62);
    font-style: italic;
}

/* Thinking indicator */
.marspedia-thinking p::after {
    content: '...';
    animation: marspedia-dots 1.2s steps(3, end) infinite;
    display: inline-block;
    width: 1.5em;
    overflow: hidden;
    vertical-align: bottom;
}

@keyframes marspedia-dots {
    0%   { width: 0; }
    33%  { width: 0.5em; }
    66%  { width: 1em; }
    100% { width: 1.5em; }
}

/* Input row */
.marspedia-input-row {
    display: flex;
    align-items: center;
    border-top: 1px solid rgba(255, 100, 50, 0.2);
    background: rgba(12, 4, 2, 0.55);
    flex-shrink: 0;
}

.marspedia-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    padding: 13px 16px;
    font-size: 0.88rem;
    color: rgba(255, 228, 210, 0.92);
    font-family: inherit;
    letter-spacing: 0.4px;
}

.marspedia-input::placeholder { color: rgba(255, 180, 140, 0.28); }

.marspedia-send-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 16px;
    color: #ff6535;
    opacity: 0.65;
    transition: opacity 0.2s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.marspedia-send-btn:hover  { opacity: 1; transform: translateX(2px); }
.marspedia-send-btn:disabled { opacity: 0.2; cursor: not-allowed; transform: none; }

.marspedia-clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 10px 12px 14px;
    color: #ff6535;
    opacity: 0.3;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.marspedia-clear-btn:hover { opacity: 0.7; }

/* Disclaimer */
.marspedia-disclaimer {
    text-align: center;
    font-size: 0.6rem;
    color: rgba(255, 180, 140, 0.2);
    letter-spacing: 0.4px;
    padding: 5px 16px 7px;
    margin: 0;
    background: rgba(8, 2, 1, 0.3);
    border-top: 1px solid rgba(255, 100, 50, 0.05);
    flex-shrink: 0;
}

/* Mobile */
@media (max-width: 600px) {
    .marspedia-main { padding: 10px 10px 8px; }
    .marspedia-chat-log { padding: 12px 14px 8px; }
    .marspedia-input { padding: 12px 12px; font-size: 0.84rem; }
}
