/* style.css */

/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Candara, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
    height: 100%;
}

/* Theme colors */
:root {
    --bg-main: #202123;
    --bg-panel: #2a2b32;
    --bg-panel-soft: #25262c;
    --bg-card: #262730;
    --bg-input: #15161c;
    --border-soft: #3f414a;
    --border-hard: #14151a;
    --text-primary: #e4e4eb;
    --text-muted: #9ca3af;
    --accent: #22c55e;
    --accent-hover: #16a34a;
    --danger-soft: #3f1e23;
    --danger-border: #f97373;
    --danger-text: #fecaca;
}

/* Password page */

.auth-body {
    background: radial-gradient(circle at top, #262730, var(--bg-main));
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 18px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 28px 24px 24px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
}

.auth-card h1 {
    font-size: 30px;
    line-height: 1.1;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.auth-card p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 16px;
}

.auth-error {
    background: var(--danger-soft);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    margin-bottom: 10px;
}

.auth-input {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    margin-bottom: 12px;
    outline: none;
}

.auth-input:focus {
    border-color: #5b5d68;
}

.auth-input::placeholder {
    color: #6b7280;
}

.auth-button {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 11px 14px;
    background: var(--accent);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.auth-button:hover {
    background: var(--accent-hover);
}

.auth-note {
    color: #7a7f89;
    font-size: 12px;
    margin-top: 10px;
    margin-bottom: 0;
}

/* Main app */

.app-body {
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
}

.app-root {
    display: flex;
    min-height: 100vh;
    height: 100vh;
}

/* Left panel */

.left-panel {
    width: 38%;
    min-width: 320px;
    background: linear-gradient(145deg, #262730, #181920);
    border-right: 1px solid var(--border-hard);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand-block {
    margin-bottom: 4px;
}

.app-logo {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.05;
    margin-bottom: 8px;
}

.input-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.new-chat-button {
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-muted);
    padding: 9px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.new-chat-button:hover {
    background: #2c2d36;
    color: var(--text-primary);
}

.app-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.45;
}

.question-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-label {
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 0.02em;
}

.question-input {
    width: 100%;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.45;
    resize: vertical;
    min-height: 130px;
    outline: none;
}

.question-input:focus {
    border-color: #5b5d68;
}

.question-input::placeholder {
    color: #6b7280;
}

.button-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ask-button {
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #ffffff;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.ask-button:hover:not(:disabled) {
    background: var(--accent-hover);
}

.ask-button:disabled {
    opacity: 0.65;
    cursor: default;
}

.clear-button {
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-muted);
    padding: 9px 14px;
    font-size: 14px;
    cursor: pointer;
}

.clear-button:hover {
    background: #2c2d36;
    color: var(--text-primary);
}

.helper-text {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.footer-note {
    margin-top: auto;
    color: #7a7f89;
    font-size: 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 10px;
}

/* Right panel */

.right-panel {
    width: 62%;
    background: var(--bg-main);
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 10px;
}

.response-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.response-title {
    font-size: 15px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.status-pill {
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-muted);
    background: transparent;
}

.status-ready {
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.08);
}

.status-busy {
    color: #bfdbfe;
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.08);
}

.status-error {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.08);
}

/* Response output — scrollable chat history */

.response-output {
    flex: 1;
    min-height: 0;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: var(--bg-panel);
    padding: 14px 16px;
    font-size: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.placeholder-text {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.55;
}

/* Individual chat entry */

.chat-entry {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-question {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 8px 10px;
    background: rgba(34, 197, 94, 0.07);
    border-left: 2px solid var(--accent);
    border-radius: 4px;
    white-space: pre-wrap;
}

.chat-answer {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    padding: 4px 2px 4px 12px;
}

.chat-divider {
    border: none;
    border-top: 1px solid var(--border-soft);
    margin: 12px 0;
    opacity: 0.5;
}

.chat-thinking {
    color: var(--text-muted);
    font-size: 14px;
    font-style: italic;
    padding: 8px 2px;
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Response footer with save button */

.response-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.save-button {
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: transparent;
    color: var(--text-muted);
    padding: 9px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.save-button:hover {
    background: #2c2d36;
    color: var(--text-primary);
}

.logout-link {
    color: #7a7f89;
    text-decoration: none;
    font-size: 12px;
}

.logout-link:hover {
    color: var(--text-muted);
    text-decoration: underline;
}

@media (max-width: 980px) {
    .app-root {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .left-panel,
    .right-panel {
        width: 100%;
        min-width: 0;
    }

    .left-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-hard);
        padding: 20px;
    }

    .right-panel {
        padding: 16px;
        min-height: 45vh;
    }

    .response-output {
        min-height: 260px;
    }

    .app-logo {
        font-size: 26px;
    }
}