/* styles.css */

/* --- 1. Global Reset & Base Styles --- */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%; /* Required for full-height sidebar */
    margin: 0;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    /* Mobile Default: Stack vertically */
    display: flex; 
    flex-direction: column;
    flex: 1; /* Fill screen height */
}

/* --- 2. Shared Component Styles --- */
button, select, textarea, input {
    font-family: inherit;
    font-size: 16px;
}

textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical; 
}

.primary-btn {
    width: 100%;
    padding: 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
}

.primary-btn:hover { background-color: #45a049; }

.card {
    background: white;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.hidden { display: none; }

/* Tutorial / Header Specifics */
.header-row {
    margin-bottom: 15px;
}

.tutorial-card {
    border-left: 5px solid #2196F3;
}

.doc-content {
    background: #f8f9fa;
    padding: 15px;
    margin-top: 10px;
    border-radius: 4px;
    line-height: 1.6;
}

/* Lab Grid (Inputs & Results) */
.layout-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Tables & Visualization */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.simplex-table { width: 100%; border-collapse: collapse; font-size: 0.9em; min-width: 300px; }
.simplex-table th, .simplex-table td { border: 1px solid #ddd; padding: 6px; text-align: right; }
.simplex-table th { background-color: #f1f1f1; }

.var-badge { background: #e8f5e9; padding: 5px 10px; border-radius: 15px; color: #2e7d32; font-weight: bold; display: inline-block; margin: 2px; }
.warning-box { background-color: #fff3cd; color: #856404; border: 1px solid #ffeeba; padding: 10px; border-radius: 4px; }
pre { background: #2d2d2d; color: #f8f8f2; padding: 10px; border-radius: 4px; overflow-x: auto; }

/* --- 3. Desktop Layout (Side-by-Side) --- */
@media (min-width: 768px) {
    .container {
        flex-direction: row; /* Header Left, Main Right */
        overflow: hidden; /* Prevent body scroll, let panels scroll */
    }

    /* LEFT PANEL: Header/Tutorial */
    header {
        width: 300px; /* Default Width */
        min-width: 250px;
        max-width: 50vw;
        
        /* Resizing Magic */
        resize: horizontal;
        overflow: auto; /* Required for resize handle */
        
        border-right: 1px solid #e0e0e0;
        padding: 20px;
        background: #fff;
        height: 100vh; /* Full height */
        flex-shrink: 0; /* Prevent it from squishing */
    }

    /* RIGHT PANEL: Virtual Lab */
    main.layout-grid {
        flex: 1; /* Take remaining space */
        padding: 20px;
        overflow-y: auto; /* Independent scroll */
        height: 100vh;
        
        /* Make Input/Output sit side-by-side inside the right panel if wide enough */
        display: flex;
        flex-direction: row; 
        flex-wrap: wrap; /* Wrap if the sidebar gets too big */
        align-items: flex-start;
    }

    .input-section, .output-section {
        flex: 1 1 400px; /* Grow, Shrink, Basis 400px */
        width: 100%;
    }
}