/* Novawood AI Assistant — Brand-aligned design */
:root {
    --nw-dark: #1A1A1A;
    --nw-green: #2D5016;
    --nw-green-light: #3D6B20;
    --nw-gold: #B8960C;
    --nw-gold-light: #D4AF37;
    --nw-bg: #F7F6F3;
    --nw-surface: #FFFFFF;
    --nw-surface-alt: #F0EFEB;
    --nw-text: #1A1A1A;
    --nw-text-secondary: #6B6B6B;
    --nw-border: #E5E3DD;
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--nw-bg);
    color: var(--nw-text);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 920px;
    margin: 0 auto;
    background: var(--nw-surface);
    box-shadow: 0 0 40px rgba(0,0,0,0.06);
}

/* === HEADER === */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--nw-dark);
    color: white;
    flex-shrink: 0;
}

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

.header-logo {
    height: 30px;
    width: auto;
}

.app-header h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.app-header .subtitle {
    font-size: 11px;
    color: var(--nw-gold-light);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255,255,255,0.2);
    background: transparent;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}

.icon-btn:hover { background: rgba(255,255,255,0.1); }

/* === CHAT CONTAINER === */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* === WELCOME === */
.welcome-message {
    text-align: center;
    padding: 48px 20px 32px;
}

.welcome-logo {
    width: 90%;
    max-width: 300px;
    height: auto;
    margin-bottom: 20px;
}

.welcome-message h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--nw-dark);
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.welcome-message > p {
    color: var(--nw-text-secondary);
    max-width: 480px;
    margin: 0 auto 28px;
    line-height: 1.6;
    font-size: 14px;
}

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 560px;
    margin: 0 auto;
}

.quick-btn {
    padding: 9px 16px;
    background: var(--nw-surface);
    border: 1px solid var(--nw-border);
    border-radius: 20px;
    color: var(--nw-text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-weight: 500;
}

.quick-btn:hover {
    background: var(--nw-dark);
    color: white;
    border-color: var(--nw-dark);
    transform: translateY(-1px);
}

/* === MESSAGES === */
.message {
    display: flex;
    gap: 12px;
    max-width: 88%;
    animation: fadeIn 0.3s ease;
}

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

.message.user { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message.assistant .message-avatar {
    background: var(--nw-surface-alt);
}
.message.assistant .message-avatar img {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.message.user .message-avatar {
    background: var(--nw-dark);
    color: white;
    font-size: 13px;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: var(--radius);
    line-height: 1.65;
    font-size: 14px;
}

.message.assistant .message-bubble {
    background: var(--nw-surface-alt);
    border: 1px solid var(--nw-border);
    border-bottom-left-radius: 4px;
}

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

/* Message content styling */
.message-bubble h2 { font-size: 17px; margin: 16px 0 8px; color: var(--nw-dark); }
.message-bubble h3 { font-size: 15px; margin: 14px 0 6px; color: var(--nw-green); }
.message-bubble h4 { font-size: 14px; margin: 12px 0 4px; color: var(--nw-text); }
.message-bubble h5 { font-size: 13px; margin: 10px 0 4px; }
.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble strong { font-weight: 600; }
.message-bubble em { font-style: italic; }
.message-bubble hr { border: none; border-top: 1px solid var(--nw-border); margin: 12px 0; }
.message-bubble ul, .message-bubble ol { margin-left: 18px; margin-bottom: 8px; }
.message-bubble li { margin-bottom: 4px; }
.message-bubble code {
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}
.message-bubble a {
    color: var(--nw-green);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.message-bubble a:hover { color: var(--nw-green-light); }

/* Tables */
.message-bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
    font-size: 13px;
}
.message-bubble th {
    background: var(--nw-dark);
    color: white;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.message-bubble td {
    border: 1px solid var(--nw-border);
    padding: 7px 12px;
}
.message-bubble tr:nth-child(even) td {
    background: rgba(0,0,0,0.02);
}

/* Message actions (PDF download, follow-ups) */
.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 5px 12px;
    background: var(--nw-surface);
    border: 1px solid var(--nw-border);
    border-radius: 16px;
    font-size: 12px;
    color: var(--nw-text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn:hover {
    border-color: var(--nw-dark);
    color: var(--nw-dark);
}

.action-btn.followup {
    background: transparent;
    border-color: var(--nw-green);
    color: var(--nw-green);
}

.action-btn.followup:hover {
    background: var(--nw-green);
    color: white;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: var(--nw-gold);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

@keyframes typing {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

/* === INPUT === */
.input-container {
    padding: 14px 24px 12px;
    border-top: 1px solid var(--nw-border);
    background: var(--nw-surface);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    background: var(--nw-surface-alt);
    border: 1px solid var(--nw-border);
    border-radius: var(--radius);
    padding: 6px 10px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--nw-dark);
    box-shadow: 0 0 0 3px rgba(26,26,26,0.06);
}

#userInput {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 6px 4px;
}

.mic-btn {
    color: var(--nw-text-secondary);
    border: none;
    background: transparent;
    width: 34px;
    height: 34px;
}

.mic-btn:hover { color: var(--nw-dark); background: transparent; }

.mic-btn.recording {
    color: #E53E3E;
    animation: pulse-mic 1.5s infinite;
}

@keyframes pulse-mic {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

#sendBtn, #stopBtn {
    width: 34px;
    height: 34px;
    border: none;
    background: var(--nw-dark);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#sendBtn:hover { background: var(--nw-green); }
#sendBtn:disabled { opacity: 0.4; cursor: not-allowed; }

#stopBtn {
    background: #E53E3E;
}
#stopBtn:hover { background: #C53030; }

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding: 0 4px;
}

.disclaimer {
    font-size: 11px;
    color: var(--nw-text-secondary);
}

.powered-by {
    font-size: 11px;
    color: var(--nw-text-secondary);
}

.powered-by strong {
    color: var(--nw-gold);
    font-weight: 600;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .app-container { max-width: 100%; }
    .chat-container { padding: 16px; }
    .message { max-width: 94%; }
    .quick-questions { gap: 6px; }
    .quick-btn { font-size: 12px; padding: 7px 12px; }
    .welcome-message { padding: 32px 16px 24px; }
    .input-footer { flex-direction: column; gap: 2px; align-items: center; }
}
