/* ═══════════════════════════════════════════════════════════════════════════════
   MGraph HTML Graph - Render UI - Playground Styles
   v0.1.1 - Core UI Framework
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Playground Layout */
.playground {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    background: var(--color-bg-muted);
}

.playground-main {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    overflow: hidden;
}

/* Left Panel - Input & Config */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

/* Right Panel - Canvas */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    overflow: hidden;
}

/* Panel Headers */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--spacing-sm);
}

.panel-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.panel-title-icon {
    font-size: 1.2em;
}

/* Sample Selector */
.sample-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.sample-selector label {
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
}

.sample-selector select {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-small);
    background: white;
    cursor: pointer;
}

/* HTML Input */
.html-input-area {
    width: 100%;
    min-height: 200px;
    max-height: 300px;
    padding: var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-code);
    font-size: 0.9em;
    line-height: 1.5;
    resize: vertical;
    background: var(--color-bg-muted);
}

.html-input-area:focus {
    outline: none;
    border-color: var(--color-primary);
    background: white;
}

/* Config Options */
.config-section {
    margin-bottom: var(--spacing-md);
}

.config-section-title {
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.config-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.config-row label {
    flex: 1;
    font-size: var(--font-size-small);
}

.config-row select {
    width: 150px;
}

/* Stats Display */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-bg-muted);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-small);
}

.stat-label {
    color: var(--color-text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Graph Canvas */
.graph-canvas-container {
    flex: 1;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-muted);
}

.canvas-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.canvas-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.renderer-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.renderer-selector label {
    font-size: var(--font-size-small);
    color: var(--color-text-secondary);
}

.renderer-selector select {
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-small);
    background: white;
}

.canvas-area {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    background: white;
}

.canvas-area svg {
    max-width: 100%;
    height: auto;
}

/* Canvas States */
.canvas-empty {
    color: var(--color-text-muted);
    text-align: center;
    padding: var(--spacing-xl);
}

.canvas-empty-icon {
    font-size: 4em;
    margin-bottom: var(--spacing-md);
    opacity: 0.3;
}

.canvas-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--color-text-secondary);
}

.canvas-error {
    color: var(--color-error);
    text-align: center;
    padding: var(--spacing-md);
}

.canvas-error pre {
    margin-top: var(--spacing-sm);
    text-align: left;
    font-size: var(--font-size-small);
    max-width: 100%;
    overflow-x: auto;
}

/* Render Button */
.render-button {
    width: 100%;
    padding: var(--spacing-md);
    font-size: 1.1em;
    font-weight: 600;
}

.render-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 1024px) {
    .playground-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .left-panel {
        max-height: none;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .left-panel > .card {
        flex: 1 1 300px;
    }
}

@media (max-width: 768px) {
    .playground-main {
        padding: var(--spacing-sm);
    }

    .left-panel {
        flex-direction: column;
    }
}
