/* Motu DS v1.1 — MotuCloud Batch Image Resize, Crop & EXIF Stripper */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--motu-font-ui);
    font-size: var(--motu-text-base);
    font-weight: 400;
    line-height: var(--motu-lh-normal);
    color: var(--motu-ink);
    background: transparent;
    font-synthesis: none;
    -webkit-font-smoothing: antialiased;
}

.resize-container {
    max-width: 960px;
    margin: 0 auto;
    background: var(--motu-surface);
    border: 1px solid var(--motu-line);
    border-radius: var(--motu-r-lg);
    padding: 28px;
    box-shadow: var(--motu-shadow-none);
    overflow: hidden;
}

/* Drop Zone */
.drop-zone {
    border: 1.5px dashed var(--motu-line-strong);
    border-radius: var(--motu-r-lg);
    padding: 36px 24px;
    text-align: center;
    background: var(--motu-surface-soft);
    transition: border-color var(--motu-dur) var(--motu-ease), background-color var(--motu-dur) var(--motu-ease);
    cursor: pointer;
    position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--motu-wine);
    background: var(--motu-wine-soft);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-zone-content button {
    pointer-events: auto;
}

.upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--motu-wine);
    margin-bottom: 10px;
}

.drop-zone h3 {
    font-family: var(--motu-font-ui);
    font-size: 16px;
    font-weight: 400;
    color: var(--motu-ink);
    margin-bottom: 6px;
    line-height: 1.4;
}

.drop-zone p {
    color: var(--motu-muted);
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 16px;
    line-height: 1.5;
}

.drop-zone-hint {
    margin-top: 12px;
    margin-bottom: 0 !important;
    font-size: 12px !important;
    color: var(--motu-muted);
}

.file-input {
    display: none;
}

/* Unified 40px Button Scale */
.browse-btn,
.primary-btn,
.secondary-btn,
.preset-pill,
.download-link {
    height: 40px;
    padding: 0 18px;
    border-radius: 8px;
    font-family: var(--motu-font-ui);
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: background-color var(--motu-dur) var(--motu-ease),
        border-color var(--motu-dur) var(--motu-ease),
        color var(--motu-dur) var(--motu-ease);
}

.browse-btn,
.primary-btn,
.download-link {
    background: var(--motu-cta);
    color: var(--motu-on-cta);
    border: 1px solid var(--motu-cta);
}

.browse-btn:hover,
.primary-btn:hover,
.download-link:hover {
    background: var(--motu-cta-hover);
    border-color: var(--motu-cta-hover);
}

.primary-btn:disabled {
    background: var(--motu-surface-muted);
    border-color: var(--motu-line);
    color: var(--motu-faint);
    cursor: not-allowed;
}

.secondary-btn {
    background: var(--motu-surface);
    color: var(--motu-ink);
    border: 1px solid var(--motu-line-strong);
    padding: 0 14px;
}

.secondary-btn:hover {
    background: var(--motu-surface-hover);
    border-color: var(--motu-ink);
}

/* File Queue */
.file-queue {
    margin-top: 18px;
    background: var(--motu-surface-soft);
    border: 1px solid var(--motu-line);
    border-radius: var(--motu-r-lg);
    padding: 16px 20px;
}

.file-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.file-queue-meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.file-queue-title {
    font-size: 14px;
    font-weight: 400;
    color: var(--motu-ink);
}

.file-queue-size {
    font-size: 12px;
    color: var(--motu-muted);
    font-variant-numeric: tabular-nums;
}

.file-queue-actions {
    display: flex;
    gap: 8px;
}

.file-queue-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 176px;
    overflow-y: auto;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--motu-surface);
    border: 1px solid var(--motu-line);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--motu-ink-2);
    max-width: 100%;
}

.file-chip-name {
    max-width: 168px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--motu-ink);
}

.file-chip-dim,
.file-chip-size {
    color: var(--motu-muted);
    font-variant-numeric: tabular-nums;
}

.file-chip-exif {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: var(--motu-r-xs);
    background: var(--motu-warn-soft);
    color: var(--motu-warn);
    border: 1px solid rgba(146, 64, 14, 0.2);
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
}

.file-chip-remove {
    border: 0;
    background: transparent;
    color: var(--motu-muted);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.file-chip-remove:hover {
    color: var(--motu-danger);
    background: var(--motu-danger-soft);
}

/* Settings Panel */
.settings-panel {
    background: var(--motu-surface-soft);
    border: 1px solid var(--motu-line);
    border-radius: var(--motu-r-lg);
    padding: 22px 24px;
    margin-top: 20px;
}

.settings-title {
    font-family: var(--motu-font-ui);
    font-size: 16px;
    font-weight: 400;
    color: var(--motu-ink);
    line-height: 1.4;
    margin-bottom: 6px;
}

.settings-desc {
    font-size: 13px;
    font-weight: 400;
    color: var(--motu-muted);
    line-height: 1.6;
    margin-bottom: 18px;
}

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--motu-ink-2);
    line-height: 1.4;
    margin-bottom: 6px;
}

/* Preset Pills */
.preset-section {
    margin-bottom: 18px;
}

.preset-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preset-pill {
    background: var(--motu-surface);
    color: var(--motu-ink-2);
    border: 1px solid var(--motu-line-strong);
    padding: 0 14px;
}

.preset-pill:hover {
    border-color: var(--motu-wine);
    color: var(--motu-wine);
    background: var(--motu-wine-soft);
}

.preset-pill.active {
    background: var(--motu-wine-fill);
    border-color: var(--motu-wine-fill);
    color: var(--motu-on-wine);
}

.preset-section.is-muted .preset-pill {
    opacity: 0.6;
}

/* Controls Grids */
.controls-grid {
    display: grid;
    gap: 12px;
    align-items: end;
}

.controls-grid--primary {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr) minmax(0, 1fr);
    margin-bottom: 14px;
}

.controls-grid--secondary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.control-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.control-field.is-disabled {
    opacity: 0.55;
}

.control-select,
.control-input {
    width: 100%;
    height: 40px;
    border: 1px solid var(--motu-line-strong);
    border-radius: 8px;
    font-family: var(--motu-font-ui);
    font-size: 14px;
    font-weight: 400;
    color: var(--motu-ink);
    background-color: var(--motu-surface);
    line-height: 1.2;
    transition: border-color var(--motu-dur) var(--motu-ease);
}

.control-select {
    padding: 0 36px 0 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23666666' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px 14px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.control-input {
    padding: 0 12px;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}

.control-input::-webkit-inner-spin-button,
.control-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.control-select:focus,
.control-input:focus {
    outline: 2px solid var(--motu-ink);
    outline-offset: 1px;
    border-color: var(--motu-ink);
}

.control-select:disabled,
.control-input:disabled {
    background-color: var(--motu-surface-muted);
    color: var(--motu-faint);
    cursor: not-allowed;
}

.input-suffix-box {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: 40px;
    border: 1px solid var(--motu-line-strong);
    border-radius: 8px;
    background: var(--motu-surface);
    overflow: hidden;
}

.input-suffix-box:focus-within {
    outline: 2px solid var(--motu-ink);
    outline-offset: 1px;
    border-color: var(--motu-ink);
}

.control-input--suffix {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.control-input--suffix:focus {
    outline: none;
    border-color: transparent;
}

.input-suffix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    background: var(--motu-surface-soft);
    border-left: 1px solid var(--motu-line);
    color: var(--motu-muted);
    font-size: 13px;
    user-select: none;
}

/* Action Bar */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--motu-line);
    flex-wrap: wrap;
}

.privacy-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--motu-muted);
}

.privacy-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--motu-ok);
    flex-shrink: 0;
}

/* Progress */
.progress-container {
    display: none;
    margin-top: 24px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--motu-surface-muted);
    border-radius: var(--motu-r-pill);
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--motu-wine-fill);
    width: 0%;
    transition: width 0.25s var(--motu-ease);
    border-radius: var(--motu-r-pill);
}

.progress-text {
    font-size: 13px;
    color: var(--motu-muted);
    font-weight: 400;
    margin-bottom: 10px;
}

.loading-spinner {
    border: 2px solid var(--motu-line);
    border-top-color: var(--motu-wine);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    animation: spin 0.9s linear infinite;
    margin: 10px auto 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results */
.results-container {
    display: none;
    margin-top: 22px;
}

.results-panel {
    background: var(--motu-surface-soft);
    border: 1px solid var(--motu-line);
    border-radius: var(--motu-r-lg);
    padding: 22px 24px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.results-title {
    font-family: var(--motu-font-ui);
    font-size: 16px;
    font-weight: 400;
    color: var(--motu-ink);
    margin: 0;
    line-height: 1.4;
}

.batch-summary {
    margin-top: 4px;
    font-size: 13px;
    color: var(--motu-muted);
    font-variant-numeric: tabular-nums;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.result-card {
    background: var(--motu-surface);
    border: 1px solid var(--motu-line);
    border-radius: var(--motu-r-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    transition: border-color var(--motu-dur) var(--motu-ease);
}

.result-card:hover {
    border-color: var(--motu-line-strong);
}

.result-preview-wrap {
    width: 100%;
    height: 140px;
    border-radius: 8px;
    border: 1px solid var(--motu-line);
    margin-bottom: 10px;
    overflow: hidden;
    background-color: var(--motu-surface-soft);
    background-image:
        linear-gradient(45deg, #EAEAEA 25%, transparent 25%),
        linear-gradient(-45deg, #EAEAEA 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #EAEAEA 75%),
        linear-gradient(-45deg, transparent 75%, #EAEAEA 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
    display: block;
}

.result-name {
    font-size: 13px;
    font-weight: 400;
    color: var(--motu-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.result-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.exif-cleared-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--motu-r-pill);
    background: var(--motu-ok-soft);
    color: var(--motu-ok);
    border: 1px solid rgba(22, 101, 52, 0.2);
    font-size: 11px;
    line-height: 1.4;
}

.exif-detected-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--motu-r-pill);
    background: var(--motu-warn-soft);
    color: var(--motu-warn);
    border: 1px solid rgba(146, 64, 14, 0.2);
    font-size: 11px;
    line-height: 1.4;
}

.result-meta {
    font-size: 12px;
    color: var(--motu-muted);
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
    margin-bottom: 12px;
    flex: 1;
}

.result-delta--down {
    color: var(--motu-ok);
}

.result-delta--up {
    color: var(--motu-wine);
}

.result-card .download-link {
    width: 100%;
}

/* Error Message */
.error-message {
    background: var(--motu-danger-soft);
    border: 1px solid var(--motu-wine-line);
    border-left: 3px solid var(--motu-danger);
    color: var(--motu-danger);
    padding: 12px 16px;
    border-radius: var(--motu-r-md);
    margin-top: 18px;
    display: none;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: var(--motu-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--motu-z-modal);
    cursor: pointer;
    padding: 24px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    max-width: 92%;
    max-height: 92%;
    object-fit: contain;
    border-radius: var(--motu-r-md);
    box-shadow: var(--motu-shadow-modal);
    background: var(--motu-surface);
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .resize-container {
        padding: 18px;
    }

    .drop-zone {
        padding: 28px 16px;
    }

    .settings-panel,
    .results-panel {
        padding: 18px 16px;
    }

    .controls-grid--primary,
    .controls-grid--secondary {
        grid-template-columns: 1fr;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .action-bar .primary-btn {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}
