/* Spring AgaaS Chat UI — Dark navy, light blue, yellow */

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

:root {
    --navy:       #0a0f1e;
    --navy-mid:   #111827;
    --navy-light: #1e2a3a;
    --navy-border:#1f3050;
    --blue:       #3b82f6;
    --blue-light: #60a5fa;
    --yellow:     #fbbf24;
    --yellow-dim: #f59e0b;
    --text:       #e2e8f0;
    --text-dim:   #94a3b8;
    --white:      #ffffff;
}

body {
    display: flex;
    height: 100vh;
    background: var(--navy);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
    width: 260px;
    background: var(--navy-mid);
    border-right: 1px solid var(--navy-border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
}

.sidebar-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--navy-border);
}

.logo {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
}

.logo-spring {
    color: var(--yellow);
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.logo-agaas {
    color: var(--blue-light);
    margin-left: 4px;
    text-shadow: 0 0 20px rgba(96, 165, 250, 0.4);
}

.logo-tagline {
    font-size: 12px;
    color: var(--blue-light);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.7;
}

.new-chat-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--navy-light);
    border: 1px solid var(--navy-border);
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

.sidebar-footer {
    margin-top: auto;
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
}

/* ── Main ── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 16px 28px;
    border-bottom: 1px solid var(--navy-border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--navy-mid);
}

.chat-header h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, var(--yellow), var(--blue-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
    margin-left: auto;
    box-shadow: 0 0 6px #22c55e;
}

.status-text {
    font-size: 12px;
    color: #22c55e;
}

/* ── Messages ── */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--navy-border); border-radius: 4px; }

/* Welcome screen */
.welcome {
    text-align: center;
    margin: auto;
    max-width: 480px;
}

.welcome-icon {
    font-size: 72px;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.7));
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.7)); }
    50%       { filter: drop-shadow(0 0 28px rgba(96, 165, 250, 0.9)); }
}

.welcome h3 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    background: linear-gradient(90deg, var(--yellow), var(--blue-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.welcome p {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Agent cards */
.agent-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.agent-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--navy-light);
    border: 1px solid var(--navy-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.agent-card:hover {
    border-color: var(--yellow);
    background: rgba(251, 191, 36, 0.05);
    transform: translateY(-1px);
}

.agent-card-icon {
    font-size: 26px;
    flex-shrink: 0;
}

.agent-card-body {
    flex: 1;
}

.agent-card-body h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--yellow);
    margin-bottom: 3px;
}

.agent-card-body p {
    font-size: 12px;
    color: var(--text-dim);
    margin: 0;
}

.agent-card-arrow {
    font-size: 18px;
    color: var(--text-dim);
    transition: color 0.2s;
}

.agent-card:hover .agent-card-arrow {
    color: var(--yellow);
}

.or-divider {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 16px 0 10px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--navy-mid);
    border: 1px solid var(--navy-border);
    border-radius: 14px;
    padding: 28px;
    width: 560px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(90deg, var(--yellow), var(--blue-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--white); }

.modal-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0;
}

.modal textarea {
    background: var(--navy-light);
    border: 1px solid var(--navy-border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-family: 'Courier New', monospace;
    padding: 12px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.5;
}

.modal textarea:focus { border-color: var(--blue); }

.modal-submit {
    padding: 12px 20px;
    background: var(--yellow);
    color: var(--navy);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    align-self: flex-end;
}

.modal-submit:hover { background: var(--yellow-dim); }

.suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggestions button {
    padding: 10px 16px;
    background: var(--navy-light);
    border: 1px solid var(--navy-border);
    color: var(--text-dim);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: all 0.2s;
}

.suggestions button:hover {
    border-color: var(--blue);
    color: var(--blue-light);
}

/* Message bubbles */
.message {
    display: flex;
    gap: 12px;
    max-width: 820px;
    width: 100%;
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    font-weight: 700;
}

.message.user .avatar {
    background: var(--yellow);
    color: var(--navy);
}

.message.assistant .avatar {
    background: var(--blue);
    color: var(--white);
}

.bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
    max-width: calc(100% - 48px);
}

.message.user .bubble {
    background: var(--blue);
    color: var(--white);
    border-top-right-radius: 4px;
}

.message.assistant .bubble {
    background: var(--navy-light);
    color: var(--text);
    border-top-left-radius: 4px;
    border: 1px solid var(--navy-border);
}

/* Markdown inside bubbles */
.bubble h1, .bubble h2, .bubble h3 {
    color: var(--blue-light);
    margin: 12px 0 6px;
    font-size: 15px;
}

.bubble code {
    background: var(--navy);
    color: var(--yellow);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.bubble pre {
    background: var(--navy);
    border: 1px solid var(--navy-border);
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    margin: 10px 0;
}

.bubble pre code {
    background: none;
    padding: 0;
    color: var(--text);
}

.bubble ul, .bubble ol {
    padding-left: 20px;
    margin: 6px 0;
}

.bubble li { margin: 4px 0; }

.bubble strong { color: var(--yellow); }

.bubble p { margin: 6px 0; }

/* Typing indicator */
.typing .bubble {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 16px;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--blue-light);
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Input area ── */
.input-area {
    padding: 16px 28px 20px;
    border-top: 1px solid var(--navy-border);
    background: var(--navy-mid);
}

.input-box {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--navy-light);
    border: 1px solid var(--navy-border);
    border-radius: 12px;
    padding: 10px 10px 10px 16px;
    transition: border-color 0.2s;
}

.input-box:focus-within {
    border-color: var(--blue);
}

textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 160px;
    font-family: inherit;
}

textarea::placeholder { color: var(--text-dim); }

#send-btn {
    width: 36px;
    height: 36px;
    background: var(--blue);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    transition: background 0.2s;
}

#send-btn:hover { background: var(--blue-light); }
#send-btn:disabled { background: var(--navy-border); cursor: not-allowed; }

.input-hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 8px;
    text-align: center;
}
