/* ==========================================================================
   Image Compressor & WebP Converter Styles
   ========================================================================== */

.image-compressor-container {
    max-width: 900px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Panel & Settings --- */
.generator-panel {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.generator-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
}

.generator-panel h3 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.25rem;
    color: #333;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 600px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: bold;
    color: #444;
    margin-bottom: 8px;
    font-size: 14px;
}

.generator-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fafafa;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.generator-input:focus {
    border-color: #4a90e2;
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.info-text {
    font-size: 12px;
    color: #777;
    margin-top: 5px;
    line-height: 1.4;
}

/* --- Slider --- */
.quality-slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.quality-slider {
    flex: 1;
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    transition: background 0.15s ease-in-out;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4facfe;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

.quality-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.quality-value-display {
    font-weight: bold;
    color: #0056b3;
    font-size: 16px;
    min-width: 40px;
    text-align: right;
}

/* --- Drag & Drop Area --- */
.drop-zone {
    border: 2px dashed #4facfe;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background-color: #f8fbff;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.drop-zone.dragover {
    background-color: #e6f2ff;
    border-color: #00f2fe;
    box-shadow: inset 0 0 10px rgba(0, 242, 254, 0.2);
}

.drop-zone-icon {
    font-size: 48px;
    color: #4facfe;
    margin-bottom: 15px;
}

.drop-zone-text {
    font-size: 18px;
    color: #333;
    font-weight: bold;
    margin-block-end: 10px;
}

.drop-zone-subtext {
    font-size: 13px;
    color: #666;
    margin-bottom: 20px;
}

.btn-select-files {
    display: inline-block;
    background: #0056b3;
    color: #fff;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
}

.btn-select-files:hover {
    background: #004494;
}

.file-input {
    display: none;
}

/* --- Result List Area --- */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h3 {
    margin: 0;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
}

.results-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
}

@media (max-width: 600px) {
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .results-header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .btn-download-all,
    .btn-clear-all {
        flex: 1;
        justify-content: center;
        padding: 10px 12px;
        font-size: 13px;
    }
}

.btn-download-all {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn-download-all:hover {
    background: #218838;
}

.btn-download-all:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-clear-all {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn-clear-all:hover {
    background: #5a6268;
}

.btn-clear-all:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- Individual Result Item --- */
.result-item {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #eee;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.result-item:hover {
    border-color: #ddd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.item-preview {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    background: #f0f0f0;
    margin-right: 15px;
    border: 1px solid #ddd;
}

.item-details {
    flex: 1;
    min-width: 0;
    /* allows text truncation */
}

.item-filename {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.item-meta {
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.size-original {
    text-decoration: line-through;
    color: #999;
}

.size-new {
    color: #28a745;
    font-weight: bold;
}

.savings-badge {
    background: #e6f4ea;
    color: #1e8e3e;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 11px;
}

.savings-badge.negative {
    background: #fce8e6;
    color: #d93025;
}

.item-actions {
    margin-left: 15px;
    display: flex;
    gap: 8px;
}

.btn-download-single {
    background: #007bff;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-download-single:hover {
    background: #0056b3;
}

.btn-remove-single {
    background: #f8f9fa;
    color: #dc3545;
    border: 1px solid #ddd;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-remove-single:hover {
    background: #ffeeba;
    border-color: #ffc107;
    color: #d39e00;
}

/* Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 86, 179, 0.3);
    border-radius: 50%;
    border-top-color: #0056b3;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 600px) {
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        position: relative;
    }

    .item-preview {
        margin-bottom: 10px;
    }

    .item-actions {
        position: absolute;
        top: 12px;
        right: 12px;
        margin-left: 0;
    }
}