/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Prevent auto-scrolling during demo steps */
html, body {
    scroll-behavior: auto !important;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

h2 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.description {
    margin-bottom: 30px;
    text-align: center;
}

.description p {
    margin-bottom: 10px;
}

.feature-link {
    display: inline-block;
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    border: 1px solid #3498db;
    border-radius: 4px;
    margin-top: 5px;
    transition: all 0.3s ease;
}

.feature-link:hover {
    background-color: #3498db;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #3498db;
}

.tab-btn.active {
    color: #3498db;
    border-bottom: 2px solid #3498db;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Forms */
form {
    margin-bottom: 20px;
}

.file-upload {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload:hover {
    border-color: #3498db;
}

.file-upload input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload label {
    color: #666;
    font-size: 16px;
    text-align: center;
}

textarea {
    width: 100%;
    height: 200px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: vertical;
    font-family: monospace;
    margin-bottom: 20px;
}

.queue-option {
    margin-bottom: 20px;
    background-color: #f8f9fa;
    padding: 12px 15px;
    border-radius: 5px;
    border-left: 3px solid #3498db;
}

.queue-option label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #555;
}

.queue-option input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.submit-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.submit-btn:hover {
    background-color: #2980b9;
}

/* Results Section */
.result-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.hidden {
    display: none;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Visualization Styles */
#visualization-container {
    margin-bottom: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background-color: #f9f9f9;
}

#game-map {
    width: 100%;
    min-height: 400px;
    margin: 20px 0;
    position: relative;
    overflow: auto;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.control-btn {
    padding: 8px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.control-btn:hover {
    background-color: #2980b9;
}

.control-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#step-indicator {
    padding: 8px 15px;
    background-color: #f1f1f1;
    border-radius: 4px;
    font-size: 14px;
}

#current-step-info {
    padding: 15px;
    background-color: #e8f4fc;
    border-radius: 4px;
    margin-bottom: 20px;
}

.picture {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.picture.visible {
    opacity: 1;
    border: 2px solid #333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.picture.hidden {
    opacity: 0.3;
}

.picture.removed {
    opacity: 0;
    transform: scale(0.8);
}

.picture.highlighted {
    border: 3px solid #e74c3c;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.8);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from {
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.8);
    }
    to {
        box-shadow: 0 0 25px rgba(231, 76, 60, 1);
    }
}

.picture-id {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 10px;
    color: #666;
}

.picture-config {
    font-size: 18px;
}

.picture-pos {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 10px;
    color: #666;
}

#solution-steps {
    margin-bottom: 20px;
}

.step {
    padding: 10px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 3px solid #3498db;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.step:hover {
    background-color: #edf7fd;
}

.step.active {
    background-color: #e8f4fc;
    border-left: 3px solid #2980b9;
}

#solution-summary {
    padding: 15px;
    background-color: #e8f4fc;
    border-radius: 4px;
    margin-bottom: 20px;
}

#error-container {
    padding: 15px;
    background-color: #ffebee;
    border-radius: 4px;
    color: #c62828;
}

/* Step display styles */
.current-step {
    font-size: 1.2em;
    margin-bottom: 10px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
}

.all-steps {
    margin-bottom: 20px;
    font-family: monospace;
    font-size: 1.1em;
}

.step-id {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 3px;
}

.step-id:hover {
    background: #e0e0e0;
}

.step-id.current {
    background: #ff5252;
    color: white;
    font-weight: bold;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
        text-align: center;
    }
}

/* Remaining Map Display */
#remaining-map-container {
    margin-top: 20px;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 5px;
    background-color: #f9f9f9;
}

#remaining-map-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2em;
}

#remaining-map-json {
    background-color: #f0f0f0;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9em;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
}

.time-limit-option {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    padding: 12px 15px;
    border-radius: 5px;
    border-left: 3px solid #3498db;
}

.time-limit-option label {
    margin-right: 10px;
    font-size: 14px;
    color: #555;
}

.time-limit-option input[type="number"] {
    width: 80px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
