:root {
    --primary-color: #3182f6;
    --primary-hover: #1b64da;
    --bg-color: #f2f4f6;
    --surface-color: #ffffff;
    --text-main: #191f28;
    --text-sub: #4e5968;
    --text-muted: #8b95a1;
    --border-color: #e5e8eb;
    --ai-bubble: #ffffff;
    --user-bubble: #3182f6;
    --user-text: #ffffff;
    --shadow: 0 12px 36px rgba(25, 31, 40, 0.08);
}

[data-theme='dark'] {
    --bg-color: #1a1c1e;
    --surface-color: #2c2e33;
    --text-main: #f9fafb;
    --text-sub: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #3f444d;
    --ai-bubble: #3f444d;
    --shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.app-container {
    width: 600px;
    height: 900px;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    background: var(--bg-color);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Loading Spinner */
.loading-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}
.dot-item {
    width: 6px; height: 6px; background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.dot-item:nth-child(1) { animation-delay: -0.32s; }
.dot-item:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.result-card .unit-info {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.market-prices {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.market-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-sub);
}

.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}

.chat-header {
    padding: 16px 24px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.header-info h1 { font-size: 18px; margin-bottom: 2px; }
.status-badge { font-size: 12px; color: #2eb44b; font-weight: 600; display: flex; align-items: center; }
.dot { width: 6px; height: 6px; background: #2eb44b; border-radius: 50%; margin-right: 6px; }

.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message { display: flex; flex-direction: column; max-width: 85%; }
.message.ai { align-self: flex-start; }
.message.user { align-self: flex-end; }

.bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.ai .bubble {
    background: var(--ai-bubble);
    color: var(--text-main);
    border-top-left-radius: 4px;
    border: 1px solid var(--border-color);
}

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

/* Options / Action Chips */
.quick-actions {
    padding: 12px 24px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: transparent;
}

.chip {
    padding: 10px 18px;
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: var(--primary-color);
    color: white;
}

/* Result Card in Chat */
.result-card {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 24px;
    border: 2px solid var(--primary-color);
    margin: 8px 0;
    width: 100%;
}

.result-card h4 { font-size: 14px; color: var(--text-sub); margin-bottom: 8px; }
.result-amount { font-size: 28px; font-weight: 800; color: var(--primary-color); margin-bottom: 16px; }
.result-detail { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; color: var(--text-sub); }

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 100;
}

.modal-content {
    background: var(--surface-color);
    width: 100%;
    max-width: 600px;
    height: 70%;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.modal-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.close-btn { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    padding: 12px 16px;
    border-radius: 12px;
    gap: 12px;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 16px;
    outline: none;
}

.modal-search-results {
    flex: 1;
    overflow-y: auto;
    margin-top: 16px;
}

.modal-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.modal-item:hover { background: var(--bg-color); }

.chat-input-area { padding: 16px 24px 32px; background: var(--bg-color); }
.input-wrapper { display: flex; background: var(--surface-color); padding: 8px; border-radius: 16px; gap: 12px; border: 1px solid var(--border-color); }
.input-wrapper input { flex: 1; background: transparent; border: none; padding: 8px 12px; font-size: 15px; }
.input-wrapper input:focus { outline: none; }
.icon-btn.send { background: var(--primary-color); color: white; border: none; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }

@media (max-width: 600px) {
    .app-container { width: 100vw; height: 100vh; box-shadow: none; }
}
