/* /tools/image-converter/styles.css */

.tooly-image-converter-page {
    margin-top: var(--tooly-spacing-xl);
}

.tooly-image-converter {
    padding: var(--tooly-spacing-xl);
}

.tooly-converter-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Responsive columns */
    gap: var(--tooly-spacing-xl);
}

.tooly-input-section,
.tooly-options-section,
.tooly-output-section {
    display: flex;
    flex-direction: column;
    gap: var(--tooly-spacing-md);
    background-color: var(--tooly-bg); /* Light background for sections */
    padding: var(--tooly-spacing-lg);
    border-radius: var(--tooly-radius-lg);
    border: 1px solid var(--tooly-border);
}

.tooly-input-section h2,
.tooly-options-section h2,
.tooly-output-section h2 {
    font-size: var(--tooly-font-size-lg);
    font-weight: 600;
    border-bottom: 1px solid var(--tooly-border);
    padding-bottom: var(--tooly-spacing-sm);
    margin-bottom: var(--tooly-spacing-md);
    display: flex;
    align-items: center;
    gap: var(--tooly-spacing-sm);
}

/* File Input Styling */
.tooly-file-input-wrapper {
    display: flex;
    align-items: center;
    gap: var(--tooly-spacing-md);
}
.tooly-file-input-wrapper input[type="file"] {
    display: none; /* Hide the default input */
}
.tooly-file-input-wrapper .tooly-btn {
    flex-shrink: 0; /* Prevent button shrinking */
}
.tooly-file-input-wrapper .tooly-btn span {
    margin-left: var(--tooly-spacing-xs);
}
.tooly-file-name {
    font-size: var(--tooly-font-size-sm);
    color: var(--tooly-text-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

/* Image Preview */
.tooly-image-preview-container {
    margin-top: var(--tooly-spacing-md);
    max-width: 100%;
    border: 1px dashed var(--tooly-border);
    padding: var(--tooly-spacing-sm);
    border-radius: var(--tooly-radius-md);
    background-color: var(--tooly-card-bg);
    min-height: 100px; /* Ensure some height */
    display: flex; /* Centering */
    align-items: center;
    justify-content: center;
}
#image-preview {
    max-width: 100%;
    max-height: 250px; /* Limit preview height */
    display: block; /* Prevent extra space */
    border-radius: var(--tooly-radius-sm);
}

/* Upload Note */
.tooly-upload-note {
    font-size: var(--tooly-font-size-xs);
    color: var(--tooly-text-light);
    margin-top: var(--tooly-spacing-sm);
    font-style: italic;
}

/* Quality Slider */
.tooly-quality-group {
    display: flex;
    align-items: center;
    gap: var(--tooly-spacing-md);
}
.tooly-quality-group .tooly-range-slider {
    flex-grow: 1;
    cursor: pointer;
    height: 8px;
    background: var(--tooly-border);
    border-radius: var(--tooly-radius-sm);
    -webkit-appearance: none; appearance: none; outline: none;
}
.tooly-quality-group .tooly-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 20px; height: 20px;
    background: var(--tooly-primary); border-radius: 50%; cursor: pointer;
}
.tooly-quality-group .tooly-range-slider::-moz-range-thumb {
    width: 20px; height: 20px; background: var(--tooly-primary);
    border-radius: 50%; cursor: pointer; border: none;
}

/* Convert Button & Loading Indicator */
.tooly-options-section .tooly-btn-primary {
    margin-top: var(--tooly-spacing-sm); /* Space above button */
    width: 100%; /* Make button full width */
}
.tooly-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--tooly-spacing-sm);
    margin-top: var(--tooly-spacing-md);
    color: var(--tooly-text-medium);
    font-size: var(--tooly-font-size-sm);
}
.tooly-loading-indicator .tooly-spinner {
    width: 20px; /* Smaller spinner */
    height: 20px;
    border-width: 2px;
}

/* Output Section */
.tooly-output-container {
    border: 1px dashed var(--tooly-border);
    padding: var(--tooly-spacing-sm);
    border-radius: var(--tooly-radius-md);
    min-height: 200px; /* Ensure space for placeholder */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--tooly-card-bg);
}
#output-image {
    max-width: 100%;
    max-height: 300px; /* Limit output image display height */
    display: block;
    border-radius: var(--tooly-radius-sm);
}
.tooly-placeholder {
    text-align: center;
    color: var(--tooly-text-light);
    font-size: var(--tooly-font-size-sm);
}
.tooly-placeholder img {
    opacity: 0.6;
    margin-bottom: var(--tooly-spacing-sm);
}
.tooly-output-section #download-link {
    margin-top: var(--tooly-spacing-md); /* Space above download */
    width: 100%;
}

/* Error Messages */
.tooly-error-message {
    color: var(--tooly-error);
    background-color: var(--tooly-error-light);
    border: 1px solid var(--tooly-error);
    border-radius: var(--tooly-radius-sm);
    padding: var(--tooly-spacing-sm) var(--tooly-spacing-md);
    margin-top: var(--tooly-spacing-sm);
    font-size: var(--tooly-font-size-sm);
    display: none; /* Hidden by default */
}
.tooly-server-error { /* Specific style for GD error */
    display: block; /* Show always if present */
    text-align: center;
}
.tooly-server-error p i {
    margin-right: var(--tooly-spacing-xs);
}

@media (max-width: 768px) {
    .tooly-converter-layout {
        /* Already responsive with auto-fit */
    }
}

@media (max-width: 576px) {
    .tooly-file-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    .tooly-file-name {
        text-align: center;
        margin-top: var(--tooly-spacing-xs);
    }
    .tooly-quality-group {
        flex-direction: column;
        align-items: stretch;
    }
    .tooly-quality-group label {
        text-align: center;
    }
}