/* 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);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Model Selector */
.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-bright);
    border-radius: 2px;
}

.model-selector svg {
    color: var(--accent);
    flex-shrink: 0;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-left: 12px;
    background: transparent;
    border: 1px solid var(--border-bright);
    border-radius: 2px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.model-select {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
}

.model-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.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 20px;
}

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

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

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

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

.guide-section {
    width: 100%;
    max-width: 700px;
    margin-bottom: 24px;
}

.example-queries {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.example-btn {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.welcome-footer {
    margin-top: 20px;
}

.welcome-footer p {
    font-size: 13px;
    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);
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-bright);
    border-radius: 2px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.action-btn svg {
    flex-shrink: 0;
}

/* Streaming Indicator */
.streaming-indicator {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 12px;
    padding: 8px 0;
}

.streaming-indicator .dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out;
}

.streaming-indicator .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.streaming-indicator .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes pulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Share Image Container (hidden, used for rendering) */
.share-image-container {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 800px;
    background: var(--bg-secondary);
    padding: 40px;
    border: 1px solid var(--border);
}

.share-image-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.share-image-logo {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.share-image-content {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.8;
    border-left: 2px solid var(--accent);
    padding-left: 20px;
}

.share-image-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 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);
}

/* Footer Info */
.footer-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;
}

.copyright {
    color: var(--text-secondary);
}

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

.contact-link {
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}

.contact-link: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);
    }
}

/* Image Modal */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.modal-close-btn {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-bright);
    border-radius: 2px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.modal-image {
    max-width: 100%;
    max-height: calc(90vh - 80px);
    border: 1px solid var(--border);
    border-radius: 2px;
    box-shadow: 0 8px 32px rgba(0, 255, 65, 0.1);
}

.modal-hint {
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 2px;
}

/* Contact Modal */
.contact-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.contact-modal-content {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 255, 65, 0.15);
}

.contact-modal-content .modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.contact-modal-content .modal-close-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.contact-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 24px 0;
    text-align: center;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
}

.contact-item svg {
    color: var(--accent);
    flex-shrink: 0;
}

.contact-item strong {
    color: var(--accent);
    font-family: 'Monaco', 'Courier New', monospace;
    font-weight: 600;
}

.copy-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
    box-shadow: 0 0 12px var(--accent-dim);
}

.copy-btn svg {
    flex-shrink: 0;
}

.contact-hint {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 12px;
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
