/* Tesla-inspired Cyberpunk Minimal Design */

:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #141414;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #666666;
    --accent: #00ff41;
    --accent-dim: #00ff4120;
    --border: #1a1a1a;
    --border-bright: #333333;
}

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

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Container */
.container {
    width: 100%;
    max-width: 900px;
    height: 100%;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0;
    overflow: hidden;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.logo svg {
    color: var(--accent);
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: pulse 2s ease-in-out infinite;
}

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

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.welcome-icon {
    margin-bottom: 32px;
    opacity: 0.3;
}

.welcome-icon svg {
    stroke: var(--accent);
}

.welcome h1 {
    font-size: 28px;
    font-weight: 300;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.welcome p {
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

/* Messages */
.messages {
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

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

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 85%;
}

.message.user .message-content {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-bright);
    border-radius: 2px;
    padding: 16px 20px;
}

.message.assistant .message-content {
    background: transparent;
    border-left: 2px solid var(--accent);
    padding: 0 0 0 20px;
}

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

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

/* Markdown Styles */
.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
    color: var(--text-primary);
    font-weight: 500;
    margin: 20px 0 12px 0;
    letter-spacing: 0.5px;
}

.markdown h1 {
    font-size: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.markdown h2 {
    font-size: 18px;
    color: var(--accent);
}

.markdown h3 {
    font-size: 16px;
}

.markdown p {
    margin: 12px 0;
    color: var(--text-primary);
}

.markdown ul,
.markdown ol {
    margin: 12px 0;
    padding-left: 24px;
}

.markdown li {
    margin: 6px 0;
    color: var(--text-primary);
}

.markdown code {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 2px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: var(--accent);
}

.markdown pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
}

.markdown pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
}

.markdown blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    margin: 12px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.markdown a:hover {
    border-bottom-color: var(--accent);
}

.markdown strong {
    color: var(--text-primary);
    font-weight: 600;
}

.markdown table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.markdown th,
.markdown td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.markdown th {
    background: var(--bg-tertiary);
    font-weight: 500;
}

/* Chart */
.chart-box {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
    background: var(--bg-primary);
}

.chart {
    width: 100%;
    height: 400px;
}

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

.typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1.4s infinite ease-in-out;
}

.typing span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Input Container */
.input-container {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 12px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

/* Author Info */
.author-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
}

.author-label {
    color: var(--text-secondary);
    text-transform: uppercase;
}

.author-divider {
    color: var(--border-bright);
}

.author-contact {
    color: var(--accent);
    font-family: 'Monaco', 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s;
    padding: 4px 8px;
    border-radius: 2px;
}

.author-contact:hover {
    background: var(--accent-dim);
    box-shadow: 0 0 8px var(--accent-dim);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 0;
    vertical-align: middle;
}

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

.send-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-bright);
    border-radius: 2px;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background: var(--accent-dim);
    border-color: var(--accent);
}

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

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-bright);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-bright);
    border-radius: 3px;
}

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

/* Responsive */
@media (max-width: 768px) {
    #app {
        padding: 0;
    }

    .container {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    .header {
        padding: 16px 20px;
    }

    .messages {
        padding: 24px 20px;
    }

    .message-content {
        max-width: 90%;
    }

    .input-container {
        padding: 16px 20px;
    }
}

/* Selection */
::selection {
    background: var(--accent-dim);
    color: var(--text-primary);
}

/* Copy Notification Animation */
@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    10%, 90% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}
