/* Canvas to Image Exporter specific styles */

.canvas-exporter-container {
    display: grid;
    grid-template-columns: 1fr; /* Single column layout for better flow */
    gap: 40px; /* Spacing between sections */
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.section-heading {
    font-size: 1.3em;
    color: #007bff; /* Primary color */
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-heading .icon-left {
    font-size: 1.1em;
}

.canvas-controls {
    text-align: center;
}

.canvas-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

#myCanvas {
    max-width: 100%; /* Ensure canvas is responsive */
    height: auto; /* Maintain aspect ratio */
    border: 1px solid #ddd;
    background-color: #fefefe;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: block; /* Remove extra space below canvas */
    margin: 0 auto; /* Center the canvas */
}

.export-options {
    background-color: #f8f8f8;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    box-sizing: border-box;
    appearance: none; /* Remove default select arrow */
    background-color: #fff;
    cursor: pointer;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Style for range input (slider) */
.form-range {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 5px;
    outline: none;
    transition: background 0.2s ease-in-out;
    -webkit-appearance: none; /* For Chrome, Safari, Opera */
    appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease-in-out;
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease-in-out;
}

.form-range:focus::-webkit-slider-thumb {
    background: #0056b3;
}

.form-range:focus::-moz-range-thumb {
    background: #0056b3;
}

.quality-display {
    display: inline-block;
    min-width: 30px; /* Ensure space for number */
    margin-left: 10px;
    font-weight: bold;
    color: #007bff;
}

.export-options .btn-lg {
    width: auto;
    display: block;
    margin: 0 auto; /* Center the export button */
}

.output-preview {
    margin-top: 25px;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    background-color: #fdfdfd;
    text-align: center;
}

.output-preview h3 {
    font-size: 1.1em;
    color: #007bff;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.preview-box {
    width: 100%;
    max-width: 300px; /* Limit preview size */
    height: 200px; /* Fixed height for consistency */
    border: 1px dashed #ccc; /* Dashed border for preview */
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 15px auto 0; /* Center the preview box and add top margin */
}

.preview-box img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Ensure image scales correctly within the box */
}

.preview-box p {
    color: #888;
    font-style: italic;
    font-size: 0.9em;
}

/* Drag over effect for canvas */
#myCanvas.drag-over {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3);
    background-color: #e6f2ff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .canvas-actions {
        flex-direction: column; /* Stack buttons vertically */
        align-items: center;
    }
    .canvas-actions .btn {
        width: 80%; /* Make buttons wider */
    }
}