/* General Reset & Base */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4; /* Example background for body */
}

.image-ninja-resizer-container {
    max-width: 900px;
    margin: 30px auto;
    padding: 25px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

/* H2 Title styles removed as H2 element is removed */

.image-ninja-resizer-container h3 {
    color: #333;
    text-align: center;
    font-size: 1.2em;
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* NEW Drag & Drop Upload Section */
.drop-zone-area {
    border: 3px dashed #007bff;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background-color: #f8f9fa;
    color: #007bff;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    margin-bottom: 30px;
    position: relative; /* For file name display positioning if needed */
}

.drop-zone-area.dragover {
    background-color: #e9ecef;
    border-color: #0056b3;
}

.drop-zone-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.drop-zone-prompt .upload-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 15px;
    fill: #007bff; /* Color for the SVG icon */
}

.drop-zone-prompt p {
    margin: 5px 0;
    font-size: 1.1em;
    color: #495057;
}

.drop-zone-prompt .drop-zone-or {
    font-size: 0.9em;
    color: #6c757d;
    margin: 10px 0;
}

.select-file-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.3s ease;
    margin-top: 5px;
}

.select-file-btn:hover {
    background-color: #0056b3;
}

.file-size-limit {
    font-size: 0.85em !important; /* Ensure higher specificity if needed */
    color: #6c757d !important;
    margin-top: 10px !important;
}

.file-name {
    margin-top: 15px;
    font-style: italic;
    color: #555;
    font-size: 0.9em;
}

/* Old upload-button styles are no longer needed */
/*
.upload-button { ... }
.upload-button:hover { ... }
*/

/* Previews Section */
.previews-section {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap; /* For mobile */
}

.preview-box {
    flex: 1;
    min-width: 280px; /* Ensure some width on smaller flex views */
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    text-align: center;
}
.preview-box h3 {
    margin-top: 0;
}

.image-wrapper {
    width: 100%;
    height: 250px; /* Fixed height for consistency */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Prevent image overflow */
    border: 1px dashed #ccc;
    margin-bottom: 10px;
}

.preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Scale down to fit, maintaining aspect ratio */
    display: block; /* Remove extra space below image */
}

.preview-box p {
    font-size: 0.9em;
    color: #666;
}

/* Controls Section */
.controls-section {
    margin-bottom: 30px;
    display: flex;
    gap: 30px;
    flex-wrap: wrap; /* For mobile */
}

.control-group {
    flex: 1;
    min-width: 280px; /* Ensure some width on smaller flex views */
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background: #fdfdfd;
}

.input-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.input-row label {
    min-width: 100px; /* Align inputs */
    margin-right: 10px;
    font-size: 0.95em;
    color: #444;
}

.input-row input[type="number"],
.input-row input[type="text"] {
    flex-grow: 1;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    box-sizing: border-box; /* Important for flex items */
}

.input-row.checkbox-row label {
    min-width: auto; /* Reset for checkbox */
    margin-left: 5px;
}
.input-row input[type="checkbox"] {
    margin-right: 5px;
}


.percentage-presets {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap; /* Allow buttons to wrap */
}

.preset-btn,
#apply-custom-percentage {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.preset-btn:hover,
#apply-custom-percentage:hover {
    background-color: #0056b3;
}

#apply-custom-percentage {
    margin-left: 10px;
}


/* Download Section */
.download-section {
    text-align: center;
    margin-top: 20px;
}

.download-button {
    display: inline-block;
    padding: 12px 30px;
    background-color: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 1.1em;
    transition: background-color 0.3s ease;
}

.download-button:hover {
    background-color: #218838;
}
.download-button.disabled {
    background-color: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

/* Error Message */
.error-message {
    color: red;
    text-align: center;
    margin-top: 15px;
    font-weight: bold;
}


/* Mobile Friendliness */
@media (max-width: 768px) {
    .previews-section,
    .controls-section {
        flex-direction: column;
    }

    .preview-box,
    .control-group {
        width: 100%; /* Full width on small screens */
        margin-bottom: 20px;
    }
    .image-wrapper {
        height: 200px; /* Adjust preview height for mobile */
    }
    .drop-zone-area {
        padding: 20px;
    }
    .drop-zone-prompt p {
        font-size: 1em;
    }
    .select-file-btn {
        font-size: 0.95em;
        padding: 8px 18px;
    }
}

@media (max-width: 480px) {
    .image-ninja-resizer-container {
        padding: 15px;
    }

    .download-button, .preset-btn, #apply-custom-percentage {
        font-size: 0.9em;
        padding: 10px 15px;
    }
    .input-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .input-row label {
        margin-bottom: 5px;
        min-width: auto;
    }
    .input-row input[type="number"] {
        width: 100%;
    }
    #apply-custom-percentage {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
    .percentage-presets button {
        flex-grow: 1; /* Make buttons take equal space and wrap nicely */
    }
    .drop-zone-prompt .upload-icon {
        width: 40px;
        height: 40px;
    }
}