/* ── Image Resizer ─────────────────────────────────────────────────────
   Styles for the Image Resizer tool.
   Prefix: .rsz-
   ─────────────────────────────────────────────────────────────────────── */

/* ── Privacy Badge ───────────────────────────────────────────────────────── */
.rsz-privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.25);
    border-radius: 20px;
    color: #059669;
    font-size: var(--text-xs);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

/* ── Mode Tabs ───────────────────────────────────────────────────────────── */
.rsz-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-5);
    border-bottom: 2px solid var(--color-border);
}
.rsz-mode-tab {
    padding: 9px 20px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    font-family: var(--font-body);
}
.rsz-mode-tab:hover { color: var(--color-text); }
.rsz-mode-tab.is-active { color: var(--color-accent); border-bottom-color: var(--color-accent); }

/* ── Panels ──────────────────────────────────────────────────────────────── */
.rsz-panel { display: none; }
.rsz-panel.is-active { display: block; }


/* ── Workspace (two-column layout on desktop) ───────────────────────────── */
.rsz-workspace { display: none; }
.rsz-workspace.is-visible {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-4);
    align-items: start;
}
@media (max-width: 1100px) {
    .rsz-workspace.is-visible { grid-template-columns: 1fr; }
}

/* ── Canvas Area ─────────────────────────────────────────────────────────── */
.rsz-canvas-area {
    position: sticky;
    top: 80px;
    border-radius: var(--radius-lg);
    overflow: clip;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}
@media (max-width: 1100px) {
    .rsz-canvas-area { position: relative; }
}

/* Ruler bar (top) */
.rsz-ruler-top {
    height: 24px;
    background: var(--color-surface-alt, #f1f5f9);
    border-bottom: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
    margin-left: 24px;
}
[data-theme="dark"] .rsz-ruler-top { background: rgba(255,255,255,0.04); }

.rsz-ruler-top canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Ruler bar (left) */
.rsz-ruler-left {
    width: 24px;
    position: absolute;
    top: 24px;
    left: 0;
    bottom: 0;
    background: var(--color-surface-alt, #f1f5f9);
    border-right: 1px solid var(--color-border);
    overflow: hidden;
    z-index: 2;
}
[data-theme="dark"] .rsz-ruler-left { background: rgba(255,255,255,0.04); }

.rsz-ruler-left canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Ruler corner */
.rsz-ruler-corner {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    background: var(--color-surface-alt, #f1f5f9);
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: var(--color-text-muted);
}
[data-theme="dark"] .rsz-ruler-corner { background: rgba(255,255,255,0.04); }

/* Canvas viewport (checkered bg) */
.rsz-canvas-viewport {
    position: relative;
    min-height: 180px;
    max-height: 420px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 24px;
    padding: var(--space-3);
    background-image:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    background-color: #fff;
}
[data-theme="dark"] .rsz-canvas-viewport {
    background-image:
        linear-gradient(45deg, rgba(255,255,255,0.05) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,0.05) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.05) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.05) 75%);
    background-color: #1e293b;
}

/* The image wrapper with drag handles */
.rsz-image-wrapper {
    position: relative;
    display: inline-block;
    transition: width 0.2s ease, height 0.2s ease;
    max-width: 100%;
    max-height: 380px;
    line-height: 0;
}
.rsz-image-wrapper.is-dragging { transition: none; }

.rsz-image-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    pointer-events: none;
    user-select: none;
}

/* Fit-mode classes — applied to wrapper, override img object-fit */
.rsz-image-wrapper.rsz-mode-fit     img { object-fit: contain !important; object-position: center center !important; }
.rsz-image-wrapper.rsz-mode-fill    img { object-fit: cover   !important; object-position: center center !important; }
.rsz-image-wrapper.rsz-mode-stretch img { object-fit: fill    !important; object-position: center center !important; }
.rsz-image-wrapper.rsz-mode-crop    img { object-fit: cover   !important; }

/* Crop position classes (only meaningful in crop mode) */
.rsz-image-wrapper.rsz-crop-top-left     img { object-position: left top     !important; }
.rsz-image-wrapper.rsz-crop-top          img { object-position: center top   !important; }
.rsz-image-wrapper.rsz-crop-top-right    img { object-position: right top    !important; }
.rsz-image-wrapper.rsz-crop-left         img { object-position: left center  !important; }
.rsz-image-wrapper.rsz-crop-center       img { object-position: center center!important; }
.rsz-image-wrapper.rsz-crop-right        img { object-position: right center !important; }
.rsz-image-wrapper.rsz-crop-bottom-left  img { object-position: left bottom  !important; }
.rsz-image-wrapper.rsz-crop-bottom       img { object-position: center bottom!important; }
.rsz-image-wrapper.rsz-crop-bottom-right img { object-position: right bottom !important; }

/* Drag handles */
.rsz-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--color-accent);
    border: 2px solid #fff;
    border-radius: 2px;
    z-index: 10;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    touch-action: none;
}
.rsz-handle:hover { transform: scale(1.3); }
.rsz-handle--nw { top: -6px; left: -6px; cursor: nw-resize; }
.rsz-handle--n  { top: -6px; left: 50%; margin-left: -6px; cursor: n-resize; }
.rsz-handle--ne { top: -6px; right: -6px; cursor: ne-resize; }
.rsz-handle--e  { top: 50%; margin-top: -6px; right: -6px; cursor: e-resize; }
.rsz-handle--se { bottom: -6px; right: -6px; cursor: se-resize; }
.rsz-handle--s  { bottom: -6px; left: 50%; margin-left: -6px; cursor: s-resize; }
.rsz-handle--sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.rsz-handle--w  { top: 50%; margin-top: -6px; left: -6px; cursor: w-resize; }

/* Dimension badge on canvas */
.rsz-dim-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    pointer-events: none;
    z-index: 10;
}

/* Zoom badge on canvas (bottom-left of viewport) */
.rsz-zoom-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(59,130,246,0.85);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    pointer-events: none;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.3s;
}
.rsz-zoom-badge i { font-size: 9px; }

/* Ghost outline: shows original size boundary centered in viewport */
.rsz-ghost-outline {
    position: absolute;
    border: 2px dashed rgba(59,130,246,0.35);
    border-radius: 4px;
    background: rgba(59,130,246,0.02);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease, width 0.3s ease, height 0.3s ease, top 0.3s ease, left 0.3s ease;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.rsz-ghost-outline.is-visible { opacity: 1; }

.rsz-ghost-label {
    position: absolute;
    top: -18px;
    left: 0;
    font-size: 10px;
    font-weight: 600;
    color: rgba(59,130,246,0.6);
    white-space: nowrap;
    font-family: var(--font-body);
    letter-spacing: 0.02em;
}

/* Canvas resize pulse animation */
.rsz-canvas-area.is-resizing {
    box-shadow: 0 0 0 2px rgba(59,130,246,0.4);
    transition: box-shadow 0.15s ease;
}

/* ── Result View (full-width section after resize) ───────────────────────── */
.rsz-result {
    display: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.rsz-result.is-visible { display: block; }

.rsz-result__preview {
    background-image:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0px;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
    min-height: 160px;
    max-height: 400px;
}
[data-theme="dark"] .rsz-result__preview {
    background-image:
        linear-gradient(45deg, rgba(255,255,255,0.04) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255,255,255,0.04) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.04) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.04) 75%);
    background-color: #1e293b;
}

.rsz-result__preview img {
    max-width: 100%;
    max-height: 360px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    display: block;
}

.rsz-result__info {
    padding: var(--space-4) var(--space-5);
}

.rsz-result__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.2);
    color: var(--color-success);
    font-size: var(--text-xs);
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.rsz-result__grid {
    display: flex;
    gap: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-4);
}

.rsz-result__cell {
    flex: 1;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-right: 1px solid var(--color-border);
    min-width: 0;
}
.rsz-result__cell:last-child { border-right: none; }

.rsz-result__cell-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.rsz-result__cell-value {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text);
    word-break: break-word;
}
.rsz-result__cell-value--accent { color: var(--color-success); }
.rsz-result__cell-value--warning { color: var(--color-warning); }

.rsz-result__actions {
    display: flex;
    gap: 8px;
}

.rsz-result__back-btn {
    padding: 10px 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.rsz-result__back-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }

@media (max-width: 480px) {
    .rsz-result__grid { flex-direction: column; }
    .rsz-result__cell { border-right: none; border-bottom: 1px solid var(--color-border); }
    .rsz-result__cell:last-child { border-bottom: none; }
    .rsz-result__actions { flex-direction: column; }
}

/* ── Controls Panel (tabbed sidebar) ─────────────────────────────────────── */
.rsz-controls {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    overflow: hidden;
    max-height: 540px;
}
@media (max-width: 1100px) {
    .rsz-controls { max-height: none; }
}

/* Sidebar tab bar */
.rsz-sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.rsz-sidebar-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.rsz-sidebar-tab i { font-size: 12px; }
.rsz-sidebar-tab:hover { color: var(--color-text); background: var(--color-surface-alt, rgba(0,0,0,0.02)); }
[data-theme="dark"] .rsz-sidebar-tab:hover { background: rgba(255,255,255,0.04); }
.rsz-sidebar-tab.is-active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
    background: transparent;
}

/* Sidebar panels (scrollable) */
.rsz-sidebar-panel {
    display: none;
    overflow-y: auto;
    flex: 1;
    padding: var(--space-3);
}
.rsz-sidebar-panel.is-active { display: block; }

/* Scrollbar styling */
.rsz-sidebar-panel::-webkit-scrollbar { width: 5px; }
.rsz-sidebar-panel::-webkit-scrollbar-track { background: transparent; }
.rsz-sidebar-panel::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
.rsz-sidebar-panel::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

.rsz-control-card {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--color-border-light, var(--color-border));
    border-radius: 0;
    padding: 0 0 var(--space-3);
    margin-bottom: var(--space-3);
}
.rsz-control-card:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

/* ── Size Panel toggle (shared by Pixels / Percentage / Print) ───────── */
.rsz-size-panel { display: none; }
.rsz-size-panel.is-active { display: block; }

.rsz-control-card__title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: 8px;
}
.rsz-control-card__title i { color: var(--color-accent); font-size: 14px; }

/* Dimension inputs row */
.rsz-dim-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.rsz-dim-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 100px;
}

.rsz-dim-group label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rsz-dim-group input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    text-align: center;
    transition: border-color 0.15s;
    -moz-appearance: textfield;
}
.rsz-dim-group input[type="number"]::-webkit-inner-spin-button,
.rsz-dim-group input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.rsz-dim-group input[type="number"]:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* Aspect ratio lock button */
.rsz-lock-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    flex-shrink: 0;
    margin-top: 18px;
}
.rsz-lock-btn:hover {
    transform: translateY(-1px);
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: rgba(59,130,246,0.06);
}
.rsz-lock-btn.is-locked {
    background: linear-gradient(135deg, #3B82F6, #6366F1);
    color: #fff;
    border: 1.5px solid transparent;
    box-shadow: 0 4px 14px rgba(59,130,246,0.4);
}
.rsz-lock-btn.is-locked:hover {
    box-shadow: 0 6px 20px rgba(59,130,246,0.55);
}
/* Always-visible status label below the button */
.rsz-lock-btn::after {
    content: 'Unlocked';
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    white-space: nowrap;
    pointer-events: none;
}
.rsz-lock-btn.is-locked::after {
    content: 'Locked';
    color: var(--color-accent);
}

/* One-time onboarding pulse + tooltip */
.rsz-lock-btn.is-onboarding {
    animation: rsz-lock-pulse 2s ease-in-out 2;
}
@keyframes rsz-lock-pulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(59,130,246,0.4); }
    50%      { box-shadow: 0 4px 14px rgba(59,130,246,0.4),
                            0 0 0 8px rgba(59,130,246,0.18); }
}
.rsz-lock-btn.is-onboarding::before {
    content: 'Click to unlock W/H';
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #0F172A;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 100;
    animation: rsz-tooltip-fade 0.4s ease-out;
}
.rsz-lock-btn.is-onboarding::before {
    /* arrow pointing left to button */
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
@keyframes rsz-tooltip-fade {
    from { opacity: 0; transform: translateY(-50%) translateX(-4px); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}
/* Need extra bottom space on the W/H input row to fit the label */
.rsz-dim-row { padding-bottom: 6px; }

/* Swap button */
.rsz-swap-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    margin-top: 18px;
}
.rsz-swap-btn:hover { background: rgba(59,130,246,0.08); color: var(--color-accent); }

/* Info row */
.rsz-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border-light, var(--color-border));
}
.rsz-info-row strong { color: var(--color-text); font-weight: 600; }

/* ── Resize Mode Tabs ────────────────────────────────────────────────────── */
.rsz-size-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: var(--space-4);
    background: var(--color-surface-alt, rgba(0,0,0,0.03));
    border-radius: var(--radius-md);
    padding: 3px;
}
[data-theme="dark"] .rsz-size-tabs { background: rgba(255,255,255,0.05); }

.rsz-size-tab {
    flex: 1;
    padding: 7px 12px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    font-family: var(--font-body);
    white-space: nowrap;
}
.rsz-size-tab:hover { color: var(--color-text); }
.rsz-size-tab.is-active {
    background: var(--color-bg);
    color: var(--color-accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
[data-theme="dark"] .rsz-size-tab.is-active { background: rgba(255,255,255,0.1); }

/* ── Percentage Mode ─────────────────────────────────────────────────────── */

.rsz-pct-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--space-3);
}

.rsz-pct-btn {
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
}
.rsz-pct-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.rsz-pct-btn.is-active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.rsz-pct-slider-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.rsz-pct-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--color-border);
    outline: none;
}
.rsz-pct-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.rsz-pct-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
}

.rsz-pct-value {
    min-width: 50px;
    text-align: center;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text);
}

.rsz-pct-result {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-top: var(--space-2);
}

.rsz-upscale-warning {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.25);
    border-radius: var(--radius-md);
    color: #D97706;
    font-size: var(--text-xs);
    font-weight: 500;
    margin-top: var(--space-2);
}
.rsz-upscale-warning.is-visible { display: flex; }

/* ── Print Size Mode ─────────────────────────────────────────────────────── */

.rsz-print-row {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.rsz-print-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
}
.rsz-print-group label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.rsz-print-group input, .rsz-print-group select {
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--color-text);
    background: var(--color-bg);
    text-align: center;
}
.rsz-print-group input:focus, .rsz-print-group select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.rsz-print-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--space-3);
}

.rsz-print-btn {
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
}
.rsz-print-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.rsz-print-btn.is-active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

.rsz-print-info {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    padding: 8px 12px;
    background: var(--color-surface-alt, rgba(0,0,0,0.02));
    border-radius: var(--radius-md);
}
[data-theme="dark"] .rsz-print-info { background: rgba(255,255,255,0.04); }
.rsz-print-info .sufficient { color: var(--color-success); font-weight: 600; }
.rsz-print-info .insufficient { color: var(--color-error); font-weight: 600; }

.rsz-dpi-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--space-3);
}

.rsz-dpi-btn {
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
}
.rsz-dpi-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.rsz-dpi-btn.is-active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

/* ── Resize Fit Mode ─────────────────────────────────────────────────────── */
.rsz-fit-modes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: var(--space-3);
}
@media (max-width: 480px) { .rsz-fit-modes { grid-template-columns: repeat(2, 1fr); } }

.rsz-fit-btn {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 8px 6px;
    background: var(--color-bg);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.rsz-fit-btn:hover { border-color: var(--color-accent); }
.rsz-fit-btn.is-active {
    border-color: var(--color-accent);
    background: rgba(59,130,246,0.06);
    box-shadow: 0 0 0 1px var(--color-accent);
}

/* Locked state — when target aspect ratio matches source */
.rsz-fit-modes--locked .rsz-fit-btn {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.6);
}
.rsz-fit-modes--locked .rsz-fit-btn.is-active {
    opacity: 0.65;
    filter: none;
}

/* Contextual hint message below fit modes */
.rsz-fit-mode-hint {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 11.5px;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border: 1px solid transparent;
    word-break: normal;
    overflow-wrap: break-word;
}
.rsz-fit-mode-hint > i {
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 13px;
}
.rsz-fit-mode-hint > span {
    flex: 1;
    min-width: 0;
}
.rsz-fit-mode-hint strong { font-weight: 700; }
.rsz-fit-mode-hint.is-success {
    background: rgba(16,185,129,0.08);
    border-color: rgba(16,185,129,0.25);
    color: var(--color-text);
}
.rsz-fit-mode-hint.is-success i { color: #10B981; }
.rsz-fit-mode-hint.is-info {
    background: rgba(59,130,246,0.06);
    border-color: rgba(59,130,246,0.2);
    color: var(--color-text-secondary);
}
.rsz-fit-mode-hint.is-info i { color: var(--color-accent); }
[data-theme="dark"] .rsz-fit-mode-hint.is-success { background: rgba(16,185,129,0.12); }
[data-theme="dark"] .rsz-fit-mode-hint.is-info    { background: rgba(59,130,246,0.10); }

.rsz-fit-btn__name {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-text);
}
.rsz-fit-btn__desc {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* Fit mode options (background color, blur) */
.rsz-fit-options {
    display: none;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding: var(--space-3);
    background: var(--color-surface-alt, rgba(0,0,0,0.02));
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    align-items: center;
}
[data-theme="dark"] .rsz-fit-options { background: rgba(255,255,255,0.04); }
.rsz-fit-options.is-visible { display: flex; }

.rsz-fit-options label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
}

.rsz-bg-color-btns {
    display: flex;
    gap: 4px;
}

.rsz-bg-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-border);
    cursor: pointer;
    transition: border-color 0.15s;
}
.rsz-bg-btn:hover { border-color: var(--color-accent); }
.rsz-bg-btn.is-active { border-color: var(--color-accent); box-shadow: 0 0 0 2px rgba(59,130,246,0.3); }
.rsz-bg-btn--white { background: #fff; }
.rsz-bg-btn--black { background: #000; }
.rsz-bg-btn--blur {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    position: relative;
}
.rsz-bg-btn--blur::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 1px;
    background: rgba(255,255,255,0.3);
    filter: blur(2px);
}

/* Custom color picker swatch */
.rsz-bg-btn--custom {
    --custom-color: #3B82F6;
    background:
        linear-gradient(135deg, var(--custom-color), var(--custom-color)),
        conic-gradient(from 180deg, #ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6, #ec4899, #ef4444);
    background-blend-mode: normal;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.rsz-bg-btn--custom i {
    color: #fff;
    font-size: 11px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    pointer-events: none;
    z-index: 2;
}
.rsz-bg-btn--custom input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: none;
    cursor: pointer;
    padding: 0;
}
/* When no custom color picked yet, show the rainbow conic gradient */
.rsz-bg-btn--custom:not(.is-active) {
    background: conic-gradient(from 180deg, #ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6, #ec4899, #ef4444);
}
.rsz-bg-btn--custom.is-active {
    background: var(--custom-color);
}

.rsz-crop-positions {
    display: none;
    grid-template-columns: repeat(3, 28px);
    gap: 3px;
    margin-top: var(--space-2);
}
.rsz-crop-positions.is-visible { display: grid; }

.rsz-crop-pos-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-surface);
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
}
.rsz-crop-pos-btn::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-muted);
    position: absolute;
}
.rsz-crop-pos-btn:hover { border-color: var(--color-accent); }
.rsz-crop-pos-btn.is-active { border-color: var(--color-accent); background: rgba(59,130,246,0.08); }
.rsz-crop-pos-btn.is-active::after { background: var(--color-accent); }

.rsz-crop-pos-btn[data-pos="top-left"]::after { top: 4px; left: 4px; }
.rsz-crop-pos-btn[data-pos="top"]::after { top: 4px; left: 50%; transform: translateX(-50%); }
.rsz-crop-pos-btn[data-pos="top-right"]::after { top: 4px; right: 4px; }
.rsz-crop-pos-btn[data-pos="left"]::after { top: 50%; left: 4px; transform: translateY(-50%); }
.rsz-crop-pos-btn[data-pos="center"]::after { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.rsz-crop-pos-btn[data-pos="right"]::after { top: 50%; right: 4px; transform: translateY(-50%); }
.rsz-crop-pos-btn[data-pos="bottom-left"]::after { bottom: 4px; left: 4px; }
.rsz-crop-pos-btn[data-pos="bottom"]::after { bottom: 4px; left: 50%; transform: translateX(-50%); }
.rsz-crop-pos-btn[data-pos="bottom-right"]::after { bottom: 4px; right: 4px; }

/* ── Social Media Presets ────────────────────────────────────────────────── */
.rsz-presets-section {
    margin-top: var(--space-3);
}

.rsz-preset-category {
    margin-bottom: var(--space-3);
}

.rsz-preset-category__title {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.rsz-preset-category__icon { font-size: 14px; }

.rsz-preset-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rsz-preset-btn {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
    white-space: nowrap;
}
.rsz-preset-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.rsz-preset-btn.is-active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.rsz-preset-btn .rsz-preset-size {
    font-weight: 400;
    opacity: 0.7;
    margin-left: 4px;
}

/* ── Passport/ID Presets ─────────────────────────────────────────────────── */
.rsz-id-presets { margin-top: var(--space-3); }

.rsz-id-region {
    margin-bottom: var(--space-3);
}

.rsz-id-region__title {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rsz-id-btn {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
    white-space: nowrap;
}
.rsz-id-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.rsz-id-btn.is-active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

.rsz-id-info {
    margin-top: var(--space-2);
    padding: 8px 12px;
    background: rgba(59,130,246,0.05);
    border: 1px solid rgba(59,130,246,0.15);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    display: none;
}
.rsz-id-info.is-visible { display: block; }

/* ── Generate All Sizes ──────────────────────────────────────────────────── */
.rsz-gen-all {
    margin-top: var(--space-3);
}

.rsz-pack-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.rsz-pack-tab {
    padding: 7px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
}
.rsz-pack-tab:hover { border-color: var(--color-accent); color: var(--color-accent); }
.rsz-pack-tab.is-active {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

.rsz-pack-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}

.rsz-pack-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border-light, var(--color-border));
}
.rsz-pack-item:last-child { border-bottom: none; }

.rsz-pack-item input[type="checkbox"] {
    accent-color: var(--color-accent);
    width: 14px;
    height: 14px;
}
.rsz-pack-item__name { font-weight: 600; color: var(--color-text); flex: 1; }
.rsz-pack-item__size { opacity: 0.7; }

.rsz-gen-progress {
    display: none;
    margin-bottom: var(--space-3);
}
.rsz-gen-progress.is-visible { display: block; }

.rsz-progress-bar {
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}
.rsz-progress-bar__fill {
    height: 100%;
    background: var(--gradient-accent, var(--color-accent));
    border-radius: 3px;
    transition: width 0.2s ease;
    width: 0%;
}
.rsz-progress-text {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    text-align: center;
}

/* ── Retina Export ───────────────────────────────────────────────────────── */
.rsz-retina-section { display: none; }
.rsz-retina-section.is-active { display: block; }

.rsz-retina-list {
    margin-bottom: var(--space-3);
}

.rsz-retina-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}
.rsz-retina-item input[type="checkbox"] { accent-color: var(--color-accent); }
.rsz-retina-item__label { font-weight: 600; color: var(--color-text); }
.rsz-retina-item__dim { opacity: 0.7; }

.rsz-code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-family: 'Fira Code', 'Consolas', monospace;
    line-height: 1.6;
    overflow-x: auto;
    position: relative;
    margin-top: var(--space-2);
    display: none;
}
.rsz-code-block.is-visible { display: block; }

.rsz-code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.rsz-code-copy:hover { background: rgba(255,255,255,0.2); }


/* ── Output Format & Quality ─────────────────────────────────────────────── */
.rsz-output-section {
    margin-top: var(--space-3);
}

.rsz-format-row {
    display: flex;
    gap: 6px;
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
}

.rsz-fmt-btn {
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.rsz-fmt-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.rsz-fmt-btn.is-active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

.rsz-quality-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
}
.rsz-quality-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.rsz-quality-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0.01em;
}
.rsz-quality-label i { color: var(--color-accent); font-size: 12px; }
.rsz-quality-value {
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    background: var(--color-accent);
    padding: 3px 10px;
    border-radius: 999px;
    min-width: 44px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.rsz-quality-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #EF4444 0%, #F59E0B 30%, #10B981 60%, #3B82F6 100%);
    outline: none;
    cursor: grab;
}
.rsz-quality-slider:active { cursor: grabbing; }
.rsz-quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--color-accent);
    cursor: grab;
    box-shadow: 0 2px 8px rgba(15,23,42,0.2);
    transition: transform 0.15s, box-shadow 0.15s;
}
.rsz-quality-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 5px rgba(59,130,246,0.18), 0 2px 8px rgba(15,23,42,0.2);
}
.rsz-quality-slider::-moz-range-thumb {
    width: 20px; height: 20px;
    border: 2px solid var(--color-accent);
    border-radius: 50%;
    background: #fff;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(15,23,42,0.2);
}
.rsz-quality-scale {
    display: flex;
    justify-content: space-between;
    font-size: 9.5px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
    margin-top: 2px;
}

/* ── Sticky Action Bar ───────────────────────────────────────────────────── */
/* Revert to Original — floating pill on the canvas, top-right corner */
.rsz-revert-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s, border-color 0.2s;
    animation: rsz-revert-pop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.rsz-revert-btn[hidden] { display: none; }
.rsz-revert-btn:hover {
    background: var(--color-accent);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(59,130,246,0.45);
}
.rsz-revert-btn:active { transform: translateY(0); }
.rsz-revert-btn i { font-size: 11px; }
@keyframes rsz-revert-pop {
    from { opacity: 0; transform: translateY(-6px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 640px) {
    .rsz-revert-btn { top: 8px; right: 8px; padding: 7px 12px; font-size: 11px; }
    .rsz-revert-btn span { display: none; }
}

/* In focus mode, give the canvas viewport more breathing room */
body.ezfm-active .rsz-canvas-area { min-height: 55vh; }
body.ezfm-active .rsz-canvas-viewport { min-height: 50vh; }

.rsz-sticky-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.35);
    padding: 14px 28px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.rsz-sticky-bar.is-visible {
    display: flex;
    animation: rsz-slide-up 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes rsz-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Left section: icon + filename + dims */
.rsz-sticky-stat {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}
.rsz-sticky-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(59,130,246,0.35);
    transition: background 0.3s, box-shadow 0.3s;
}
.rsz-sticky-icon.is-success {
    background: linear-gradient(135deg, #10B981, #059669);
    box-shadow: 0 4px 16px rgba(16,185,129,0.45);
}
.rsz-sticky-info {
    min-width: 0;
    flex: 1;
}
.rsz-sticky-filename {
    font-size: var(--text-sm);
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}
.rsz-sticky-sizes {
    font-size: var(--text-xs);
    color: rgba(255,255,255,0.55);
    margin-top: 2px;
}

/* Right section: action buttons */
.rsz-sticky-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.rsz-sticky-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    white-space: nowrap;
    border: none;
}
.rsz-sticky-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.rsz-sticky-btn--ghost {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.12);
}
.rsz-sticky-btn--ghost:hover {
    background: rgba(255,255,255,0.13);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
}
.rsz-sticky-btn--primary {
    background: linear-gradient(135deg, #3B82F6, #6366F1);
    color: #fff;
    padding: 10px 22px;
    font-weight: 700;
    box-shadow: 0 4px 18px rgba(59,130,246,0.45);
}
.rsz-sticky-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(59,130,246,0.6);
}
.rsz-sticky-btn--download {
    background: linear-gradient(135deg, #10B981, #059669);
    color: #fff;
    padding: 10px 22px;
    font-weight: 700;
    box-shadow: 0 4px 18px rgba(16,185,129,0.45);
    display: none;
}
.rsz-sticky-btn--download.is-visible { display: inline-flex; }
.rsz-sticky-btn--download:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(16,185,129,0.6);
}

/* Push page content above the fixed bar */
.rsz-tool { padding-bottom: 96px; }

/* Hide mode tabs and privacy badge when a workspace is active */
.rsz-tool.has-workspace .rsz-mode-tabs,
.rsz-tool.has-workspace .rsz-privacy-badge { display: none !important; }

@media (max-width: 768px) {
    .rsz-sticky-bar { padding: 12px 16px; gap: 12px; }
    .rsz-sticky-btn span { display: none; }
    .rsz-sticky-btn--primary span,
    .rsz-sticky-btn--download span { display: inline; }
    .rsz-sticky-btn--primary,
    .rsz-sticky-btn--download { padding: 9px 14px; font-size: 12px; }
    .rsz-sticky-icon { width: 38px; height: 38px; font-size: 15px; }
    .rsz-sticky-filename { max-width: 140px; font-size: 12px; }
    .rsz-sticky-sizes { font-size: 10px; }
    .rsz-tool { padding-bottom: 88px; }
}

.rsz-resize-btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--gradient-accent, var(--color-accent));
    color: #fff;
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(59,130,246,0.3);
    white-space: nowrap;
}
.rsz-resize-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(59,130,246,0.4); }
.rsz-resize-btn:active { transform: translateY(0); }
.rsz-resize-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.rsz-download-btn {
    padding: 10px 24px;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-accent);
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
    transition: all 0.15s;
    white-space: nowrap;
    display: none;
}
.rsz-download-btn.is-visible { display: inline-flex; align-items: center; gap: 6px; }
.rsz-download-btn:hover { background: rgba(59,130,246,0.08); }

.rsz-reset-btn {
    padding: 8px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
}
.rsz-reset-btn:hover { border-color: var(--color-error); color: var(--color-error); }

/* ── Batch Mode ──────────────────────────────────────────────────────────── */
/* Batch dropzone inherits all .rsz-dropzone styling */

.rsz-batch-settings {
    display: none;
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    margin-bottom: var(--space-4);
}
.rsz-batch-settings.is-visible { display: block; }

.rsz-batch-table-wrap {
    overflow-x: auto;
    margin-bottom: var(--space-3);
}

.rsz-batch-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-xs);
}
.rsz-batch-table th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}
.rsz-batch-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border-light, var(--color-border));
    color: var(--color-text);
    vertical-align: middle;
}
.rsz-batch-table tr:last-child td { border-bottom: none; }

.rsz-batch-thumb {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--color-border);
}

.rsz-batch-status { font-weight: 600; }
.rsz-batch-status--done { color: var(--color-success); }
.rsz-batch-status--processing { color: var(--color-accent); }
.rsz-batch-status--queued { color: var(--color-text-muted); }

/* ── Collapsible sections ────────────────────────────────────────────────── */
.rsz-collapsible {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.rsz-collapsible__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--color-surface);
    border: none;
    width: 100%;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text);
    font-family: var(--font-body);
    text-align: left;
    transition: background 0.15s;
}
.rsz-collapsible__header:hover { background: var(--color-surface-alt, rgba(0,0,0,0.02)); }
[data-theme="dark"] .rsz-collapsible__header:hover { background: rgba(255,255,255,0.04); }

.rsz-collapsible__header i:first-child { color: var(--color-accent); font-size: 14px; }

.rsz-collapsible__chevron {
    margin-left: auto;
    font-size: 12px;
    color: var(--color-text-muted);
    transition: transform 0.2s;
}
.rsz-collapsible.is-open .rsz-collapsible__chevron { transform: rotate(180deg); }

.rsz-collapsible__body {
    display: none;
    padding: 0 16px 16px;
}
.rsz-collapsible.is-open .rsz-collapsible__body { display: block; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .rsz-canvas-area { margin-bottom: var(--space-4); }
}

@media (max-width: 768px) {
    /* Keep W / lock / H on a single row, even on mobile */
    .rsz-dim-row {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: flex-end;
        gap: 8px;
    }
    .rsz-dim-group { flex: 1 1 0; min-width: 0; }
    .rsz-dim-group input { width: 100%; }
    .rsz-lock-btn, .rsz-swap-btn {
        margin-top: 0;
        align-self: flex-end;
        flex-shrink: 0;
        margin-bottom: 2px;
    }
    .rsz-sticky-bar__inner { flex-direction: column; text-align: center; }
    .rsz-sticky-bar__info { justify-content: center; }
    .rsz-canvas-viewport { max-height: 320px; }
    /* Tighter side-panel cards */
    .rsz-control-card { padding: 14px; }
    .rsz-info-row { font-size: 11px; gap: 4px 12px; }
    .rsz-fit-btn { padding: 8px 4px; }
    .rsz-fit-btn__name { font-size: 11px; }
    .rsz-fit-btn__desc { font-size: 9px; }
    /* Workspace becomes single column with controls below canvas */
    .rsz-workspace.is-visible {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .rsz-handle { width: 16px; height: 16px; }
    .rsz-handle--nw { top: -8px; left: -8px; }
    .rsz-handle--n  { top: -8px; margin-left: -8px; }
    .rsz-handle--ne { top: -8px; right: -8px; }
    .rsz-handle--e  { margin-top: -8px; right: -8px; }
    .rsz-handle--se { bottom: -8px; right: -8px; }
    .rsz-handle--s  { bottom: -8px; margin-left: -8px; }
    .rsz-handle--sw { bottom: -8px; left: -8px; }
    .rsz-handle--w  { margin-top: -8px; left: -8px; }
    .rsz-fit-modes { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .rsz-size-tabs { flex-wrap: wrap; }
    .rsz-size-tab { flex: unset; }
    .rsz-preset-grid { gap: 4px; }
    .rsz-preset-btn { padding: 5px 8px; font-size: 10px; }
}
