/* ============================================================
   playground.css — Стили интерактивной песочницы
   Команда InIProject | Code & Games
   ============================================================ */

/* ---------- СЕКЦИЯ ---------- */
.playground {
    background: var(--bg-primary);
    position: relative;
}

.playground__intro {
    max-width: 650px;
    margin-bottom: 2.5rem;
}

.playground__intro-text {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ---------- ОБЁРТКА ---------- */
.playground__wrapper {
    background: var(--bg-terminal);
    border: 1px solid rgba(230, 57, 70, 0.2);
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: 
        0 0 30px rgba(0, 0, 0, 0.4),
        0 0 5px var(--accent-glow);
}

/* ---------- ШАПКА РЕДАКТОРА ---------- */
.playground__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    background: rgba(17, 17, 17, 0.9);
    border-bottom: 1px solid rgba(230, 57, 70, 0.15);
}

.playground__header-left {
    display: flex;
    gap: 8px;
}

.playground__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.playground__dot--red    { background: #FF5F56; }
.playground__dot--yellow { background: #FFBD2E; }
.playground__dot--green  { background: #27C93F; }

.playground__header-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* ---------- ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА ---------- */
.playground__lang-select {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-primary);
    background: rgba(230, 57, 70, 0.1);
    border: 1px solid rgba(230, 57, 70, 0.3);
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23E63946' fill='none' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.playground__lang-select:hover {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.playground__lang-select option {
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* Старый бейдж (убираем, заменён на select) */
.playground__lang-badge {
    display: none;
}

/* ---------- РЕДАКТОР С НУМЕРАЦИЕЙ ---------- */
.playground__editor-container {
    display: flex;
    min-height: 300px;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}

.playground__line-numbers {
    display: flex;
    flex-direction: column;
    padding: 1rem 0.6rem;
    background: rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(230, 57, 70, 0.08);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-muted);
    text-align: right;
    user-select: none;
    min-width: 44px;
    overflow: hidden;
}

.playground__line-numbers span {
    display: block;
    padding: 0 0.4rem;
}

.playground__line-numbers span.active {
    color: var(--accent);
}

.playground__editor {
    flex: 1;
    padding: 1rem 1.2rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    overflow-y: auto;
    tab-size: 4;
    caret-color: var(--accent);
}

.playground__editor::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Скроллбар в редакторе */
.playground__editor::-webkit-scrollbar {
    width: 6px;
}

.playground__editor::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.playground__editor::-webkit-scrollbar-thumb {
    background: rgba(230, 57, 70, 0.3);
    border-radius: 3px;
}

/* ---------- ПАНЕЛЬ ДЕЙСТВИЙ ---------- */
.playground__actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.2rem;
    background: rgba(17, 17, 17, 0.5);
    border-top: 1px solid rgba(230, 57, 70, 0.08);
    border-bottom: 1px solid rgba(230, 57, 70, 0.08);
    flex-wrap: wrap;
}

.playground__btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.playground__btn--run {
    background: var(--accent);
    color: #FFFFFF;
    border: 1px solid var(--accent);
}

.playground__btn--run:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-1px);
}

.playground__btn--clear,
.playground__btn--reset {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(230, 57, 70, 0.2);
}

.playground__btn--clear:hover,
.playground__btn--reset:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: rgba(230, 57, 70, 0.05);
}

.playground__shortcut-hint {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
    opacity: 0.7;
}

/* ---------- КОНСОЛЬ ВЫВОДА ---------- */
.playground__output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.2rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(230, 57, 70, 0.08);
}

.playground__output-status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
}

.playground__output-status--success {
    color: #27C93F;
    background: rgba(39, 201, 63, 0.1);
    border: 1px solid rgba(39, 201, 63, 0.2);
}

.playground__output-status--error {
    color: #FF4D5A;
    background: rgba(255, 77, 90, 0.1);
    border: 1px solid rgba(255, 77, 90, 0.2);
}

.playground__output-status--idle {
    color: var(--text-muted);
    background: rgba(102, 102, 102, 0.1);
    border: 1px solid rgba(102, 102, 102, 0.2);
}

.playground__output {
    min-height: 150px;
    max-height: 300px;
    padding: 1rem 1.2rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.35);
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.playground__output-placeholder {
    color: var(--text-muted);
    opacity: 0.6;
    font-style: italic;
}

/* Стилизация строк вывода */
.playground__output .log-line   { color: var(--text-secondary); }
.playground__output .error-line { color: #FF4D5A; }
.playground__output .warn-line  { color: #FFBD2E; }
.playground__output .info-line  { color: #27C93F; }

/* ---------- IFRAME ДЛЯ HTML-ВЫВОДА ---------- */
.playground__iframe {
    margin: 0.5rem 0;
    width: 100%;
    height: 300px;
    border: 1px solid rgba(230, 57, 70, 0.2);
    border-radius: 4px;
    background: #FFFFFF;
}

/* ---------- АДАПТИВ ---------- */
@media (max-width: 768px) {
    .playground__editor-container {
        min-height: 250px;
        max-height: 350px;
    }

    .playground__actions {
        gap: 0.5rem;
    }

    .playground__btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.7rem;
    }

    .playground__shortcut-hint {
        display: none;
    }

    .playground__line-numbers {
        min-width: 36px;
        padding: 1rem 0.4rem;
    }

    .playground__lang-select {
        font-size: 0.7rem;
        padding: 0.3rem 0.5rem;
        padding-right: 25px;
        background-position: right 6px center;
    }
}

@media (max-width: 480px) {
    .playground__editor-container {
        min-height: 200px;
        max-height: 280px;
    }

    .playground__editor {
        font-size: 0.75rem;
        padding: 0.8rem;
    }

    .playground__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .playground__btn {
        justify-content: center;
    }
    
    .playground__lang-select {
        max-width: 120px;
    }
}