/* 3x3 Pattern Recognizer MLP Simulation - CSS */
.pattern-recognizer-simulation {
    max-width: 1000px; /* Reduced width for tighter look */
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    padding: 20px;
}

/* 1. Network Visualization Section (Top) */
.viz-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.viz-header {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #444;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
}

.network-diagram svg {
    display: block;
    margin: 0 auto;
    /* Height is now controlled by JS, but max-width ensures responsiveness */
    width: 100%;
    /* Ensure it has enough height for the blocks */
    min-height: 280px;
    background: #fcfcfc; /* slight background contrast */
}

/* 2. Control Deck (Bottom Section) */
.control-deck {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two equal columns */
    gap: 20px;
}

/* Unified Card Style for Input and Training */
.panel-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 15px;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Input Grid Styling */
.input-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.grid-wrapper {
    display: grid;
    /* 8 columns, smaller cells (30px) to fit 8x8 */
    grid-template-columns: repeat(8, 30px);
    gap: 2px;
}

.grid-cell {
    width: 30px;
    height: 30px;
    background: white;
    border: 1px solid #ced4da; /* thinner border */
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.grid-cell:hover { border-color: #007bff; }
.grid-cell.active { background: #333; border-color: #000; }

/* Prediction Info next to Grid */
.pred-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gauge-bg {
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 5px;
}
.gauge-fill {
    height: 100%;
    background: #28a745;
    transition: width 0.3s ease;
}

/* Training Controls */
.control-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
}
.control-row label { width: 100px; color: #666; }
.control-row input { flex: 1; cursor: pointer; }
.control-row span { width: 40px; text-align: right; font-weight: bold; font-family: monospace; }

.btn-row {
    display: flex;
    gap: 10px;
    margin-top: auto; /* Pushes buttons to bottom of card */
    padding-top: 15px;
}

.btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}
.btn-primary { background: #007bff; color: white; }
.btn-secondary { background: #6c757d; color: white; }
.btn-danger { background: #dc3545; color: white; }
.btn:hover { opacity: 0.9; }

.stats-row {
    margin-top: 15px;
    font-size: 12px;
    color: #666;
    background: white;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    .control-deck { grid-template-columns: 1fr; }
}
