/* ============================================================
   INSIDEMAPS AI — Premium Dark Theme
   ============================================================ */

:root {
    --bg-primary: #0A0C10;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a27;
    --bg-hover: #22222f;
    --bg-card: #14171F;
    --text-primary: #e8e8ed;
    --text-secondary: #9494a8;
    --text-muted: #5c5c72;
    --accent: #C6F24E;
    --accent-light: #D6FF5E;
    --accent-glow: rgba(198,242,78, 0.15);
    --success: #00cec9;
    --warning: #fdcb6e;
    --danger: #ff7675;
    --border: #2a2a3a;
    --border-light: #1e1e2e;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --font: 'Hanken Grotesk', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --sidebar-w: 280px;
    --panel-w: 340px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- SCREENS ---- */
.screen { display: none; height: 100vh; }
.screen.active { display: flex; }

/* ===== FUTURISTIC LOGIN ===== */
.login-container {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%; position: relative; overflow: hidden;
    background: #05060f;
}

/* Animated background */
.login-bg {
    position: absolute; inset: 0; overflow: hidden;
}
.grid-overlay {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(198,242,78,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(198,242,78,0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 20s linear infinite;
}
@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

.glow-orb {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.4;
    animation: orbFloat 15s ease-in-out infinite;
}
.orb-1 {
    width: 400px; height: 400px; top: -100px; left: -100px;
    background: radial-gradient(circle, rgba(198,242,78,0.35), transparent 70%);
    animation-delay: 0s;
}
.orb-2 {
    width: 350px; height: 350px; bottom: -80px; right: -80px;
    background: radial-gradient(circle, rgba(198,242,78,0.28), transparent 70%);
    animation-delay: -5s;
}
.orb-3 {
    width: 300px; height: 300px; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(198,242,78,0.15), transparent 70%);
    animation-delay: -10s;
}
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-20px, 30px) scale(0.95); }
    75% { transform: translate(20px, 20px) scale(1.02); }
}

.particles {
    position: absolute; inset: 0; overflow: hidden;
}

/* Login Card - Glass morphism */
.login-card {
    position: relative; z-index: 2;
    width: 420px; max-width: 90vw;
    padding: 48px 40px 36px;
    background: rgba(15, 17, 30, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(198,242,78, 0.15);
    border-radius: 24px;
    box-shadow:
        0 0 40px rgba(198,242,78, 0.08),
        0 25px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    text-align: center;
    animation: cardAppear 0.8s ease-out;
}
@keyframes cardAppear {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: none; }
}

.login-logo-wrap {
    margin-bottom: 20px;
}
.login-brand-logo {
    height: 56px; width: auto;
    filter: drop-shadow(0 0 20px rgba(198,242,78, 0.35));
}

.login-title {
    font-size: 32px; font-weight: 800; color: #fff;
    letter-spacing: 3px; margin-bottom: 4px;
    text-shadow: 0 0 30px rgba(198,242,78, 0.3);
}
.ai-glow {
    background: linear-gradient(135deg, #C6F24E, #D6FF5E, #E4F7A8);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: aiGlowPulse 3s ease-in-out infinite;
}
@keyframes aiGlowPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

.login-subtitle {
    color: #64748b; font-size: 14px; margin-bottom: 32px;
    letter-spacing: 1px; text-transform: uppercase;
}

/* Error message */
.login-error {
    display: none; color: #f87171; font-size: 13px;
    margin-bottom: 16px; padding: 10px 14px;
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 10px; text-align: left;
}
.login-error.show { display: block; }

/* Form */
.login-form {
    display: flex; flex-direction: column; gap: 14px;
}

.input-group {
    position: relative; display: flex; align-items: center;
}
.input-icon {
    position: absolute; left: 16px; color: #4a5568;
    display: flex; align-items: center; pointer-events: none;
    transition: color 0.2s;
}
.input-group input {
    width: 100%; padding: 14px 16px 14px 48px;
    background: rgba(15, 17, 30, 0.6);
    border: 1px solid rgba(198,242,78, 0.12);
    border-radius: 12px; color: #e2e8f0;
    font-size: 16px; font-family: var(--font);
    outline: none; transition: all 0.3s;
}
.input-group input:focus {
    border-color: rgba(198,242,78, 0.5);
    box-shadow: 0 0 0 3px rgba(198,242,78, 0.1), 0 0 20px rgba(198,242,78, 0.08);
    background: rgba(15, 17, 30, 0.8);
}
.input-group input:focus + .input-icon,
.input-group:focus-within .input-icon { color: #D6FF5E; }
.input-group input::placeholder { color: #3a3f55; }

/* Submit button */
.login-submit {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 15px;
    background: linear-gradient(135deg, #C6F24E, #A9D637);
    color: #0A0C10; border: none; border-radius: 12px;
    font-size: 15px; font-weight: 600; font-family: var(--font);
    cursor: pointer; transition: all 0.3s;
    position: relative; overflow: hidden;
    margin-top: 4px;
}
.login-submit::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.15), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
}
.login-submit:hover::before { transform: translateX(100%); }
.login-submit:hover {
    box-shadow: 0 0 30px rgba(198,242,78, 0.4), 0 8px 25px rgba(198,242,78, 0.3);
    transform: translateY(-1px);
}
.login-submit:active { transform: translateY(0); }
.login-submit:disabled {
    opacity: 0.6; cursor: not-allowed; transform: none;
    box-shadow: none;
}

.forgot-link {
    background: none; border: none; color: #4a5568;
    font-size: 12px; cursor: pointer; margin-top: 16px;
    font-family: var(--font); transition: color 0.2s;
}
.forgot-link:hover { color: #D6FF5E; }

.login-footer-links {
    margin-top: 24px; padding-top: 20px;
    border-top: 1px solid rgba(198,242,78, 0.08);
    display: flex; justify-content: center; gap: 8px;
    font-size: 11px;
}
.login-footer-links a { color: #4a5568; text-decoration: none; transition: color 0.2s; }
.login-footer-links a:hover { color: #D6FF5E; }
.login-footer-links span { color: #2a2d3a; }

/* ---- SIDEBAR ---- */
#sidebar {
    width: var(--sidebar-w); height: 100vh; display: flex; flex-direction: column;
    background: var(--bg-secondary); border-right: 1px solid var(--border);
    flex-shrink: 0; transition: var(--transition);
}
.sidebar-header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 16px 12px; border-bottom: 1px solid var(--border-light);
}
.sidebar-logo { width: 32px; height: 32px; display: block; filter: drop-shadow(0 0 8px rgba(198,242,78, 0.4)); }
.sidebar-title { font-weight: 600; font-size: 15px; flex: 1; }
.sidebar-search { padding: 12px 16px; }
.sidebar-search input {
    width: 100%; padding: 8px 12px; border-radius: var(--radius-sm);
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-primary); font-size: 13px; outline: none;
    transition: var(--transition);
}
.sidebar-search input:focus { border-color: var(--accent); }
.sidebar-conversations {
    flex: 1; overflow-y: auto; padding: 4px 8px;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.conv-item {
    padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 13px; color: var(--text-secondary); transition: var(--transition);
    display: flex; align-items: center; gap: 8px; margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.conv-item.active { background: var(--accent-glow); color: var(--accent-light); }
.conv-item .conv-icon { opacity: 0.5; font-size: 14px; flex-shrink: 0; }
.conv-item .conv-title { overflow: hidden; text-overflow: ellipsis; }
.conv-item .conv-delete {
    margin-left: auto; opacity: 0; font-size: 12px; padding: 2px 6px;
    border-radius: 4px; border: none; background: transparent; color: var(--danger);
    cursor: pointer; flex-shrink: 0;
}
.conv-item:hover .conv-delete { opacity: 0.6; }
.conv-item .conv-delete:hover { opacity: 1; background: rgba(255,118,117,0.1); }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border-light); }
.user-info {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; margin-bottom: 8px;
}
.user-avatar { width: 32px; height: 32px; border-radius: 50%; }
#user-name { font-size: 13px; font-weight: 500; }
.sidebar-nav { display: flex; gap: 4px; }
.nav-btn {
    flex: 1; padding: 8px; border: none; border-radius: var(--radius-sm);
    background: var(--bg-tertiary); cursor: pointer; font-size: 16px;
    transition: var(--transition);
}
.nav-btn:hover { background: var(--bg-hover); transform: scale(1.05); }

/* ---- CHAT AREA ---- */
#chat-area {
    flex: 1; display: flex; flex-direction: column;
    height: 100vh; min-width: 0;
}
/* ===== WELCOME SCREEN ===== */
.chat-welcome {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
}
.welcome-content {
    text-align: center; max-width: 680px; width: 100%;
    animation: welcomeFadeIn 0.6s ease-out;
}
@keyframes welcomeFadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: none; }
}
.welcome-logo-wrap { margin-bottom: 24px; }
.welcome-logo {
    width: 64px; height: 64px;
    filter: drop-shadow(0 0 30px rgba(198,242,78, 0.4));
    animation: welcomeLogoPulse 4s ease-in-out infinite;
}
@keyframes welcomeLogoPulse {
    0%, 100% { filter: drop-shadow(0 0 30px rgba(198,242,78, 0.4)); }
    50% { filter: drop-shadow(0 0 45px rgba(198,242,78, 0.6)); }
}
.welcome-title {
    font-size: 28px; font-weight: 600; color: var(--text-primary);
    margin-bottom: 8px; letter-spacing: -0.3px;
}
.welcome-sub {
    color: var(--text-secondary); font-size: 16px; margin-bottom: 36px;
}

.welcome-cards {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    margin-bottom: 32px; text-align: left;
}
@media (max-width: 600px) { .welcome-cards { grid-template-columns: 1fr; } }

.welcome-card {
    display: flex; align-items: start; gap: 14px;
    padding: 18px; border-radius: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    cursor: pointer; transition: all 0.25s;
}
.welcome-card:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}
.welcome-card-icon { font-size: 24px; flex-shrink: 0; margin-top: 2px; }
.welcome-card-text strong {
    display: block; font-size: 14px; font-weight: 600;
    color: var(--text-primary); margin-bottom: 3px;
}
.welcome-card-text span {
    font-size: 12px; color: var(--text-muted); line-height: 1.4;
}

.welcome-model-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 16px; border-radius: 20px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    font-size: 11px; color: var(--text-muted);
    font-family: var(--mono); letter-spacing: 0.3px;
}
.model-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

/* ===== MESSAGES — TIER 1 DESIGN ===== */
.messages-container {
    flex: 1; overflow-y: auto; padding: 24px 15%;
    scroll-behavior: smooth;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
@media (max-width: 1200px) { .messages-container { padding: 24px 8%; } }
@media (max-width: 768px) { .messages-container { padding: 16px; } }

.message {
    margin-bottom: 28px; animation: msgSlideIn 0.3s ease-out;
    position: relative;
}
@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.message .msg-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.message .msg-role {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.message.user .msg-role { color: var(--accent-light); }
.message.assistant .msg-role { color: #22c55e; }
.message .msg-time { font-size: 10px; color: var(--text-muted); }

.message .msg-body {
    font-size: 14.5px; line-height: 1.8; color: var(--text-primary);
    position: relative;
}
.message.user .msg-body {
    background: rgba(198,242,78, 0.08);
    border: 1px solid rgba(198,242,78, 0.15);
    padding: 14px 18px; border-radius: 18px 18px 4px 18px;
}
.message.assistant .msg-body { padding: 4px 0; }

.message .msg-actions {
    position: absolute; top: 0; right: 0;
    opacity: 0; transition: opacity 0.2s;
    display: flex; gap: 4px;
}
.message:hover .msg-actions { opacity: 1; }
.msg-copy-btn {
    padding: 4px 8px; border-radius: 6px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer; font-size: 11px;
    transition: all 0.2s; font-family: var(--font);
}
.msg-copy-btn:hover { color: var(--text-primary); border-color: var(--accent); }

.message .msg-body pre {
    background: #0d1117; border: 1px solid #21262d;
    border-radius: 10px; padding: 16px; margin: 12px 0;
    overflow-x: auto; font-family: var(--mono); font-size: 13px;
    line-height: 1.5; position: relative;
}
.message .msg-body code {
    font-family: var(--mono); font-size: 13px;
    background: rgba(198,242,78, 0.1); padding: 2px 6px;
    border-radius: 4px; color: var(--accent-light);
}
.message .msg-body pre code {
    background: none; padding: 0; color: #e6edf3;
}

.message .msg-body ul, .message .msg-body ol {
    margin: 8px 0; padding-left: 20px;
}
.message .msg-body li { margin-bottom: 4px; }
.message .msg-body p { margin-bottom: 10px; }
.message .msg-body p:last-child { margin-bottom: 0; }
.message .msg-model {
    font-size: 11px; color: var(--text-muted); margin-top: 6px;
    font-family: var(--mono);
}

/* ===== INPUT AREA — PREMIUM ===== */
.chat-input-area {
    padding: 16px 15%; background: transparent;
    border-top: none;
}
@media (max-width: 1200px) { .chat-input-area { padding: 16px 8%; } }
@media (max-width: 768px) { .chat-input-area { padding: 12px; } }

.input-wrapper {
    display: flex; align-items: flex-end; gap: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px; padding: 6px 8px 6px 6px;
    transition: all 0.3s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 20px rgba(0, 0, 0, 0.2);
}

.input-attach-wrap { position: relative; }
.input-attach-btn {
    width: 38px; height: 38px; border-radius: 10px;
    background: transparent; border: none;
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
}
.input-attach-btn:hover { color: var(--accent-light); background: var(--accent-glow); }

#chat-input {
    flex: 1; background: none; border: none; color: var(--text-primary);
    font-size: 14.5px; font-family: var(--font); resize: none;
    max-height: 150px; outline: none; line-height: 1.5;
    padding: 8px 8px 8px 4px; min-height: 24px;
}
#chat-input::placeholder { color: var(--text-muted); }

.btn-send {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #0A0C10; transition: all 0.2s; flex-shrink: 0;
}
.btn-send:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-send:not(:disabled):hover {
    box-shadow: 0 4px 15px rgba(198,242,78, 0.4);
    transform: scale(1.05);
}

.input-footer {
    display: flex; justify-content: center; align-items: center;
    padding: 8px 4px 4px; font-size: 11px; color: var(--text-muted);
    gap: 8px;
}
.typing-indicator { color: var(--accent-light); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ===== CONVERSATION LIST DATES ===== */
.conv-item .conv-date {
    font-size: 10px; color: var(--text-muted);
    margin-left: auto; flex-shrink: 0; padding-left: 8px;
}
.conv-item:hover .conv-date { display: none; }
.typing-indicator { color: var(--accent-light); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ---- SIDE PANEL ---- */
.side-panel {
    width: var(--panel-w); height: 100vh; flex-shrink: 0;
    background: var(--bg-secondary); border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    animation: slideIn 0.2s ease-out;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } }
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border-light);
}
.panel-header h3 { font-size: 16px; font-weight: 600; }
.panel-content { flex: 1; overflow-y: auto; padding: 16px 20px; }

/* ---- MEMORY PANEL ---- */
.memory-category { margin-bottom: 20px; }
.memory-category h4 {
    font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted); margin-bottom: 8px; padding-bottom: 4px;
    border-bottom: 1px solid var(--border-light);
}
.memory-item {
    display: flex; align-items: start; gap: 8px; padding: 8px;
    border-radius: var(--radius-sm); font-size: 13px;
    transition: var(--transition);
}
.memory-item:hover { background: var(--bg-hover); }
.memory-key { color: var(--accent-light); font-weight: 500; min-width: 80px; }
.memory-value { color: var(--text-secondary); flex: 1; }
.memory-actions { display: flex; gap: 4px; opacity: 0; transition: var(--transition); }
.memory-item:hover .memory-actions { opacity: 1; }
.memory-actions button {
    background: none; border: none; cursor: pointer; font-size: 12px;
    padding: 2px 4px; border-radius: 4px;
}
.memory-actions button:hover { background: var(--bg-tertiary); }

/* ---- BUTTONS ---- */
.btn-icon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    background: var(--bg-tertiary); border: 1px solid var(--border);
    color: var(--text-secondary); cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ---- UTILITY ---- */
.hidden { display: none !important; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.login-links{margin-top:16px;font-size:12px}.login-links a{color:var(--text-muted);text-decoration:none;transition:var(--transition)}.login-links a:hover{color:var(--accent-light)}

/* ===== RESPONSIVE / MOBILE ===== */

/* Mobile header bar — only visible on mobile */
.mobile-header {
    display: none; align-items: center; gap: 12px;
    padding: 10px 14px; background: var(--bg-secondary);
    border-bottom: 1px solid var(--border); flex-shrink: 0;
    min-height: 52px;
}
.mobile-menu-btn {
    width: 40px; height: 40px; background: var(--bg-tertiary);
    border: 1px solid var(--border); color: var(--text-primary);
    border-radius: var(--radius-sm); cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.mobile-menu-btn:hover { background: var(--bg-hover); color: var(--accent-light); }
.mobile-menu-btn svg { display: block; width: 22px; height: 22px; }
.mobile-header-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }

/* Backdrop overlay when sidebar is open on mobile */
#sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.55); z-index: 998;
    backdrop-filter: blur(2px);
}
#sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
    .mobile-header { display: flex; }

    /* Sidebar slides in from left, full overlay on mobile */
    #sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 999;
        width: min(280px, 82vw); transform: translateX(-105%);
        transition: transform 0.28s ease;
        box-shadow: 0 0 30px rgba(0,0,0,0.4);
    }
    #sidebar.open { transform: translateX(0); }

    /* Chat area takes full width */
    #chat-area { width: 100%; min-width: 0; }

    /* Tighten chat padding */
    .messages-container { padding: 14px 14px; }
    .chat-input-area { padding: 10px 12px 14px; }
    #chat-input { font-size: 16px; } /* prevents iOS zoom */
    .sidebar-search input { font-size: 16px; }
    .input-wrapper { border-radius: 14px; }

    /* Welcome screen tighter */
    .chat-welcome { padding: 20px 16px; }
    .welcome-title { font-size: 24px; }
    .welcome-sub { font-size: 15px; margin-bottom: 24px; }
    .welcome-cards { grid-template-columns: 1fr; gap: 10px; margin-bottom: 22px; }
    .welcome-card { padding: 14px; }
    .welcome-model-badge { font-size: 10px; padding: 5px 12px; }

    /* Side panel becomes fullscreen */
    #side-panel.side-panel {
        position: fixed; inset: 0; width: 100% !important;
        z-index: 1000; border-left: none; border-radius: 0;
    }

    /* Login surface */
    .login-card { padding: 36px 24px 28px; width: 100%; max-width: 92vw; }
    .login-title { font-size: 26px; letter-spacing: 2px; }
    .login-logo-wrap { margin-bottom: 14px; }
    .login-subtitle { margin-bottom: 22px; font-size: 12px; }
}

@media (max-width: 480px) {
    .messages-container { padding: 10px 10px; }
    .chat-input-area { padding: 8px 8px 12px; }
    .welcome-title { font-size: 22px; }
    .welcome-sub { font-size: 14px; }
    .welcome-card-icon { font-size: 20px; }
    .login-card { padding: 28px 18px; border-radius: 18px; }
    .login-title { font-size: 22px; letter-spacing: 1.5px; }
    .ak-card, .ak-playbook { padding: 26px 18px; }
    .input-group input { padding: 13px 14px 13px 44px; }
    .input-icon { left: 14px; }
    .input-icon svg { width: 18px; height: 18px; }
}

@media (min-width: 769px) {
    .mobile-header { display: none !important; }
    #sidebar-overlay { display: none !important; }
}

/* ===== LOGIN DIVIDER (legacy, retained) ===== */
.login-divider {
    display: flex; align-items: center; gap: 12px; margin: 16px 0; width: 100%;
}
.login-divider::before, .login-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.login-divider span { color: var(--text-muted); font-size: 12px; text-transform: uppercase; }

/* ===== GOOGLE CONNECT BANNER (in profile/settings) ===== */
.google-connect-banner {
    background: linear-gradient(135deg, rgba(198,242,78,0.1), rgba(198,242,78,0.05));
    border: 1px solid var(--accent); border-radius: 12px; padding: 16px; margin-bottom: 16px;
    display: flex; align-items: center; gap: 12px;
}
.google-connect-banner .icon { font-size: 24px; }
.google-connect-banner .text { flex: 1; }
.google-connect-banner .text h4 { font-size: 14px; margin-bottom: 2px; }
.google-connect-banner .text p { font-size: 12px; color: var(--text-muted); }
.google-connect-btn {
    padding: 8px 16px; background: white; color: #333; border: 1px solid #ddd;
    border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer;
    display: flex; align-items: center; gap: 6px; font-family: inherit;
}
.google-connect-btn:hover { background: #f5f5f5; }
.google-connect-btn img { width: 16px; height: 16px; }

/* Fix Google button */
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px; background: white; border: 1px solid #ddd; border-radius: 10px; font-size: 15px; font-weight: 500; color: #333; cursor: pointer; font-family: inherit; transition: var(--transition); }
.google-btn:hover { background: #f5f5f5; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.google-btn img { width: 20px; height: 20px; object-fit: contain; }

/* Avatar click-to-upload */
.user-avatar { cursor: pointer; transition: var(--transition); object-fit: cover; }
.user-avatar:hover { opacity: 0.7; box-shadow: 0 0 0 2px var(--accent); }


/* ============================================================
   AK LOGIN — final clean — 20260520
   2-col layout: login card left, playbook steps right
   ============================================================ */

/* Visual + structural styles for the login surface.
   NOTE: .ak-login-screen does NOT set display:flex — the existing
   .screen.active { display: flex } rule retains control of visibility
   so the SPA's add/remove .active toggle keeps working post-login. */
.ak-login-screen {
    position: relative;
    min-height: 100vh;
    background: #050811;
    color: #E8EAED;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* faint grid background */
.ak-login-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(198,242,78, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(198,242,78, 0.045) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}

/* radial coral bloom in corners */
.ak-login-screen::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 12% 18%, rgba(198,242,78, 0.12), transparent 38%),
        radial-gradient(circle at 88% 82%, rgba(198,242,78, 0.10), transparent 42%);
    pointer-events: none;
}

/* floating particles */
.ak-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}
.ak-particles span {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #D6FF5E;
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 8px rgba(198,242,78, 0.85);
    animation: akFloat 14s linear infinite;
}
.ak-particles span:nth-child(1)  { left:  8%;  animation-delay:  0s;  animation-duration: 18s; }
.ak-particles span:nth-child(2)  { left: 18%;  animation-delay:  3s;  animation-duration: 22s; }
.ak-particles span:nth-child(3)  { left: 28%;  animation-delay:  6s;  animation-duration: 16s; }
.ak-particles span:nth-child(4)  { left: 38%;  animation-delay:  1s;  animation-duration: 20s; }
.ak-particles span:nth-child(5)  { left: 48%;  animation-delay:  8s;  animation-duration: 24s; }
.ak-particles span:nth-child(6)  { left: 58%;  animation-delay:  4s;  animation-duration: 17s; }
.ak-particles span:nth-child(7)  { left: 68%;  animation-delay:  9s;  animation-duration: 21s; }
.ak-particles span:nth-child(8)  { left: 78%;  animation-delay:  2s;  animation-duration: 19s; }
.ak-particles span:nth-child(9)  { left: 88%;  animation-delay:  7s;  animation-duration: 23s; }
.ak-particles span:nth-child(10) { left: 95%;  animation-delay: 11s;  animation-duration: 15s; }

@keyframes akFloat {
    0%   { transform: translateY(110vh) scale(0.6); opacity: 0; }
    10%  { opacity: 0.9; }
    90%  { opacity: 0.7; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* the 2-col grid */
.ak-login-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(380px, 460px) minmax(380px, 520px);
    gap: 48px;
    align-items: stretch;
    max-width: 1080px;
    width: 100%;
}

/* shared card surface */
.ak-card {
    background: linear-gradient(180deg, rgba(15, 20, 38, 0.78), rgba(10, 14, 31, 0.92));
    border: 1px solid rgba(198,242,78, 0.14);
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow:
        0 24px 60px -20px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.ak-card--login {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* logo */
.ak-logo-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}
.ak-logo-halo {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle at 50% 50%,
        rgba(198,242,78, 0.45),
        rgba(198,242,78, 0.18) 50%,
        transparent 70%);
    filter: blur(18px);
    animation: akHalo 4s ease-in-out infinite;
    z-index: 0;
}
.ak-logo {
    position: relative;
    z-index: 1;
}
.ak-logo-pulse {
    transform-origin: 60px 60px;
    animation: akPulse 2.2s ease-in-out infinite;
}
@keyframes akHalo {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.08); }
}
@keyframes akPulse {
    0%, 100% { opacity: 0.85; transform: scale(1); }
    50%      { opacity: 0.45; transform: scale(1.5); }
}

/* title */
.ak-title {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 0 0 6px;
    color: #FFFFFF;
}
.ak-title-accent {
    background: linear-gradient(135deg, #C6F24E, #D6FF5E, #E4F7A8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.ak-subtitle {
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6B7390;
    margin: 0 0 32px;
}

/* form */
.ak-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ak-field {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(8, 12, 28, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.ak-field:focus-within {
    border-color: rgba(198,242,78, 0.55);
    background: rgba(12, 17, 36, 0.85);
    box-shadow: 0 0 0 3px rgba(198,242,78, 0.10);
}
.ak-field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    color: #6B7390;
    flex-shrink: 0;
}
.ak-field input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    padding: 14px 14px 14px 0;
    font-size: 16px;
    color: #FFFFFF;
    font-family: inherit;
}
.ak-field input::placeholder { color: #6B7390; }

/* primary button — gradient + animated sweep */
.ak-btn-primary {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
    padding: 15px 24px;
    background: linear-gradient(135deg, #C6F24E, #A9D637);
    border: 0;
    border-radius: 12px;
    color: #0A0C10;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 30px -8px rgba(198,242,78, 0.55);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ak-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 38px -8px rgba(198,242,78, 0.75);
}
.ak-btn-primary:active { transform: translateY(0); }

.ak-btn-sweep {
    position: absolute;
    top: 0;
    left: -60%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.25),
        transparent);
    transform: skewX(-20deg);
    pointer-events: none;
}
.ak-btn-primary:hover .ak-btn-sweep {
    animation: akSweep 0.9s ease;
}
@keyframes akSweep {
    0%   { left: -60%; }
    100% { left: 130%; }
}
.ak-btn-arrow {
    transition: transform 0.2s ease;
    position: relative;
    z-index: 1;
}
.ak-btn-label { position: relative; z-index: 1; }
.ak-btn-primary:hover .ak-btn-arrow { transform: translateX(3px); }

/* forgot link */
.ak-forgot {
    display: block;
    text-align: center;
    margin: 18px 0 0;
    color: #A8B0C2;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s ease;
}
.ak-forgot:hover { color: #D6FF5E; }

/* legal nav */
.ak-legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 12px;
}
.ak-legal a {
    color: #6B7390;
    text-decoration: none;
    transition: color 0.2s ease;
}
.ak-legal a:hover { color: #D6FF5E; }
.ak-legal span { color: #3A3F52; }

/* RIGHT column — playbook */
.ak-playbook {
    display: flex;
    flex-direction: column;
    padding: 40px 36px;
    background: linear-gradient(180deg, rgba(15, 20, 38, 0.4), rgba(10, 14, 31, 0.55));
    border: 1px solid rgba(198,242,78, 0.10);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.ak-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    font-weight: 600;
    color: #D6FF5E;
    margin: 0 0 12px;
}
.ak-playbook-title {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    color: #FFFFFF;
    margin: 0 0 28px;
    letter-spacing: -0.01em;
}

.ak-steps {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}
.ak-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 16px 18px;
    background: rgba(8, 12, 28, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    position: relative;
    overflow: hidden;
}
.ak-step::before {
    content: "";
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, #D6FF5E, transparent);
    transition: left 0.6s ease;
}
.ak-step:hover {
    transform: translateX(4px);
    border-color: rgba(198,242,78, 0.35);
    background: rgba(12, 17, 36, 0.75);
}
.ak-step:hover::before { left: 100%; }

.ak-step-num {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, #C6F24E, #E4F7A8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    flex-shrink: 0;
    margin-top: 2px;
    min-width: 30px;
}
.ak-step-title {
    font-size: 15px;
    font-weight: 600;
    color: #FFFFFF;
    margin: 0 0 4px;
}
.ak-step-text {
    font-size: 13px;
    line-height: 1.55;
    color: #A8B0C2;
    margin: 0;
}

/* responsive — stack at < 980px */
@media (max-width: 980px) {
    .ak-login-grid {
        grid-template-columns: 1fr;
        max-width: 460px;
        gap: 24px;
    }
    .ak-playbook { padding: 32px 28px; }
    .ak-playbook-title { font-size: 22px; }
}
@media (max-width: 480px) {
    .ak-login-screen { padding: 24px 12px; }
    .ak-card, .ak-playbook { padding: 28px 22px; }
    .ak-title { font-size: 26px; }
}

/* ============================================================
   AK headmark — render-proof brand for all page headers
   Everything visual is inline-styled in partials/brand-mark.php.
   This block only adds optional animation polish.
   ============================================================ */
.ak-headmark { white-space: nowrap; }
.ak-headmark:hover { opacity: 0.92; }
.ak-headmark-halo { animation: akHeadHalo 4s ease-in-out infinite; }
.ak-headmark-pulse {
    transform-origin: 60px 60px;
    animation: akHeadPulse 2.2s ease-in-out infinite;
}
@keyframes akHeadHalo {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50%      { opacity: 0.95; transform: scale(1.08); }
}
@keyframes akHeadPulse {
    0%, 100% { opacity: 0.85; transform: scale(1); }
    50%      { opacity: 0.4;  transform: scale(1.5); }
}
@media (prefers-reduced-motion: reduce) {
    .ak-headmark-halo, .ak-headmark-pulse { animation: none; }
}

/* InsideMaps redesign */
body{font-family:'Hanken Grotesk',system-ui,sans-serif;}
h1,h2,h3,.h1,.h2,.h3,.display,.brand-word{font-family:'Bricolage Grotesque',Georgia,serif;letter-spacing:-.02em;}
.mono,code,kbd{font-family:'JetBrains Mono',ui-monospace,monospace;}
