/* Futuristic Bold SAS Model Analyzer - Mote Design System */

:root {
    /* Mote Yellow Brand Colors */
    --primary-yellow: #F5C000;
    --primary-yellow-dark: #D4A500;
    --primary-yellow-light: #FFD633;
    --primary-yellow-glow: rgba(245, 192, 0, 0.3);

    /* Dark Futuristic Palette */
    --background-dark: #0A0E1A;
    --background-secondary: #151B2E;
    --background-elevated: #1E2538;
    --surface: #262D42;
    --surface-hover: #303751;

    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: #B8C1D9;
    --text-muted: #6B7489;

    /* Accent Colors */
    --accent-cyan: #00E5FF;
    --accent-purple: #9C27FF;
    --success: #00E676;
    --warning: #FFB300;
    --error: #FF3D00;
    --info: #00B0FF;

    /* Borders */
    --border-subtle: #2A3247;
    --border-bright: #3D4663;

    /* Shadows & Glows */
    --glow-yellow: 0 0 20px rgba(245, 192, 0, 0.4), 0 0 40px rgba(245, 192, 0, 0.2);
    --glow-cyan: 0 0 15px rgba(0, 229, 255, 0.3);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 30px 60px rgba(0, 0, 0, 0.7);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--background-dark) 0%, #1a1f35 100%);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 24px 0;
    background: linear-gradient(90deg, rgba(245, 192, 0, 0.1) 0%, rgba(0, 229, 255, 0.05) 100%);
    border-bottom: 2px solid var(--primary-yellow);
    margin-bottom: 32px;
    backdrop-filter: blur(10px);
    position: relative;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-yellow) 0%, var(--accent-cyan) 100%);
    box-shadow: var(--glow-yellow);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    box-shadow: var(--glow-yellow);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(245, 192, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(245, 192, 0, 0.7), 0 0 50px rgba(245, 192, 0, 0.3);
    }
}

.header-text h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, var(--primary-yellow) 0%, var(--primary-yellow-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px var(--primary-yellow-glow);
    margin-bottom: 4px;
}

.header-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 500;
}

.status-badge {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-bright);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.3s ease;
}

.status-badge.connected {
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.2) 0%, rgba(0, 230, 118, 0.1) 100%);
    color: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow: hidden;
    padding-bottom: 32px;
}

/* Model Selection */
.model-selection {
    background: linear-gradient(135deg, var(--background-secondary) 0%, var(--background-elevated) 100%);
    border-radius: 16px;
    padding: 28px;
    border: 2px solid var(--border-bright);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.model-selection::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-yellow) 0%, var(--accent-cyan) 100%);
}

.model-selection h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--primary-yellow);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.model-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.model-button {
    background: linear-gradient(135deg, var(--surface) 0%, var(--background-elevated) 100%);
    color: var(--text-primary);
    border: 2px solid var(--border-bright);
    border-radius: 12px;
    padding: 24px 28px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-align: left;
    position: relative;
    overflow: hidden;
}

.model-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(245, 192, 0, 0.1), transparent);
    transition: left 0.5s ease;
}

.model-button:hover::before {
    left: 100%;
}

.model-button:hover:not(:disabled) {
    border-color: var(--primary-yellow);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(245, 192, 0, 0.4), var(--shadow-lg);
}

.model-button:active:not(:disabled) {
    transform: translateY(-2px);
}

.model-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

.model-button.consumer {
    border-left: 4px solid var(--primary-yellow);
}

.model-button.consumer:hover:not(:disabled) {
    box-shadow: 0 12px 30px var(--primary-yellow-glow), var(--shadow-lg);
}

.model-button.query {
    border-left: 4px solid var(--accent-cyan);
}

.model-button.query:hover:not(:disabled) {
    border-color: var(--accent-cyan);
    box-shadow: 0 12px 30px rgba(0, 229, 255, 0.3), var(--shadow-lg);
}

.model-description {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Chat Interface */
.chat-container {
    flex: 1;
    background: var(--background-secondary);
    border-radius: 16px;
    border: 2px solid var(--border-bright);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-purple) 0%, var(--accent-cyan) 100%);
}

.chat-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-bright);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--background-elevated);
}

.chat-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-yellow);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.progress-container {
    display: none;
    align-items: center;
    gap: 16px;
}

.progress-container.visible {
    display: flex;
}

.progress-bar {
    width: 240px;
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-bright);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-yellow) 0%, var(--primary-yellow-light) 100%);
    transition: width 0.3s ease;
    width: 0%;
    border-radius: 4px;
    box-shadow: 0 0 10px var(--primary-yellow-glow);
}

.progress-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-yellow);
    min-width: 50px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: var(--background-dark);
    font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--background-dark);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* Log Lines (Terminal Style) */
.log-line {
    font-size: 13px;
    line-height: 2;
    padding: 4px 0;
    animation: fadeIn 0.2s ease;
    display: flex;
    gap: 16px;
    font-family: inherit;
}

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

.log-timestamp {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 12px;
    min-width: 80px;
}

.log-level {
    font-weight: 700;
    flex-shrink: 0;
    min-width: 80px;
    font-size: 12px;
    text-shadow: 0 0 10px currentColor;
}

.log-level.INFO {
    color: var(--info);
}

.log-level.SUCCESS {
    color: var(--success);
}

.log-level.WARNING {
    color: var(--warning);
}

.log-level.ERROR {
    color: var(--error);
}

.log-level.DEBUG {
    color: var(--text-muted);
}

.log-message {
    color: var(--text-secondary);
    flex: 1;
    word-break: break-word;
}

.log-line.error .log-message {
    color: var(--error);
}

.log-line.success .log-message {
    color: var(--success);
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 12px 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    color: var(--primary-yellow);
}

.typing-indicator.visible {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-yellow);
    animation: typing 1.4s infinite;
    box-shadow: 0 0 10px var(--primary-yellow-glow);
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.3);
    }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 80px 40px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Download Section */
.download-section {
    display: none;
    background: linear-gradient(135deg, rgba(0, 230, 118, 0.15) 0%, rgba(0, 230, 118, 0.05) 100%);
    border-radius: 12px;
    border: 2px solid var(--success);
    padding: 20px 28px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.3), var(--shadow-lg);
}

.download-section.visible {
    display: flex;
}

.download-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.download-icon {
    width: 48px;
    height: 48px;
    background: var(--success);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.5);
}

.download-details h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.download-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

.download-button {
    background: linear-gradient(135deg, var(--success) 0%, #00C569 100%);
    color: var(--background-dark);
    border: none;
    border-radius: 10px;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.download-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 230, 118, 0.6);
}

.download-button:active {
    transform: translateY(0);
}

/* Query Section */
.query-section {
    background: linear-gradient(135deg, var(--background-secondary) 0%, var(--background-elevated) 100%);
    border-radius: 16px;
    border: 2px solid var(--accent-cyan);
    padding: 24px 28px;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.2), var(--shadow-lg);
}

.query-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.query-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.close-query-btn {
    background: var(--surface);
    border: 1px solid var(--border-bright);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    line-height: 1;
    transition: all 0.3s ease;
    border-radius: 6px;
}

.close-query-btn:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
    border-color: var(--accent-cyan);
}

.query-input-container {
    display: flex;
    gap: 12px;
}

.query-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--border-bright);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--surface);
    transition: all 0.3s ease;
}

.query-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    background: var(--surface-hover);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
}

.query-input::placeholder {
    color: var(--text-muted);
}

.query-send-btn {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, #00B8D4 100%);
    color: var(--background-dark);
    border: none;
    border-radius: 10px;
    padding: 16px 32px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.query-send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--glow-cyan);
}

.query-send-btn:active:not(:disabled) {
    transform: translateY(0);
}

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

/* Query Result Messages */
.query-message {
    margin: 10px 0;
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
    animation: slideIn 0.4s ease;
    border: 2px solid transparent;
}

.query-message.user {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.15) 0%, rgba(0, 229, 255, 0.05) 100%);
    border-color: var(--accent-cyan);
    color: var(--text-primary);
    margin-left: 60px;
}

.query-message.assistant {
    background: linear-gradient(135deg, rgba(245, 192, 0, 0.15) 0%, rgba(245, 192, 0, 0.05) 100%);
    border-color: var(--primary-yellow);
    color: var(--text-primary);
    margin-right: 60px;
}

.query-message-label {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.query-message-text {
    word-break: break-word;
    line-height: 1.8;
}

/* Markdown Styling in Query Messages */
.query-message-text h1,
.query-message-text h2,
.query-message-text h3 {
    color: var(--primary-yellow);
    font-weight: 700;
    margin: 16px 0 8px 0;
    line-height: 1.3;
}

.query-message-text h1 { font-size: 20px; }
.query-message-text h2 { font-size: 18px; }
.query-message-text h3 { font-size: 16px; }

.query-message-text p {
    margin: 8px 0;
    line-height: 1.8;
}

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

.query-message-text li {
    margin: 6px 0;
    line-height: 1.7;
}

.query-message-text strong {
    font-weight: 700;
    color: var(--primary-yellow-light);
}

.query-message-text code {
    background: var(--surface);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: var(--accent-cyan);
}

.query-message-text pre {
    background: var(--background-dark);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    overflow-x: auto;
}

.query-message-text pre code {
    background: transparent;
    padding: 0;
    color: var(--text-secondary);
}

.query-message-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}

.query-message-text th {
    background: var(--background-elevated);
    color: var(--primary-yellow);
    font-weight: 700;
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid var(--primary-yellow);
}

.query-message-text td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-bright);
}

.query-message-text tr:last-child td {
    border-bottom: none;
}

.query-message-text tr:hover {
    background: var(--surface-hover);
}

.query-message-text blockquote {
    border-left: 4px solid var(--accent-cyan);
    margin: 12px 0;
    padding: 12px 16px;
    background: rgba(0, 229, 255, 0.05);
    font-style: italic;
}

.query-message-text hr {
    border: none;
    border-top: 1px solid var(--border-bright);
    margin: 20px 0;
}

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

.query-message-text a:hover {
    border-bottom-color: var(--accent-cyan);
}

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

/* Responsive */
@media (max-width: 768px) {
    .header-left {
        gap: 12px;
    }

    .logo {
        width: 44px;
        height: 44px;
    }

    .header-text h1 {
        font-size: 20px;
    }

    .header-subtitle {
        font-size: 11px;
    }

    .model-buttons {
        grid-template-columns: 1fr;
    }

    .download-section {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .progress-bar {
        width: 180px;
    }

    .query-message.user {
        margin-left: 20px;
    }

    .query-message.assistant {
        margin-right: 20px;
    }
}
