@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --user-bubble: #eff6ff;
    --assistant-bubble: #ffffff;
    --border: #e2e8f0;
    --error: #ef4444;
    
    /* Default Mode Theme (Ask) */
    --theme-primary: #2563eb;
    --theme-primary-hover: #1d4ed8;
    --theme-bg-light: #eff6ff;
    --theme-border-light: #bfdbfe;
    --theme-text-dark: #1e40af;
}

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

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Full-viewport pages — only one visible at a time */
.screen {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    background: var(--bg);
    overflow: hidden;
    z-index: 1;
}

.screen.screen--active {
    display: flex;
}

.screen:not(.screen--chat) {
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.screen-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 28px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.03);
}

.step-label {
    margin: 0 0 12px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

.screen-card h1 {
    margin: 0;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.screen-subtitle {
    margin: 8px 0 24px;
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.screen-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.screen-form label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.screen-form input,
.screen-form select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 12px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    width: 100%;
    transition: all 0.2s ease;
}

.screen-form input:focus,
.screen-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.screen-form button[type="submit"] {
    margin-top: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.screen-form button[type="submit"]:hover:not(:disabled) {
    background: var(--accent-hover);
}

.screen-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.text-btn {
    display: block;
    width: 100%;
    margin-top: 20px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 8px;
    font-family: inherit;
    transition: color 0.15s ease;
}

.text-btn:hover {
    color: var(--text);
}

/* Chat Screen Wrapper */
.screen--chat {
    max-width: 720px;
    margin: 0 auto;
    left: 0;
    right: 0;
    padding: 16px;
    transition: max-width 0.3s ease, padding 0.3s ease;
}

/* Wide/Expanded Layout */
.screen--chat.chat-expanded {
    max-width: 1280px;
}

/* Session Info/Controls Top Bar */
.top-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-label {
    font-weight: 600;
    color: var(--text);
}

.session-divider {
    opacity: 0.5;
}

.session-subtitle {
    font-weight: 400;
}

.nav-actions {
    display: flex;
    gap: 12px;
}

.nav-action-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.nav-action-btn:hover {
    color: var(--text);
}

/* Main Chat Container Panel */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02), 0 4px 6px -1px rgba(0,0,0,0.03);
}

/* Chat Header */
.chat-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
}

.chat-title {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--theme-primary);
    transition: color 0.25s ease;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.clear-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.icon-btn:hover {
    background: #f1f5f9;
    color: var(--text);
}

/* Chat Messages Box */
.messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: #f8fafc;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 0.92rem;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.01);
    transition: all 0.25s ease;
}

.message.user {
    align-self: flex-end;
    background: var(--theme-bg-light);
    border: 1px solid var(--theme-border-light);
    color: var(--text);
    border-bottom-right-radius: 2px;
}

.message.assistant {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--text);
    border-bottom-left-radius: 2px;
}

.message.loading {
    color: var(--muted);
    font-style: italic;
}

/* Confirm Action Cards */
.confirm-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.confirm-actions button {
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--theme-primary);
    color: #fff;
    transition: all 0.15s ease;
}

.confirm-actions button:hover {
    opacity: 0.9;
}

.confirm-actions button.secondary {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: var(--text);
}

.confirm-actions button.secondary:hover {
    background: #f8fafc;
}

/* Input Area styling (matches screenshots) */
.chat-input-container {
    margin: 16px 20px 20px;
    background: var(--theme-bg-light);
    border: 1px solid var(--theme-border-light);
    border-radius: 16px;
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02), 0 2px 8px rgba(0, 0, 0, 0.01);
}

.chat-input-container:focus-within {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px var(--theme-border-light);
}

.chat-input-container textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 4px 0 12px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    resize: none;
    line-height: 1.5;
}

.chat-input-container textarea::placeholder {
    color: var(--muted);
    opacity: 0.75;
}

.input-divider {
    height: 1px;
    background: var(--theme-border-light);
    opacity: 0.4;
    margin: 0 -16px 10px;
    transition: background-color 0.25s ease;
}

.input-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Custom Dropdown Selector Wrapper */
.mode-selector-wrapper {
    position: relative;
}

.mode-select-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid var(--theme-border-light);
    color: var(--theme-primary);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.mode-select-btn:hover {
    background: var(--theme-bg-light);
    border-color: var(--theme-primary);
}

.mode-select-btn svg {
    display: inline-block;
    vertical-align: middle;
}

.mode-select-btn .chevron-icon {
    color: var(--theme-primary);
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.mode-selector-wrapper.active .chevron-icon {
    transform: rotate(180deg);
}

.mode-dropdown-list {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 130px;
    z-index: 100;
    animation: slideUp 0.15s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mode-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mode-dropdown-item[data-mode="ask"] {
    color: #2563eb;
}
.mode-dropdown-item[data-mode="ask"]:hover {
    background: #eff6ff;
}

.mode-dropdown-item[data-mode="report"] {
    color: #7c3aed;
}
.mode-dropdown-item[data-mode="report"]:hover {
    background: #f5f3ff;
}

.mode-dropdown-item[data-mode="action"] {
    color: #0d9488;
}
.mode-dropdown-item[data-mode="action"]:hover {
    background: #f0fdfa;
}

/* Circle Send Button (matches screenshots) */
.send-circle-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--theme-primary);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.send-circle-btn:hover:not(:disabled) {
    background: var(--theme-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.send-circle-btn:active:not(:disabled) {
    transform: translateY(0);
}

.send-circle-btn:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

/* Theme modifier selectors for app styling changes */
#app.theme-ask {
    --theme-primary: #2563eb;
    --theme-primary-hover: #1d4ed8;
    --theme-bg-light: #eff6ff;
    --theme-border-light: #bfdbfe;
    --theme-text-dark: #1e40af;
}

#app.theme-report {
    --theme-primary: #7c3aed;
    --theme-primary-hover: #6d28d9;
    --theme-bg-light: #f5f3ff;
    --theme-border-light: #ddd6fe;
    --theme-text-dark: #5b21b6;
}

#app.theme-action {
    --theme-primary: #0d9488;
    --theme-primary-hover: #0f766e;
    --theme-bg-light: #f0fdfa;
    --theme-border-light: #99f6e4;
    --theme-text-dark: #065f46;
}

/* Floating button to restore chat if collapsed */
.floating-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--theme-primary);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.floating-chat-toggle:active {
    transform: scale(0.95);
}

/* Custom Header Buttons */
/* Custom Header Buttons */
.search-btn-dummy {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.search-btn-dummy:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.branch-selector-wrapper {
    position: relative;
}

.branch-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #2563eb; /* active blue text */
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.branch-dropdown-btn:hover {
    background: #f8fafc;
    border-color: #3b82f6;
}

.branch-dropdown-btn .git-branch-icon {
    color: #2563eb;
}

.branch-dropdown-btn .chevron-icon {
    color: #2563eb;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.branch-selector-wrapper.active .chevron-icon {
    transform: rotate(180deg);
}

.branch-dropdown-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
    z-index: 100;
    animation: slideDown 0.15s ease-out;
}

.branch-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: #475569;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.branch-dropdown-item:hover {
    background: #eff6ff;
    color: #2563eb;
}

.branch-dropdown-item.selected {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #cbd5e1; /* light grey/blue border matching reference screenshot */
    color: #ef4444; /* solid red icon */
    border-radius: 8px;
    padding: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.logout-btn:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626; /* darker red icon */
}

/* Utilities */
.error {
    margin: 8px 16px;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid var(--error);
    border-radius: 8px;
    color: var(--error);
    font-size: 0.85rem;
    font-weight: 500;
}

.hidden {
    display: none !important;
}
