/* ── Graeme Richardson — Portfolio Chat ─────────────────
   Core layout: tokens, reset, header, input, responsive.
   Fullscreen immersive dark theme.
   ─────────────────────────────────────────────────── */

/* ── Design Tokens ──────────────────────────────── */
:root {
    --bg: #000000;
    --bg-card: #0F0F0F;
    --border: #1A1A1A;
    --text: #FFFFFF;
    --text-secondary: #A3A3A3;
    --text-muted: #666666;
    --accent: #00B8CC;
    --accent-glow: rgba(0, 184, 204, 0.15);
    --accent-subtle: rgba(0, 184, 204, 0.08);
    --user-bubble: #0F1A1C;
    --aria-bubble: #0F0F0F;
    --success: #16A34A;
    --warn: #D97706;
    --font-display: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-chat: 'Roboto', system-ui, -apple-system, sans-serif;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body { display: flex; flex-direction: column; }

/* ── Ambient glow ──────────────────────────────── */
body::before {
    content: '';
    position: fixed; inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,184,204,0.04) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 50% 100%, rgba(0,184,204,0.02) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}

/* ── Chat Container ────────────────────────────── */
.chat-container {
    position: relative; z-index: 1;
    width: 100%; height: 100vh; height: 100dvh;
    display: flex; flex-direction: column;
    background: transparent;
}

/* ── Header ────────────────────────────────────── */
.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    flex-shrink: 0; z-index: 10; position: relative;
}

.chat-header::after {
    content: '';
    position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg,
        transparent 0%, var(--accent) 20%, var(--accent) 25%, transparent 30%,
        transparent 60%, var(--accent) 70%, var(--accent) 75%, transparent 80%);
    opacity: 0.3;
    animation: scanDrift 8s ease-in-out infinite;
}
@keyframes scanDrift {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.6; }
}

.header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

.aria-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    overflow: hidden; flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,0.1);
    position: relative;
    box-shadow: 0 0 20px var(--accent-glow);
    transition: box-shadow 0.5s ease;
}
.aria-avatar:hover { box-shadow: 0 0 32px rgba(0,184,204,0.3); }
.aria-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.aria-avatar.thinking-avatar {
    animation: avatarPulse 2s ease-in-out infinite;
}
@keyframes avatarPulse {
    0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
    50% { box-shadow: 0 0 40px rgba(0,184,204,0.35), 0 0 80px rgba(0,184,204,0.1); }
}

.header-info {
    min-width: 0;
    overflow: hidden;
}

.header-info h1 {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-divider {
    color: rgba(255,255,255,0.2);
    font-weight: 300;
    margin: 0 2px;
}

.header-title {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.status-badge {
    font-size: 12px; color: var(--text-secondary);
    display: flex; align-items: center; gap: 6px;
    font-weight: 500; letter-spacing: 0.01em;
    font-family: var(--font-body);
}

.status-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-muted); flex-shrink: 0;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 8px rgba(22,163,74,0.5); }
.status-dot.thinking {
    background: var(--warn); box-shadow: 0 0 8px rgba(217,119,6,0.5);
    animation: dotPulse 1.2s ease-in-out infinite;
}
@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.header-link {
    display: flex; align-items: center; gap: 7px;
    font-size: 12px; font-weight: 500; color: var(--text-secondary);
    text-decoration: none; padding: 7px 12px;
    border-radius: var(--radius-full); transition: all 0.2s ease; letter-spacing: 0.01em;
    font-family: var(--font-body);
}
.header-link:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.icon-btn {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid transparent; background: transparent;
    color: var(--text-secondary); cursor: pointer; transition: all 0.2s ease;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); border-color: var(--border); }

/* ── Name Prompt Overlay ───────────────────────── */
.name-prompt-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.name-prompt-overlay.dismissed {
    opacity: 0; visibility: hidden; pointer-events: none;
}

.name-prompt-card {
    text-align: center;
    max-width: 420px;
    width: 90%;
    padding: 40px 32px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    animation: cardIn 0.5s ease-out;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.name-prompt-avatar {
    width: 72px; height: 72px; border-radius: 50%;
    overflow: hidden; margin: 0 auto 20px;
    border: 2px solid rgba(0,184,204,0.3);
    box-shadow: 0 0 32px var(--accent-glow);
}
.name-prompt-avatar img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

.name-prompt-card h2 {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 700;
    color: var(--text); margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.name-prompt-card p {
    font-family: var(--font-chat);
    font-size: 14px; color: var(--text-secondary);
    line-height: 1.6; margin-bottom: 10px;
}

.name-prompt-sub {
    font-family: var(--font-body);
    font-size: 13px; color: var(--accent);
    font-weight: 500; margin-bottom: 20px;
}

.name-prompt-form {
    display: flex; flex-direction: column; gap: 10px;
}

.name-input {
    width: 100%; padding: 14px 18px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body); font-size: 15px;
    outline: none; text-align: center;
    transition: all 0.25s ease;
}
.name-input:focus {
    border-color: rgba(0,184,204,0.5);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.name-input::placeholder { color: #444; }

.name-submit {
    width: 100%; padding: 14px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--accent);
    color: #000;
    font-family: var(--font-body);
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.name-submit:hover {
    background: #00D4E8;
    box-shadow: 0 0 32px rgba(0,184,204,0.3);
    transform: translateY(-1px);
}

.name-skip {
    background: none; border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 13px; cursor: pointer; padding: 8px;
    transition: color 0.2s ease;
}
.name-skip:hover { color: var(--text-secondary); }

/* ── Thinking label in chat ────────────────────── */
.thinking-label {
    font-family: var(--font-body);
    font-size: 11px; color: var(--accent);
    font-weight: 500; letter-spacing: 0.02em;
    margin-top: 4px; margin-left: 44px;
    animation: labelFade 1.4s ease-in-out infinite;
}
@keyframes labelFade {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ── LinkedIn Card ──────────────────────────────── */
.linkedin-card-wrapper {
    flex-shrink: 0;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.6);
    overflow: hidden;
    transition: all 0.3s ease;
}
.linkedin-card-wrapper.dismissed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border-bottom-width: 0;
}

.linkedin-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-width: 780px;
    margin: 0 auto;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.linkedin-card:hover {
    border-color: rgba(0,119,181,0.3);
    box-shadow: 0 0 40px rgba(0,119,181,0.08), 0 8px 32px rgba(0,0,0,0.4);
}

.linkedin-card-bg {
    height: 3px;
    background: linear-gradient(90deg, #0077B5 0%, #00A0DC 50%, #0077B5 100%);
    opacity: 0.8;
}

.linkedin-card-body {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
}

.linkedin-card-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(0,119,181,0.2);
    box-shadow: 0 0 24px rgba(0,119,181,0.1);
}
.linkedin-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.linkedin-card-info {
    flex: 1;
    min-width: 0;
}

.linkedin-card-info h2 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: 2px;
}

.linkedin-card-title {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 2px;
    letter-spacing: 0.01em;
}

.linkedin-card-bio {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

.linkedin-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 10px 18px;
    background: #0077B5;
    color: #fff;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-full);
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.linkedin-card-cta:hover {
    background: #008CC9;
    box-shadow: 0 0 24px rgba(0,119,181,0.35);
    transform: translateY(-1px);
}

.linkedin-card-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    z-index: 2;
}
.linkedin-card-close:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
}

/* ── Messages Area ─────────────────────────────── */
.messages-container {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    scroll-behavior: smooth; padding: 24px; position: relative;
}
.messages-container::-webkit-scrollbar { width: 4px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.messages-container::-webkit-scrollbar-thumb:hover { background: #2A2A2A; }

.messages-list {
    display: flex; flex-direction: column; gap: 20px;
    max-width: 780px; margin: 0 auto; width: 100%;
}

/* ── Input Bar ─────────────────────────────────── */
.chat-input-container {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    flex-shrink: 0; z-index: 10;
}

.chat-input-form {
    display: flex; gap: 10px; align-items: center;
    max-width: 780px; margin: 0 auto; width: 100%;
}

.chat-input {
    flex: 1; padding: 13px 20px;
    border-radius: var(--radius-full); border: 1px solid var(--border);
    background: var(--bg-card); color: var(--text);
    font-family: var(--font-body); font-size: 14px;
    outline: none; transition: all 0.25s ease;
}
.chat-input:focus {
    border-color: rgba(0,184,204,0.5);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px rgba(0,184,204,0.05);
}
.chat-input::placeholder { color: #4A4A4A; }

.send-btn {
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid rgba(0,184,204,0.3);
    background: rgba(0,184,204,0.1); color: var(--accent);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease; flex-shrink: 0;
}
.send-btn:hover {
    background: var(--accent); color: #000; border-color: var(--accent);
    box-shadow: 0 0 24px rgba(0,184,204,0.3); transform: scale(1.04);
}
.send-btn:disabled {
    background: rgba(255,255,255,0.04); border-color: var(--border);
    color: var(--text-muted); cursor: not-allowed;
    box-shadow: none; transform: none;
}

.input-hint {
    text-align: center; font-size: 11px; color: #3A3A3A;
    margin-top: 10px; max-width: 780px;
    margin-left: auto; margin-right: auto; letter-spacing: 0.02em;
    font-family: var(--font-body);
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 768px) {
    .chat-header { padding: 10px 14px; }
    .messages-container { padding: 16px; }
    .messages-list { max-width: 100%; }
    .chat-input-container { padding: 12px 16px 16px; }
    .header-link { display: none; }
    .aria-avatar { width: 36px; height: 36px; }
    .header-info h1 { font-size: 13px; }
    .header-title { font-size: 11px; }

    .linkedin-card-wrapper { padding: 12px 14px; }
    .linkedin-card-body {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 14px 16px;
    }
    .linkedin-card-info h2 { font-size: 15px; }
    .linkedin-card-cta { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .header-info h1 .header-divider,
    .header-info h1 .header-title { display: none; }
}

@media (min-width: 1400px) {
    .messages-list { max-width: 860px; }
    .chat-input-form { max-width: 860px; }
    .linkedin-card { max-width: 860px; }
}
