/* MiSTer Polyphase Filter Previewer Styles */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-size: 2.5em;
}

.project-links {
    text-align: center;
    margin-bottom: 20px;
}

.project-links a {
    display: inline-block;
    margin: 0 10px;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.project-links a:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

h2 {
    color: #333;
    margin-bottom: 15px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 5px;
}

h3 {
    color: #555;
    margin-bottom: 10px;
    font-size: 1.1em;
}

#controls {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.filter-group, .settings-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-loading-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
}

.file-loading-section label {
    font-weight: normal;
    color: #666;
    font-size: 0.9em;
}

label {
    font-weight: 600;
    color: #555;
    margin-bottom: 3px;
    font-size: 0.95em;
}

select, input[type="file"], input[type="number"], input[type="checkbox"], input[type="text"] {
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 13px;
    transition: border-color 0.3s ease;
}

select:focus, input[type="number"]:focus, input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

input[type="number"], input[type="text"] {
    width: 100%;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

button {
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 3px;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#filterCoefficients {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.coeff-container {
    display: flex;
    flex-direction: column;
}

textarea {
    width: 100%;
    min-height: 180px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.3;
    resize: vertical;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea:read-only {
    background-color: #f9f9f9;
    color: #666;
}

#previewArea {
    background: white;
    border-radius: 10px;
    margin-bottom: 25px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#imageContainer {
    max-width: 100%;
    max-height: 600px;
    overflow: auto;
    border: 2px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
    padding: 10px;
}

#previewCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid #ccc;
    background: white;
}

#previewCanvas.no-fit {
    max-width: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    #controls {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    #filterCoefficients {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    h1 {
        font-size: 2em;
    }
}

/* Custom scrollbar for image container */
#imageContainer::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

#imageContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

#imageContainer::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
}

#imageContainer::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success state */
.success {
    border-color: #4CAF50 !important;
}

/* Error state */
.error {
    border-color: #f44336 !important;
}

/* Animation for processing */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.processing {
    animation: pulse 1.5s infinite;
}

/* Info text overlay styling */
.info-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 0, 0.9);
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

/* Search box styling */
.search-box {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed #eee;
}

.search-box label {
    font-weight: normal;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 3px;
}

.search-box input[type="text"] {
    margin-top: 5px;
}

/* Shadowmask options - side by side checkboxes */
.shadowmask-options {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.shadowmask-options label {
    margin-bottom: 0;
    white-space: nowrap;
}

.shadowmask-options input[type="checkbox"] {
    margin-right: 5px;
}

/* Gamma options - side by side checkboxes */
.gamma-options {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.gamma-options label {
    margin-bottom: 0;
    white-space: nowrap;
}

.gamma-options input[type="checkbox"] {
    margin-right: 5px;
}

/* Preview options - for Fit to width checkbox */
.preview-options {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.preview-options label {
    margin-bottom: 0;
    white-space: nowrap;
    font-weight: 600;
    color: #555;
}

.preview-options input[type="checkbox"] {
    margin-right: 5px;
    accent-color: #667eea;
}