/*
 * Stylesheet for the Mango Squeeze Front‑end plugin.
 *
 * This file defines a clean, responsive layout for the front‑end image
 * compression interface. The colours and spacing are inspired by Mango
 * Innovation’s branding palette – warm oranges paired with subtle neutrals.
 */

/* Root wrapper constrains the width and centers the interface */
.mango-squeeze-frontend-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    /* Remove border and shadow from wrapper; the card below provides the styling */
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* Card replicating the reference design */
.msq-card {
    /* Orange top border and green bottom border to match the reference */
    border-radius: 8px;
    box-shadow: 0 1rem 1rem rgba(0, 0, 0, 0.15);
    background: #fff;
    margin-bottom: 20px;
    position: relative;
}

/* Card header with title and settings */
.msq-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f2f2f2;
}
/* Title area inside header */
.msq-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #2a2a2a;
    font-size: 1rem;
}
.msq-card-icon img {
    width: 5rem;
    height: 5rem;
}
.msq-card-name {
    font-size: 2rem;
    line-height: 1;
}
/* Image count pill */
.msq-image-count {
    margin-left: 8px;
    padding: 2px 6px;
    font-size: 0.75rem;
    border-radius: 12px;
    background: #ffece1;
    color: #f47329;
    font-weight: 600;
}
/* Settings button with arrow */
.msq-settings-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.875rem;
    border: 1px solid #cccccc;
    border-radius: 4px;
    background: #fafafa;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.msq-settings-btn:hover {
    background: #f0f0f0;
}
.msq-settings-arrow {
    font-size: 1rem;
    margin-left: 4px;
}

/* Card body */
.msq-card-body {
    padding: 20px 16px 16px 16px;
}

/* Format tags */
.msq-format-tags {
    margin-top: 12px;
}
.msq-tag {
    display: inline-block;
    margin-right: 6px;
    margin-bottom: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    line-height: 1.4;
}
.msq-tag.supported {
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    color: #555;
}
.msq-tag.unsupported {
    background: #fcfcfc;
    border: 1px solid #f0f0f0;
    color: #aaa;
}

/* Settings panel; hidden until toggled */
.msq-settings-panel {
    padding: 16px;
    border-bottom: 1px solid #f2f2f2;
    display: none;
}

/* Upload icon styling */
/* Upload icon container. Use a circular badge with a warm gradient and
   centre the custom SVG. The colours draw from Mango Innovation's
   palette to subtly match the main website. */
.msq-upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    /* Mango inspired gradient: deeper orange to soft yellow */
    background: #f94300;
    color: #fff;
    margin-bottom: 12px;
    transition: background 0.3s ease;
}
/* Scale the SVG within the upload icon and inherit stroke colour */
.msq-upload-icon svg {
    width: 32px;
    height: 32px;
    color: inherit;
}
/* Hover state for upload icon */
.msq-dropzone:hover .msq-upload-icon,
.msq-dropzone.dragover .msq-upload-icon {
    background: linear-gradient(135deg, #e0752d, #e89f3c);
}

/* Dropzone container */
.msq-dropzone {
    border: 2px dashed #e0e0e0;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #444;
    font-size: 1rem;
    background: #ffffff;
    position: relative;
}
.msq-dropzone:hover,
.msq-dropzone.dragover {
    background-color: #f8f8f8;
}
.msq-drop-text {
    margin: 0;
    color: #444;
    font-size: 1.1rem;
    font-weight: 500;
}
.msq-drop-subtext {
    margin-top: 4px;
    color: #777;
    font-size: 0.85rem;
}
/* Format tags within dropzone */
.msq-dropzone .msq-format-tags {
    margin-top: 12px;
}
.msq-dropzone .msq-tag {
    display: inline-block;
    margin: 0 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    color: #666;
}
.msq-dropzone .msq-tag.unsupported {
    opacity: 0.5;
}

/* Hide old header styles */
.msq-header,
.msq-title,
.msq-logo {
    display: none;
}

/* Update results and preview item styles remain unchanged */

/* Header with logo and title */
.msq-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}
.msq-logo {
    width: 48px;
    height: 48px;
    margin-right: 12px;
}
.msq-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #e58e26; /* warm mango orange */
    margin: 0;
}

/* Dropzone styling */
.msq-dropzone {
    border: 2px dashed #dcdcdc;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #555;
    font-size: 1rem;
    margin-bottom: 20px;
    background: #fafafa;
}
.msq-dropzone:hover,
.msq-dropzone.dragover {
    background-color: #f5f5f5;
}
.msq-dropzone p {
    margin: 0;
}

/* Options section */
.msq-options {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    align-items: center;
}
.msq-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #333;
}
.msq-options select,
.msq-options input[type="range"],
.msq-options input[type="number"] {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}
.msq-options input[type="range"] {
    width: 150px;
}
.msq-resize-options {
    display: flex;
    align-items: center;
    gap: 6px;
}
.msq-resize-options input[type="number"] {
    width: 70px;
}
/* New controls styling */
.msq-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.msq-control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}
.msq-control-item {
    flex: 1 1 250px;
}
.msq-control-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
    text-align: left;
}
.msq-control-item input[type="range"] {
    width: 100%;
}
/*********** Baseline, reset styles ***********/
.msq-control-item input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    height: 2rem;
}

/* Removes default focus */
.msq-control-item input[type="range"]:focus {
    outline: none;
}

/******** Chrome, Safari, Opera and Edge Chromium styles ********/
/* slider track */
.msq-control-item input[type="range"]::-webkit-slider-runnable-track {
    background-color: #e5e7e6;
    border-radius: 0.5rem;
    height: 1rem;
}

/* slider thumb */
.msq-control-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; /* Override default look */
    appearance: none;
    margin-top: -4px; /* Centers thumb on the track */
    background-color: #f94300;
    border-radius: 1rem;
    height: 1.5rem;
    width: 1.5rem;
}

.msq-control-item input[type="range"]:focus::-webkit-slider-thumb {
    outline: 3px solid #f94300;
    outline-offset: 0.125rem;
}

/*********** Firefox styles ***********/
/* slider track */
.msq-control-item input[type="range"]::-moz-range-track {
    background-color: #e5e7e6;
    border-radius: 0.5rem;
    height: 1rem;
}

/* slider thumb */
.msq-control-item input[type="range"]::-moz-range-thumb {
    background-color: #f94300;
    border: none; /*Removes extra border that FF applies*/
    border-radius: 1rem;
    height: 1.5rem;
    width: 1.5rem;
}

.msq-control-item input[type="range"]:focus::-moz-range-thumb{
    outline: 3px solid #f94300;
    outline-offset: 0.125rem;
}

#msq-output-format{
    text-align: left;
}


.msq-format-note {
    font-size: 0.75rem;
    color: #777;
    margin-top: 4px;
}
.msq-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #888;
    margin-top: 4px;
}
.msq-apply-btn {
    background: #f66327;
    border: none;
    padding: 10px 18px;
    color: #fff;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.msq-apply-btn:hover {
    background: #dd5a21;
}
.msq-resize-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}
.msq-resize-options {
    display: flex;
    align-items: center;
    gap: 6px;
}
.msq-resize-options input[type="number"] {
    width: 126px;
}

/* Results and previews */
.msq-results {
    margin-top: 20px;
    padding: 24px;
    border-radius: 8px;
}
/* Status area notices */
#msq-status-area .notice {
    margin-bottom: 15px;
    padding: 10px 12px;
    border-radius: 4px;
}
/* Notice colors */
#msq-status-area .notice.notice-error {
    background: #ffecec;
    border: 1px solid #f5c2c2;
    color: #b71c1c;
}
#msq-status-area .notice.notice-success {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    color: #2e7d32;
}
#msq-status-area .notice.notice-info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    color: #0d47a1;
}

/* Each preview item */
/* Preview list container */
.msq-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 20px;
}
/* Each preview item */
.msq-preview-item {
    position: relative;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    width: 100%;
    max-width: 360px;
    box-sizing: border-box;
    box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.msq-preview-item h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}
.msq-preview-images {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}
.msq-preview-images img {
    max-width: 140px;
    border: 1px solid #eee;
    border-radius: 4px;
}
.msq-file-info {
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
}
.msq-download-btn {
    display: inline-block;
    margin-top: 4px;
    background: #f66327;
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}
.msq-download-btn:hover {
    background: #dd5a21;
}
/* Saved percentage badge */
.msq-saved-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #009b5c;
    color: #fff;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}
/* Remove item button */
.msq-remove-item {
    position: absolute;
    top: 6px;
    right: 6px;
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 1rem;
}
.msq-remove-item:hover {
    color: #666;
}
/* Progress area */
.msq-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: #fafafa;
    font-size: 0.85rem;
    color: #333;
}
.msq-progress span {
    margin-right: 8px;
}
.msq-progress #msq-total-saved {
    color: #009b5c;
    font-weight: 600;
}
.msq-progress-actions {
    display: flex;
    gap: 10px;
}
.msq-download-all {
    background: #4caf50;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}
.msq-download-all:hover {
    background: #3f9a43;
}
.msq-clear-all {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}
.msq-clear-all:hover {
    background: #ececec;
}

/* Responsive tweaks */
@media (max-width: 600px) {
    .msq-preview-images {
        flex-direction: column;
    }
    .msq-options {
        flex-direction: column;
        align-items: flex-start;
    }
    .msq-options input[type="range"] {
        width: 100%;
    }
    .msq-resize-options {
        flex-direction: row;
    }
    .msq-card-header{
        display: block;
    }
    .msq-settings-btn{
        margin-top: 1rem;
    }
}