/* (c) Clayground Contributors - MIT License, see "LICENSE" file */
/* Clayground Web Dojo styles */

/* Fullscreen layout - fill viewport */
.fullscreen-layout {
    margin: 0;
    padding: 0;
    background: var(--bg-dark, #0d1117);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.fullscreen-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header bar with logo and controls */
.webdojo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary, #161b22);
    border-bottom: 1px solid var(--border-color, #30363d);
    flex-shrink: 0;
}

.webdojo-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary, #e6edf3);
}

.webdojo-brand:hover {
    opacity: 0.9;
}

.webdojo-logo {
    height: 28px;
    width: auto;
}

.webdojo-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-primary, #00d9ff);
}

.webdojo-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.webdojo-controls label {
    color: var(--text-secondary, #8b949e);
    font-size: 0.85rem;
}

.webdojo-controls select {
    padding: 0.35rem 0.75rem;
    background: var(--bg-dark, #0d1117);
    color: var(--text-primary, #e6edf3);
    border: 1px solid var(--border-color, #30363d);
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
}

.webdojo-controls select:focus {
    outline: none;
    border-color: var(--accent-primary, #00d9ff);
}

.share-button {
    padding: 0.35rem 0.75rem;
    background: var(--bg-dark, #0d1117);
    color: var(--text-primary, #e6edf3);
    border: 1px solid var(--border-color, #30363d);
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-button:hover {
    border-color: var(--accent-primary, #00d9ff);
}

.standalone-button {
    padding: 0.35rem 0.75rem;
    background: var(--bg-dark, #0d1117);
    color: var(--text-primary, #e6edf3);
    border: 1px solid var(--border-color, #30363d);
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.standalone-button:hover {
    border-color: var(--accent-primary, #00d9ff);
}

/* URL input for demo mode */
.url-input {
    flex: 1;
    max-width: 600px;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-color, #30363d);
    border-radius: 4px;
    background: var(--bg-dark, #0d1117);
    color: var(--text-primary, #e6edf3);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

.url-input:focus {
    outline: none;
    border-color: var(--accent-primary, #00d9ff);
}

.url-input::placeholder {
    color: var(--text-secondary, #8b949e);
}

/* Load URL button */
.load-url-button {
    padding: 0.35rem 0.75rem;
    background: var(--accent-primary, #00d9ff);
    color: var(--bg-dark, #0d1117);
    border: none;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-url-button:hover {
    box-shadow: var(--glow-primary);
}

/* View Source button */
.view-source-button {
    padding: 0.35rem 0.75rem;
    background: var(--bg-dark, #0d1117);
    color: var(--text-primary, #e6edf3);
    border: 1px solid var(--border-color, #30363d);
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-source-button:hover {
    border-color: var(--accent-primary, #00d9ff);
}

/* Modify Copy button */
.modify-copy-button {
    padding: 0.35rem 0.75rem;
    background: #6b5b00;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modify-copy-button:hover {
    background: #7d6b00;
}

/* Main container - fills remaining viewport */
.playground-container {
    display: flex;
    flex: 1;
    min-height: 0;
    border: none;
    overflow: hidden;
    background: var(--bg-card, #161b22);
}

.editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

#editor-container {
    flex: 1;
    overflow: hidden;
}

.editor-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.editor-controls-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.readonly-badge {
    padding: 0.25rem 0.5rem;
    background: var(--bg-dark);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.auto-reload-label,
.vim-mode-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
}

.auto-reload-label input[type="checkbox"],
.vim-mode-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent-highlight);
    cursor: pointer;
}

.vim-status-bar {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent-primary);
    min-width: 80px;
}

.run-button {
    padding: 0.5rem 1.5rem;
    background: var(--accent-primary);
    color: var(--bg-dark);
    border: none;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.run-button:hover {
    box-shadow: var(--glow-primary);
    transform: translateY(-1px);
}

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

.divider {
    width: 4px;
    background: var(--border-color);
    cursor: col-resize;
    transition: background 0.2s;
}

.divider:hover {
    background: var(--accent-primary);
}

.divider-horizontal {
    height: 4px;
    background: var(--border-color);
    cursor: row-resize;
    transition: background 0.2s;
    flex-shrink: 0;
}

.divider-horizontal:hover {
    background: var(--accent-primary);
}

.canvas-pane {
    flex: 1;
    position: relative;
    min-width: 300px;
    min-height: 400px;
    background: #1a1a2e;
}

#webdojo-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Qt creates its own canvas - style it to fill container */
#webdojo-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 17, 23, 0.9);
    z-index: 10;
}

.loading-overlay span {
    color: var(--accent-primary);
    font-size: 1rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.loading-overlay.hidden {
    display: none;
}

.fullscreen-button {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    z-index: 5;
    transition: all 0.2s;
}

.fullscreen-button:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: var(--accent-primary);
}

/* Console - integrated below main container */
.console-container {
    background: var(--bg-dark, #0d1117);
    border-top: 1px solid var(--border-color, #30363d);
    overflow: hidden;
    flex-shrink: 0;
}

.console-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
}

.clear-console {
    padding: 0.15rem 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-console:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

#console-output {
    height: 100px;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
}

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

.console-line.error {
    color: var(--accent-secondary);
}

.console-line.warning {
    color: #f0ad4e;
}

.console-line.success {
    color: #7EE787;
}

/* Showcases section */
.showcases-section {
    margin-top: 3rem;
}

.showcases-section h2 {
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.showcase-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.showcase-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: none;
}

.showcase-container.active iframe {
    display: block;
}

.showcase-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d4a 100%);
}

.showcase-container.active .showcase-preview {
    display: none;
}

.showcase-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 17, 23, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.showcase-container.active .showcase-overlay {
    display: none;
}

.load-btn {
    padding: 1rem 2rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.load-btn:hover {
    background: #00b8d9;
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    .webdojo-header {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .webdojo-controls {
        width: 100%;
        justify-content: center;
    }

    .playground-container {
        flex-direction: column;
    }

    .editor-pane,
    .canvas-pane {
        min-width: 100%;
        flex: 1;
        min-height: 250px;
    }

    .divider {
        width: 100%;
        height: 4px;
        cursor: row-resize;
    }
}
