/* Chat — style.css */

/* Reset minimal */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; line-height: 1.5; color: #1a1a1a; background: #f5f5f5; }
img, video { max-width: 100%; height: auto; display: block; }

/* Skip link */
.skip-link { position: absolute; top: -100%; left: 1rem; padding: 0.5rem 1rem; background: #0066cc; color: white; z-index: 100; text-decoration: none; border-radius: 0 0 4px 4px; }
.skip-link:focus { top: 0; }

/* Layout */
.container { width: min(100%, 720px); margin: 0 auto; padding: 1rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; background: white; border-bottom: 1px solid #e0e0e0; position: sticky; top: 0; z-index: 10; }
.topbar h1 { margin: 0; font-size: 1.25rem; font-weight: 600; color: #1a1a1a; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.user-badge { font-size: 0.875rem; color: #666; background: #f0f0f0; padding: 0.25rem 0.5rem; border-radius: 999px; }

/* Buttons */
button, .btn { font: inherit; cursor: pointer; border: none; border-radius: 6px; padding: 0.5rem 1rem; transition: background 0.15s, color 0.15s; }
.btn-ghost { background: transparent; color: #0066cc; }
.btn-ghost:hover { background: #e8f0fe; }
button[type="submit"] { background: #0066cc; color: white; font-weight: 500; }
button[type="submit"]:hover { background: #0052a3; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

/* Auth page */
.auth { min-height: calc(100vh - 60px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth h1 { margin-bottom: 1.5rem; }
.auth form { width: 100%; max-width: 360px; background: white; padding: 2rem; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06); }
.auth label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: #333; }
.auth input[type="text"] { width: 100%; padding: 0.75rem; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; margin-bottom: 1rem; }
.auth input[type="text"]:focus { outline: none; border-color: #0066cc; box-shadow: 0 0 0 3px rgba(0,102,204,0.15); }
.auth button { width: 100%; }
.error { color: #c00; margin-bottom: 1rem; font-size: 0.875rem; }

/* Chat layout */
.chat-layout { display: flex; flex-direction: column; height: calc(100vh - 60px); }
.messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.empty-state { align-self: center; color: #999; margin-top: 2rem; }

/* Messages */
.message { max-width: 85%; padding: 0.75rem 1rem; border-radius: 12px; background: white; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.message.own { align-self: flex-end; background: #0066cc; color: white; border-bottom-right-radius: 4px; }
.message.own .msg-header strong { color: rgba(255,255,255,0.9); }
.message.own .msg-header time { color: rgba(255,255,255,0.7); }
.msg-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.25rem; font-size: 0.75rem; }
.msg-header strong { font-weight: 600; color: #333; }
.msg-header time { color: #999; }
.msg-content { margin: 0; word-wrap: break-word; white-space: pre-wrap; }
.system-message { align-self: center; font-size: 0.75rem; color: #999; padding: 0.25rem 0.75rem; background: #f0f0f0; border-radius: 999px; }

/* Composer */
.composer { display: flex; gap: 0.5rem; padding: 1rem; background: white; border-top: 1px solid #e0e0e0; }
.composer input { flex: 1; padding: 0.75rem 1rem; border: 1px solid #ddd; border-radius: 999px; font-size: 1rem; }
.composer input:focus { outline: none; border-color: #0066cc; box-shadow: 0 0 0 3px rgba(0,102,204,0.15); }
.composer button { border-radius: 999px; padding: 0.75rem 1.5rem; white-space: nowrap; }

/* Focus visible */
:focus-visible { outline: 2px solid #0066cc; outline-offset: 2px; }

/* Selection */
::selection { background: #0066cc; color: white; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: #ccc transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* Mobile */
@media (max-width: 480px) {
    .topbar { padding: 0.5rem; }
    .topbar h1 { font-size: 1rem; }
    .message { max-width: 95%; }
    .composer { padding: 0.75rem; }
    .composer button { padding: 0.75rem 1rem; font-size: 0.875rem; }
}