/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    text-align: center;
    color: white;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-toggle {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.lang-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-toggle.active {
    background: rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

.lang-separator {
    opacity: 0.7;
    font-size: 0.9rem;
}

.github-badge img {
    height: 20px;
    transition: transform 0.3s ease;
}

.github-badge img:hover {
    transform: scale(1.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Language toggle functionality */
.lang-cn {
    display: none;
}

body.lang-chinese .lang-cn {
    display: inline;
}

body.lang-chinese .lang-en {
    display: none;
}

/* Main content */
main {
    padding: 2rem 0;
}

.demo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Panels */
.panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.panel:hover {
    transform: translateY(-5px);
}

.panel-header {
    background: #f8f9fa;
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.panel-header h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.panel-header p {
    color: #6c757d;
    font-size: 0.9rem;
}

.streaming-container {
    padding: 1.5rem;
    min-height: 300px;
    position: relative;
}

/* UI Display - Main App Mockup */
.ui-display {
    margin-bottom: 1rem;
}

.mock-app {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    min-height: 300px;
}

.app-header {
    background: #f8f9fa;
    padding: 1rem;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.1rem;
}

.todo-list {
    padding: 1rem;
    min-height: 200px;
}

.todo-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
    min-height: 56px;
}

.todo-item.appear {
    opacity: 1;
    transform: translateY(0);
}

.todo-item.updating {
    background: #fff3cd;
    border-color: #ffeaa7;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.25);
}

.todo-item.completed-item {
    background: #d4edda;
    border-color: #c3e6cb;
}

.todo-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #6c757d;
    border-radius: 3px;
    background: #fff;
}

.todo-text {
    flex: 1;
    color: #495057;
    font-size: 0.95rem;
}

.todo-status {
    font-size: 1.2rem;
}

/* Parse error styling */
.parse-error {
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    color: #721c24;
    font-size: 0.9rem;
}

.parse-error-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #a94442;
}


/* Loading States */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: #6c757d;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Simple Status Indicator */
.simple-status {
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

#status-text {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

/* Technical Details (Collapsible) */
.tech-details {
    margin: 1rem 0;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.tech-details summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    font-size: 0.85rem;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.tech-details summary:hover {
    background: #e9ecef;
}

.tech-details[open] summary {
    border-bottom: 1px solid #dee2e6;
    border-radius: 6px 6px 0 0;
}

.tech-content {
    padding: 1rem;
}

.network-log, .patch-log {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 0.75rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
}

.log-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid #333;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.sse-event {
    color: #ffc107;
}

.log-entry.patch-event {
    color: #2196f3;
}

/* Panel Footer */
.panel-footer {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    color: #6c757d;
    font-size: 0.9rem;
}

.panel-footer strong {
    color: #495057;
}

/* Status indicators */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.status-dot.streaming {
    background: #ff9800;
}

.status-dot.completed {
    background: #4caf50;
    animation: none;
}

.status-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
}

/* Problems and Advantages */
.problems, .advantages {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.problems h4 {
    color: #dc3545;
    margin-bottom: 0.5rem;
}

.advantages h4 {
    color: #28a745;
    margin-bottom: 0.5rem;
}

.problems ul, .advantages ul {
    list-style: none;
    padding-left: 0;
}

.problems li, .advantages li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

/* Controls */
.controls {
    text-align: center;
    margin: 2rem 0;
}

.demo-button {
    background: #2196f3;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin: 0 0.5rem;
    transition: background 0.3s ease;
}

.demo-button:hover {
    background: #1976d2;
}

.demo-button.secondary {
    background: #6c757d;
}

.demo-button.secondary:hover {
    background: #5a6268;
}

.demo-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Explanation */
.explanation {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.explanation h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.explanation p {
    color: #666;
    margin-bottom: 1rem;
}

.explanation ul {
    color: #666;
}

.explanation li {
    margin-bottom: 0.5rem;
}

.explanation strong {
    color: #2c3e50;
}

/* Footer */
footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

footer a {
    color: #ffc107;
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

/* Animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}


/* Token highlighting for newly added tokens */
.token-highlight {
    background: rgba(255, 152, 0, 0.3);
    animation: token-highlight-fade 0.1s ease-out;
}

@keyframes token-highlight-fade {
    0% { 
        background: rgba(255, 152, 0, 0.4);
    }
    100% { 
        background: rgba(255, 152, 0, 0.1);
    }
}


/* Responsive design */
@media (max-width: 768px) {
    .demo-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .json-output {
        font-size: 0.75rem;
    }
    
    .langdiff-output {
        font-size: 0.8rem;
    }
}
