/* ARA - ChatGPT-style Layout */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f9f9f9;
    --bg-user: #f7f7f8;
    --text-primary: #343541;
    --text-secondary: #6e6e80;
    --text-tertiary: #8e8ea0;
    --accent: #10a37f;
    --accent-hover: #0d8c6d;
    --border: #e5e5e5;
    --border-light: #d9d9e3;
    --shadow: 0 0 15px rgba(0,0,0,0.05);
    --success: #19c37d;
    --warning: #f59e0b;
    --danger: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.6;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
    flex-shrink: 0;
    height: 52px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.logo-icon {
    color: var(--accent);
    font-size: 18px;
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
}

.btn-new-chat {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

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

/* Chat Area */
.chat-area {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
}

/* Welcome */
.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    text-align: center;
    gap: 20px;
    padding: 40px 20px;
}

.welcome-icon {
    font-size: 40px;
    color: var(--accent);
    margin-bottom: 4px;
}

.welcome h1 {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
}

.welcome p {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 400px;
}

.welcome-hints {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 560px;
    width: 100%;
    margin-top: 8px;
}

.hint-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hint-card:hover {
    background: var(--bg-user);
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}

.hint-type {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hint-card span:last-child {
    font-size: 14px;
    color: var(--text-primary);
}

/* Messages - ChatGPT style */
.messages {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message {
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    border-bottom: 1px solid transparent;
}

.message.user {
    background: var(--bg-user);
}

.message.assistant {
    background: var(--bg-primary);
}

.message-inner {
    max-width: 768px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 16px;
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

.message.user .message-avatar {
    background: var(--accent);
    color: white;
    order: 2;
}

.message.assistant .message-avatar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--accent);
    order: 0;
}

.message-body {
    flex: 1;
    min-width: 0;
}

.message.user .message-body {
    order: 1;
    text-align: right;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 6px;
}

.message.user .message-header {
    justify-content: flex-end;
}

.message-role {
    font-weight: 600;
    color: var(--text-secondary);
}

.message-meta {
    display: flex;
    gap: 6px;
}

.message-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.badge-intent {
    background: rgba(16, 163, 127, 0.1);
    color: var(--accent);
    border: 1px solid rgba(16, 163, 127, 0.2);
}

.badge-depth {
    background: rgba(25, 195, 125, 0.1);
    color: var(--success);
    border: 1px solid rgba(25, 195, 125, 0.2);
}

.message-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    word-wrap: break-word;
}

.message.user .message-content {
    color: var(--text-primary);
}

.message-content strong {
    color: var(--accent);
    display: block;
    margin-top: 16px;
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: 600;
}

.message-content ol,
.message-content ul {
    padding-left: 24px;
    margin: 8px 0;
}

.message-content li {
    margin: 4px 0;
}

/* Action Buttons */
.message-actions {
    display: flex;
    gap: 8px;
    padding: 12px 0 0;
    flex-wrap: wrap;
    max-width: 768px;
    margin: 0 auto;
    padding-left: 46px;
    padding-right: 20px;
}

.message.user + .message-actions {
    padding-left: 20px;
    padding-right: 46px;
    justify-content: flex-end;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-action:hover:not(:disabled) {
    border-color: var(--border-light);
    background: var(--bg-user);
    color: var(--text-primary);
}

.btn-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-action .action-icon { font-size: 13px; line-height: 1; }

.btn-action.level-2 { border-color: rgba(245,158,11,0.3); color: #d97706; }
.btn-action.level-2:hover:not(:disabled) { background: rgba(245,158,11,0.05); border-color: rgba(245,158,11,0.5); }
.btn-action.level-3 { border-color: rgba(239,68,68,0.3); color: #dc2626; }
.btn-action.level-3:hover:not(:disabled) { background: rgba(239,68,68,0.05); border-color: rgba(239,68,68,0.5); }

/* Typing Indicator */
.typing {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Depth Bar */
.depth-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    font-size: 12px;
    flex-shrink: 0;
}

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

.depth-label {
    font-weight: 600;
    color: var(--accent);
}

.depth-desc {
    color: var(--text-tertiary);
}

.depth-levels {
    display: flex;
    gap: 6px;
}

.depth-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-light);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.depth-dot.passed {
    background: var(--accent);
    border-color: var(--accent);
}

.depth-dot.active {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 0 6px rgba(16, 163, 127, 0.3);
}

.depth-meta {
    display: flex;
    gap: 10px;
    color: var(--text-tertiary);
}

/* Input Area */
.input-area {
    padding: 12px 20px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.input-container {
    display: flex;
    gap: 10px;
    max-width: 768px;
    margin: 0 auto;
    align-items: flex-end;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: var(--shadow);
}

.input-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.1);
}

.input-container textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    outline: none;
    max-height: 120px;
    font-family: inherit;
    min-height: 24px;
}

.input-container textarea::placeholder {
    color: var(--text-tertiary);
}

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

.btn-send:hover {
    background: var(--accent-hover);
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.input-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 10px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-hints {
        grid-template-columns: 1fr;
    }
    .welcome h1 {
        font-size: 24px;
    }
    .message-inner {
        padding: 0 12px;
    }
    .message-actions {
        padding-left: 38px;
        padding-right: 12px;
    }
}
