/* ==========================================================================
   Playground Styles
   - Inherits variables from styles.css for consistency.
   - Uses a responsive grid for layout.
   ========================================================================== */

body {
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden; /* Prevent body scroll */
}

/* Make the navbar static on this page */
.navbar {
    position: static;
    background: var(--bg);
    border-bottom: 1px solid var(--border-color);
}

.playground-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.playground-header {
    padding: 2rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.playground-header h1 {
    font-size: clamp(2rem, 5vw, 2.5rem);
    margin-bottom: 0.5rem;
}

.title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#info-icon {
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

.info-box {
    padding: 15px;
    margin-top: 15px;
    background-color: #f9f9f9;
    border-left: 4px solid #6B47DC;
    color: #333;
    display: none; /* Initially hidden */
    text-align: left;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .title-container {
        flex-direction: column;
        align-items: center;
    }

    #info-icon {
        margin-top: 10px;
    }
}

.playground-container {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px; /* Creates thin separator lines */
    background-color: var(--border-color);
    overflow: hidden;
}

.editors-column {
    display: flex;
    flex-direction: column;
    gap: 1px; /* Separator lines between editors */
    background-color: var(--border-color);
    overflow: hidden;
}

.editor-pane,
.preview-pane {
    display: flex;
    flex-direction: column;
    background-color: #0B0F17; /* A slightly different dark shade */
    overflow: hidden;
}

.editor-pane {
    flex: 1; /* Each editor takes equal space */
}

.editor-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: #11151C;
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--muted);
    border-bottom: 1px solid var(--border-color);
}

.editor-header i {
    font-size: 1rem;
    color: #8E7CFF;
}
.editor-header .fa-css3-alt { color: #4ADEDE; }
.editor-header .fa-js-square { color: #FFC658; }
.editor-header .fa-eye { color: var(--text); }


.code-editor {
    flex-grow: 1;
    width: 100%;
    padding: 1rem;
    background-color: transparent;
    color: #C7D5FF;
    border: none;
    resize: none;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    box-sizing: border-box;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.code-editor::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}


.code-editor:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

#preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: white;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */
@media (max-width: 800px) {
    body {
        height: auto;
        overflow: auto; /* Allow body scroll on mobile */
    }

    .playground-container {
        grid-template-columns: 1fr;
        grid-template-rows: 50vh 50vh; /* Split screen vertically */
        height: 100vh; /* Ensure it takes up viewport */
    }

    .editors-column {
        grid-row: 1 / 2;
        overflow: auto; /* Allow scrolling through editors */
    }

    .preview-pane {
        grid-row: 2 / 3;
    }

    .editor-pane {
        min-height: 30vh; /* Give each editor a minimum height */
    }
}