/**
 * Conway's Game of Life Visualization Styles
 */

.game-of-life-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* Header Styles */
.game-of-life-container header {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.game-of-life-container header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5em;
    font-weight: 600;
}

.game-of-life-container .subtitle {
    margin: 0;
    font-size: 1.15em;
    opacity: 0.95;
}

.formula-display {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.formula-rules {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    font-size: 0.95em;
}

.rule {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    font-family: 'Courier New', monospace;
}

/* Main Content */
.game-of-life-container main {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 30px;
}

/* Canvas Section */
.canvas-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.canvas-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#gameCanvas {
    border: 2px solid #333;
    border-radius: 4px;
    cursor: crosshair;
    background: #000;
    display: block;
    margin: 0 auto;
}

.canvas-info {
    margin-top: 15px;
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 5px;
    font-weight: 600;
    color: #333;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Controls Section */
.controls-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

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

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.control-group select:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    flex: 1;
    min-width: 100px;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(108, 117, 125, 0.4);
}

/* Stats Section */
.stats-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.stats-section h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.3em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #667eea;
}

.stat-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: 700;
    color: #667eea;
}

/* Patterns Section */
.patterns-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.patterns-section h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.3em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.pattern-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #764ba2;
}

.pattern-card h4 {
    color: #333;
    margin: 0 0 8px 0;
    font-size: 1.05em;
}

.pattern-card p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
}

/* Explanation Section */
.explanation {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.explanation h2 {
    color: #333;
    font-size: 1.8em;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.explanation h3 {
    color: #555;
    font-size: 1.4em;
    margin-top: 25px;
    margin-bottom: 15px;
}

.explanation p {
    line-height: 1.8;
    color: #666;
    margin-bottom: 15px;
}

.explanation ul {
    list-style: none;
    padding-left: 0;
}

.explanation li {
    padding: 10px 0;
    padding-left: 25px;
    position: relative;
    color: #666;
    line-height: 1.6;
}

.explanation li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.rules-detail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.rule-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.rule-name {
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.rule-desc {
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-of-life-container {
        padding: 10px;
    }

    .game-of-life-container header h1 {
        font-size: 1.8em;
    }

    .game-of-life-container .subtitle {
        font-size: 1em;
    }

    .formula-rules {
        flex-direction: column;
        gap: 8px;
    }

    .controls-section {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .canvas-info {
        flex-direction: column;
        gap: 5px;
    }

    #gameCanvas {
        max-width: 100%;
    }
}
