/* AutoEncoder Tutorial Styles */
/* Max width: 800px, Font: Courier New */

.ae-container {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Courier New', monospace;
    color: #333;
    padding: 20px;
}

.viz-card, .control-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.viz-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: #555;
}

.io-deck {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.grid-panel {
    text-align: center;
}

.panel-label {
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 14px;
    font-family: 'Courier New', monospace;
}

.grid-3x3 {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    gap: 4px;
    background: #eee;
    padding: 4px;
    border-radius: 4px;
    margin: 0 auto;
}

.pixel {
    width: 40px; 
    height: 40px;
    background: white;
    border: 2px solid #ccc;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
}

.pixel.active { 
    background: #222; 
    border-color: #000; 
}

.read-only .pixel { 
    cursor: default; 
}

/* Latent Bars */
.latent-panel { 
    text-align: center; 
    width: 120px; 
}

.latent-bars {
    display: flex;
    gap: 10px;
    height: 120px; /* match grid height roughly */
    align-items: flex-end;
    justify-content: center;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 5px 10px 5px;
    margin-bottom: 10px;
}

.latent-bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 20px;
    height: 100%;
    justify-content: flex-end;
}

.latent-bar {
    width: 100%;
    transition: height 0.2s;
    border-radius: 2px 2px 0 0;
    min-height: 2px;
}

.latent-val { 
    font-size: 9px; 
    margin-top: 4px; 
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.loss-metric {
    margin-top: 10px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: #666;
}

.loss-metric span {
    font-weight: bold;
    color: #333;
}

/* Controls */
.stat-row { 
    display: flex; 
    justify-content: space-between; 
    margin-bottom: 15px; 
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.param-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.param-group {
    flex: 1;
    min-width: 200px;
}

.param-group label {
    display: block;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    color: #555;
}

.param-group label span {
    color: #007bff;
    font-weight: bold;
    margin-left: 5px;
}

.param-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.param-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.param-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.btn-row { 
    display: flex; 
    gap: 10px; 
}

.btn { 
    flex: 1; 
    padding: 10px; 
    border: none; 
    border-radius: 4px; 
    cursor: pointer; 
    font-weight: bold;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    transition: background-color 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary { 
    background: #007bff; 
    color: white; 
}

.btn-secondary { 
    background: #6c757d; 
    color: white; 
}

.btn-danger { 
    background: #dc3545; 
    color: white; 
}

.btn-sm { 
    padding: 4px 10px; 
    font-size: 12px; 
    margin-top: 5px; 
    width: 100%;
}

.btn-outline {
    background: white;
    border: 1px solid #ccc;
    color: #333;
}

.btn-outline:hover {
    background: #f5f5f5;
}

/* Network Diagram SVG */
#networkSVG {
    background: #fafafa;
    border-radius: 4px;
    min-height: 400px; /* Increased for vertical hourglass layout */
}

/* Responsive adjustments */
@media (max-width: 850px) {
    .io-deck {
        flex-direction: column;
        gap: 20px;
    }
    
    .latent-panel {
        width: 100%;
    }
    
    .latent-bars {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
}

