/* TEA WASM LLM Demo Styles - One Dark Theme */

:root {
    /* One Dark color palette */
    --bg-color: #282c34;
    --bg-lighter: #2c323c;
    --bg-highlight: #3e4451;
    --card-bg: #21252b;
    --text-color: #abb2bf;
    --text-muted: #5c6370;
    --text-bright: #e6e6e6;
    --primary-color: #61afef;
    --primary-dark: #528bcc;
    --success-color: #98c379;
    --warning-color: #e5c07b;
    --danger-color: #e06c75;
    --purple-color: #c678dd;
    --cyan-color: #56b6c2;
    --border-color: #3a3f4b;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

#app {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 1.5rem 0;
    position: relative;
}

header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    color: var(--text-bright);
}

header .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.github-link {
    position: absolute;
    top: 1rem;
    right: 0;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.github-link:hover {
    text-decoration: underline;
    color: var(--cyan-color);
}

/* Status Bar */
#status-bar {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

#status-bar span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.status-ready { color: var(--success-color); font-weight: 500; }
.status-loading { color: var(--warning-color); }
.status-error { color: var(--danger-color); }

/* Example Selector */
.example-selector-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.example-selector-container label {
    color: var(--text-bright);
    font-weight: 500;
    white-space: nowrap;
}

#example-selector {
    padding: 0.5rem 1rem;
    background: var(--bg-highlight);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 200px;
}

#example-selector:hover {
    border-color: var(--primary-color);
}

#example-selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(97, 175, 239, 0.2);
}

.example-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    flex: 1;
}

.llm-badge {
    background: var(--warning-color);
    color: var(--bg-color);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Progress Bar */
#progress-container {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

#progress-container.hidden {
    display: none;
}

#progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-highlight);
    border-radius: 4px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--cyan-color));
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 50px;
    text-align: right;
}

/* Main Content */
main {
    flex: 1;
    background: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

/* YAML Container */
.yaml-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 600px) {
    .yaml-container {
        grid-template-columns: 2fr 1fr;
    }
}

.yaml-editor label,
.yaml-state label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--purple-color);
}

#run-yaml-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: var(--bg-color);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#run-yaml-btn:hover:not(:disabled) {
    background: var(--cyan-color);
    transform: translateY(-1px);
}

#run-yaml-btn:disabled {
    background: var(--bg-highlight);
    color: var(--text-muted);
    cursor: not-allowed;
}

#yaml-output {
    margin-top: 1rem;
}

#yaml-output.hidden {
    display: none;
}

#yaml-output h3 {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--success-color);
}

/* Footer */
footer {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    flex-wrap: wrap;
}

footer button {
    padding: 0.5rem 1rem;
    background: var(--bg-highlight);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-color);
    transition: all 0.2s ease;
}

footer button:hover {
    background: var(--bg-lighter);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

#version {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Graph Panel */
.collapsible-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    background: var(--bg-highlight);
    transition: background 0.2s;
    user-select: none;
}

.panel-header:hover {
    background: var(--bg-lighter);
}

.panel-icon {
    font-size: 0.8rem;
    transition: transform 0.2s;
    color: var(--text-muted);
}

.collapsible-panel.expanded .panel-icon {
    transform: rotate(90deg);
}

.panel-title {
    font-weight: 500;
    color: var(--text-bright);
}

.panel-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.collapsible-panel.expanded .panel-content {
    max-height: 500px;
    overflow-y: auto;
}

#mermaid-container {
    padding: 1rem;
    display: flex;
    justify-content: center;
    background: var(--bg-color);
    min-height: 100px;
}

#mermaid-container svg {
    max-width: 100%;
    height: auto;
}

.error-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--warning-color);
}

.error-icon {
    font-size: 1.2rem;
}

.status-badge {
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.success {
    color: var(--success-color);
}

.status-badge.error {
    color: var(--danger-color);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    #app {
        padding: 0.5rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    #status-bar {
        font-size: 0.75rem;
    }
}
