/* agenticaisystems.education — dark educational theme */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:         #0d1117;
    --bg2:        #161b22;
    --bg3:        #21262d;
    --border:     #30363d;
    --text:       #e6edf3;
    --text-muted: #7d8590;
    --accent:     #3b82f6;
    --accent-h:   #2563eb;
    --green:      #3fb950;
    --purple:     #8957e5;
    --warning:    #d29922;
    --radius:     8px;
    --font:       'Georgia', 'Times New Roman', serif;
    --mono:       'Courier New', monospace;
}

html { font-size: 16px; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.7; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Auth ───────────────────────────────────────────────────────────────────── */
.auth-page { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-container { width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.logo-icon { font-size: 3rem; color: var(--accent); line-height: 1; }
.auth-logo h1 { font-size: 1.4rem; margin: 0.5rem 0 0.25rem; }
.tagline { color: var(--text-muted); font-size: 0.9rem; }

.auth-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; }
.auth-card h2 { margin-bottom: 0.75rem; font-size: 1.2rem; }
.auth-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.25rem; }

.input-field { display: block; width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
    color: var(--text); padding: 0.6rem 0.9rem; font-size: 1rem; margin-bottom: 0.75rem; outline: none; font-family: var(--mono); }
.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: var(--text-muted); }

.btn-primary { display: block; width: 100%; padding: 0.65rem; background: var(--accent); color: #fff;
    border: none; border-radius: 6px; font-size: 1rem; cursor: pointer; font-family: var(--font); }
.btn-primary:hover { background: var(--accent-h); }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    padding: 0.35rem 0.9rem; border-radius: 6px; cursor: pointer; font-family: var(--font); font-size: 0.9rem; }
.btn-ghost:hover { border-color: var(--text-muted); }

.error-msg { background: rgba(248,81,73,0.1); border: 1px solid rgba(248,81,73,0.4); border-radius: 6px;
    padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.9rem; color: #f85149; }
.auth-switch { margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); text-align: center; }
.footer-note { text-align: center; margin-top: 2rem; font-size: 0.8rem; color: var(--text-muted); font-style: italic; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header, .chat-header { background: var(--bg2); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1100px; margin: 0 auto; padding: 0.75rem 1.5rem;
    display: flex; align-items: center; gap: 1rem; justify-content: space-between; }
.site-logo { font-weight: bold; font-size: 1.1rem; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.user-name { color: var(--text-muted); font-size: 0.9rem; }

/* ── Dashboard ──────────────────────────────────────────────────────────────── */
.dashboard-page { min-height: 100vh; }
.dashboard-main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.dashboard-hero { text-align: center; margin-bottom: 2.5rem; }
.dashboard-hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.dashboard-hero p { color: var(--text-muted); max-width: 600px; margin: 0 auto; }

.tutors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.tutor-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem; display: flex; gap: 1.25rem; transition: border-color 0.2s; text-decoration: none; color: var(--text); }
.tutor-card:hover { border-color: var(--accent); text-decoration: none; }
.tutor-avatar { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: bold; flex-shrink: 0; }
.tutor-info { flex: 1; min-width: 0; }
.tutor-info h3 { font-size: 1.1rem; margin-bottom: 0.2rem; }
.tutor-subject { display: block; font-size: 0.8rem; color: var(--accent); text-transform: uppercase;
    letter-spacing: 0.05em; margin-bottom: 0.1rem; }
.tutor-era { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.tutor-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; line-height: 1.5; }
.session-badge { font-size: 0.75rem; background: var(--bg3); border: 1px solid var(--border);
    border-radius: 20px; padding: 0.2rem 0.6rem; color: var(--text-muted); }
.session-badge.new { color: var(--green); border-color: rgba(63,185,80,0.3); }
.empty-state { color: var(--text-muted); text-align: center; padding: 3rem; }

/* ── Chat ───────────────────────────────────────────────────────────────────── */
.chat-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { flex-shrink: 0; }
.back-link { color: var(--text-muted); font-size: 0.9rem; white-space: nowrap; }
.tutor-header-info { display: flex; align-items: center; gap: 0.75rem; flex: 1; }
.tutor-avatar-sm { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1rem; font-weight: bold; flex-shrink: 0; }
.tutor-header-info strong { display: block; font-size: 0.95rem; line-height: 1.2; }
.tutor-subject-sm { font-size: 0.75rem; color: var(--text-muted); }

.mode-toggle { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.mode-toggle label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.mode-toggle input[type=checkbox] { width: 36px; height: 20px; appearance: none; background: var(--bg3);
    border: 1px solid var(--border); border-radius: 20px; cursor: pointer; position: relative; transition: background 0.2s; }
.mode-toggle input[type=checkbox]::after { content: ''; position: absolute; top: 2px; left: 2px;
    width: 14px; height: 14px; background: var(--text-muted); border-radius: 50%; transition: left 0.2s; }
.mode-toggle input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
.mode-toggle input[type=checkbox]:checked::after { left: 18px; background: white; }
.mode-label { font-size: 0.85rem; font-weight: 600; min-width: 50px; }
.mode-info { font-size: 0.75rem; color: var(--text-muted); }

.chat-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; max-width: 800px;
    margin: 0 auto; width: 100%; padding: 0 1rem; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem 0; display: flex; flex-direction: column; gap: 1.25rem; }

.welcome-msg { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem; text-align: center; }
.welcome-msg p { color: var(--text-muted); margin-bottom: 0.5rem; }

.msg { display: flex; gap: 0.75rem; align-items: flex-start; }
.msg-user { flex-direction: row-reverse; }
.msg-user .msg-content { background: var(--accent); color: white; border-radius: 12px 12px 4px 12px; }
.msg-assistant .msg-content { background: var(--bg2); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; }
.msg.mode-modern .msg-assistant .msg-content { border-color: var(--purple); }

.msg-content { padding: 0.75rem 1rem; font-size: 0.95rem; max-width: 85%; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.msg-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1rem; font-weight: bold; flex-shrink: 0; margin-top: 2px; }

.typing-indicator { display: flex; gap: 0.75rem; align-items: center; }
.typing-dots { display: flex; gap: 4px; padding: 0.75rem 1rem; background: var(--bg2);
    border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; }
.typing-dots span { width: 8px; height: 8px; background: var(--text-muted); border-radius: 50%;
    animation: bounce 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,80%,100% { transform: scale(0.8); opacity: 0.5; } 40% { transform: scale(1.1); opacity: 1; } }

.chat-input-area { flex-shrink: 0; padding: 1rem 0 1.5rem; border-top: 1px solid var(--border); }
.chat-input-area form { display: flex; gap: 0.75rem; align-items: flex-end; }
#message-input { flex: 1; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); padding: 0.65rem 1rem; font-size: 0.95rem; font-family: var(--font);
    resize: none; min-height: 52px; max-height: 200px; outline: none; }
#message-input:focus { border-color: var(--accent); }
.btn-send { background: var(--accent); color: white; border: none; border-radius: 8px;
    padding: 0.65rem 1.25rem; font-size: 0.95rem; cursor: pointer; font-family: var(--font); white-space: nowrap; }
.btn-send:hover { background: var(--accent-h); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 600px) {
    .header-inner { padding: 0.6rem 1rem; }
    .mode-info { display: none; }
    .tutor-desc { display: none; }
    .chat-container { padding: 0 0.5rem; }
}
