:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --accent-color: #0056b3;
    --border-color: #e0e0e0;
    --hover-color: #003d82;
    --theme-bg: #f5f5f5;
    --theme-border: #ddd;
    --theme-hover: #e0e0e0;
    --date-color: #555555;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #eaeaea;
    --bg-hover: #f0f0f0;
    --text-primary: #333333;
    --button-bg: #f5f5f5;
    --button-hover-bg: #e0e0e0;
    --focus-outline-color: #0056b3;
    --progress-bg: #e0e0e0;
    --accent-hover: #003d82;
}

/* Dark theme variables when system prefers dark mode (auto setting) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --accent-color: #5fa9ff;
        --border-color: #404040;
        --hover-color: #8ac2ff;
        --theme-bg: #2d2d2d;
        --theme-border: #404040;
        --theme-hover: #3d3d3d;
        --date-color: #a0a0a0;
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --bg-tertiary: #3d3d3d;
        --bg-hover: #333333;
        --text-primary: #e0e0e0;
        --button-bg: #2d2d2d;
        --button-hover-bg: #3d3d3d;
        --focus-outline-color: #5fa9ff;
        --progress-bg: #404040;
        --accent-hover: #8ac2ff;
    }
}

/* Light theme variables when manually selected */
html[data-theme='light'] {
    --bg-color: #ffffff;
    --text-color: #333333;
    --accent-color: #0056b3;
    --border-color: #e0e0e0;
    --hover-color: #003d82;
    --theme-bg: #f5f5f5;
    --theme-border: #ddd;
    --theme-hover: #e0e0e0;
    --date-color: #555555;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #eaeaea;
    --bg-hover: #f0f0f0;
    --text-primary: #333333;
    --button-bg: #f5f5f5;
    --button-hover-bg: #e0e0e0;
    --focus-outline-color: #0056b3;
    --progress-bg: #e0e0e0;
    --accent-hover: #003d82;
}

/* Dark theme variables when manually selected */
html[data-theme='dark'] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --accent-color: #5fa9ff;
    --border-color: #404040;
    --hover-color: #8ac2ff;
    --theme-bg: #2d2d2d;
    --theme-border: #404040;
    --theme-hover: #3d3d3d;
    --date-color: #a0a0a0;
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3d3d3d;
    --bg-hover: #333333;
    --text-primary: #e0e0e0;
    --button-bg: #2d2d2d;
    --button-hover-bg: #3d3d3d;
    --focus-outline-color: #5fa9ff;
    --progress-bg: #404040;
    --accent-hover: #8ac2ff;
}

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

/* Skip to content link for accessibility */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-color);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 4px 0;
    font-weight: bold;
}

.skip-to-content:focus {
    top: 0;
    outline: 3px solid var(--focus-outline-color);
    outline-offset: 2px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    padding: 20px;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Theme switch */
.theme-switch {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}

.theme-switch button {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.theme-switch button:hover {
    background-color: rgba(128, 128, 128, 0.2);
}

/* Navigation styles */
.main-nav {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.main-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1rem;
    border-radius: 4px;
    background-color: var(--theme-bg);
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.main-nav li {
    margin: 0;
    padding: 0;
    position: relative;
}

.main-nav a {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

.main-nav a:hover {
    background-color: var(--theme-hover);
    color: var(--accent-color);
}

.main-nav a.active {
    background-color: var(--accent-color);
    color: white;
    font-weight: 700;
}

/* Add specific styles for dark mode active navigation */
html[data-theme='dark'] .main-nav a.active {
    background-color: #0056b3;
    color: #ffffff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) .main-nav a.active {
        background-color: #0056b3;
        color: #ffffff;
    }
}

/* Dropdown styles */
.main-nav .dropdown {
    position: relative;
    cursor: pointer;
}

.main-nav .dropdown > a::after {
    content: "▼";
    font-size: 0.7em;
    margin-left: 0.5em;
    vertical-align: middle;
}

.main-nav .dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--theme-bg);
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-radius: 4px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.main-nav .dropdown:hover .dropdown-content,
.main-nav .dropdown:focus-within .dropdown-content {
    display: block;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0s linear 0s;
}

.main-nav .dropdown-content a {
    padding: 0.5rem 1rem;
    display: block;
    text-align: left;
    white-space: nowrap;
}

.main-nav .dropdown-content a.active {
    background-color: var(--accent-color);
    color: white;
}

/* Responsive navigation */
@media (max-width: 600px) {
    .main-nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .main-nav a {
        text-align: center;
    }
    
    .main-nav .dropdown-content {
        position: static;
        box-shadow: none;
        margin-top: 0;
        padding-left: 1rem;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: var(--accent-color);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

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

.editor-section {
    padding: 30px;
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.4);
}

.btn-secondary {
    background: var(--button-bg);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--button-hover-bg);
}

.editor-container {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.CodeMirror {
    height: 500px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
}

.results-section {
    padding: 30px;
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
}

.results-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.result-item {
    background: var(--bg-primary);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.result-item.success {
    border-left-color: #2dce89;
}

.result-item.error {
    border-left-color: #f5365c;
}

.result-item.warning {
    border-left-color: #fb6340;
}

.result-item.running {
    border-left-color: var(--accent-color);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.result-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.result-status.success {
    background: #d4f4dd;
    color: #1d8348;
}

.result-status.error {
    background: #fadbd8;
    color: #c0392b;
}

.result-status.warning {
    background: #fdebd0;
    color: #d68910;
}

.result-status.running {
    background: rgba(0, 86, 179, 0.1);
    color: var(--accent-color);
}

.result-message {
    color: var(--text-primary);
    white-space: pre-wrap;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
}

.loading {
    padding: 60px;
    text-align: center;
}

.queue-status {
    padding: 30px;
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-color);
    text-align: center;
}

.queue-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.queue-details {
    flex: 1;
    max-width: 600px;
}

.queue-details p {
    margin: 10px 0;
    color: var(--text-primary);
    font-size: 1.1em;
}

.queue-note {
    font-size: 0.9em;
    color: var(--date-color);
    font-style: italic;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--bg-secondary);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* API Example Section */
.api-example-section {
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.api-example-toggle {
    width: 100%;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}

.api-example-toggle:hover {
    background: var(--bg-hover);
}

.api-example-toggle[aria-expanded="true"] .api-example-icon {
    transform: rotate(90deg);
}

.api-example-icon {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 12px;
}

.api-example-content {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.api-example-description {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.api-example-code-container {
    position: relative;
    margin: 15px 0;
}

.api-example-code {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin: 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.api-example-code code {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.btn-copy {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    background: var(--button-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.btn-copy:hover {
    background: var(--button-hover-bg);
}

.api-example-note {
    margin-top: 15px;
    font-size: 0.9em;
    color: var(--date-color);
    font-style: italic;
}

.api-example-note code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

