/* Toolstrem Image Resizer Stylesheet */
.im-resize-wrap {
    font-family: var(--font-sans);
    color: var(--text-main);
    padding: 2rem 0;
}

.im-resize-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Glassmorphism Cards */
.im-resize-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

/* Dropzone area */
.dropzone-area {
    border: 2px dashed rgba(59, 130, 246, 0.4);
    background: var(--bg-surface-alt);
    border-radius: 14px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    margin-bottom: 1.5rem;
}

.dropzone-area:hover, .dropzone-area.dragover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.15);
}

.dropzone-area:focus-visible {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.dropzone-icon {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 1.25rem;
    transition: transform 0.3s ease;
}

.dropzone-area:hover .dropzone-icon {
    transform: translateY(-5px) scale(1.05);
}

.dropzone-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.dropzone-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Queue List */
.queue-container {
    margin-bottom: 1.5rem;
}

.queue-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-item {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.queue-item.active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.02);
}

.queue-thumb-container {
    width: 50px;
    height: 50px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.queue-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.queue-meta {
    flex-grow: 1;
    overflow: hidden;
}

.queue-filename {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-main);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.queue-details {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    gap: 10px;
}

.queue-btn-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.queue-btn-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Two-column editor workspace */
.workspace-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2rem;
}

@media (max-width: 850px) {
    .workspace-layout {
        grid-template-columns: 1fr;
    }
}

/* Before / After Slider block */
.compare-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
}

.compare-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}

.compare-img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.compare-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
    border-right: 2px solid #ffffff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.compare-overlay-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: none;
}

.compare-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    z-index: 3;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.compare-handle::before, .compare-handle::after {
    content: "";
    border: 5px solid transparent;
    position: absolute;
}

.compare-handle::before {
    border-right-color: var(--primary);
    left: 4px;
}

.compare-handle::after {
    border-left-color: var(--primary);
    right: 4px;
}

.compare-label {
    position: absolute;
    bottom: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
    z-index: 4;
    pointer-events: none;
}

.compare-label.label-before {
    left: 10px;
}

.compare-label.label-after {
    right: 10px;
}

/* Dimensions & Modes configurations */
.config-group {
    margin-bottom: 1.5rem;
}

.config-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: block;
}

.dimension-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 1rem;
}

.dimension-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dimension-lbl {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.dimension-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-alt);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
}

.dimension-input:focus-visible {
    border-color: var(--primary);
}

/* Toggle aspect lock */
.aspect-lock-btn {
    background: var(--bg-surface-alt);
    border: 1.5px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    margin-top: auto;
    transition: all 0.2s;
}

.aspect-lock-btn.locked {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary);
}

/* Preset buttons layout */
.presets-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-alt);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

/* Fit modes buttons */
.fit-modes-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mode-btn {
    background: var(--bg-surface-alt);
    border: 1.5px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: var(--primary);
}

.mode-btn.active {
    background: rgba(37, 99, 235, 0.05);
    border-color: var(--primary);
    color: var(--primary);
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.stat-item {
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
}

.stat-lbl {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2px;
    display: block;
}

.stat-val {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Form switch controls */
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.switch-lbl {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Action Execution button styling */
.btn-resize-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: linear-gradient(90deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 1rem;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.25);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.btn-resize-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

.btn-resize-action:active {
    transform: translateY(0);
}

.btn-resize-action:disabled {
    background: #475569 !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Sticky Action Button layout on Mobile viewports */
@media (max-width: 576px) {
    .sticky-mobile-trigger {
        position: fixed;
        bottom: 16px;
        left: 16px;
        right: 16px;
        width: calc(100% - 32px) !important;
        z-index: 1000;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
        margin-bottom: 0 !important;
    }
}

/* Result Box style */
.result-card {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 14px;
    padding: 2.25rem;
    text-align: center;
    margin-bottom: 2rem;
}

.result-success-icon {
    font-size: 3.5rem;
    color: #10b981;
    margin-bottom: 1.25rem;
}

.result-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.result-meta-txt {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

.result-actions-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-download-pg {
    background: #10b981;
    border: none;
    color: #ffffff;
    padding: 0.9rem 2.25rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
    text-decoration: none;
}

.btn-download-pg:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-reset-pg {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.9rem 2.25rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset-pg:hover {
    background: var(--border-color);
    color: var(--text-main);
}

/* History logs */
.history-card {
    background: var(--bg-surface-alt);
    border-radius: 14px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    margin-top: 1.5rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

.history-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.btn-clear-history {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-clear-history:hover {
    color: #ef4444;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    border: 1px solid var(--border-color);
}

.history-meta-line {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-filename {
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 250px;
}

.history-stats {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.history-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-action-trigger {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.history-action-trigger:hover {
    color: var(--border-focus);
}

.history-delete-trigger:hover {
    color: #ef4444;
}

/* Toast notifications */
.pg-toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-surface);
    border-left: 4px solid #ef4444;
    color: var(--text-main);
    padding: 14px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    font-weight: 600;
    font-size: 0.88rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
}

.pg-toast-notification.success {
    border-left-color: #10b981;
}

.pg-toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Progress HUD tracker */
.progress-hud {
    background: var(--bg-surface-alt);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.progress-stats-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.progress-bar-bg {
    background: var(--border-color);
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--border-focus));
    border-radius: 10px;
    transition: width 0.2s ease;
}

/* Security notice banner */
.notice-banner {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 1.5rem;
}

.notice-banner i {
    color: var(--primary);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.notice-banner p {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0;
    font-weight: 550;
}

/* Features cards grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 3rem 0;
}

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

.feature-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    transition: all 0.25s ease;
}

.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

.feature-card i {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* WCAG 2.2 AA Touch Target Enhancements & Mobile Responsive Adjustments */
@media (max-width: 576px) {
    .im-resize-wrap {
        padding-bottom: 90px; /* Leave space for the sticky bottom button */
    }
    
    /* Ensure all touch inputs have at least 48px height */
    .mode-btn, 
    .presets-select, 
    .dimension-input, 
    .aspect-lock-btn, 
    .btn-resize-action, 
    #btn-undo, 
    #btn-redo, 
    #btn-rotate-cw, 
    #btn-reset-config {
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .compare-wrapper {
        aspect-ratio: 1/1; /* Optimize screen ratio for mobile vertically */
    }
}
