/* SharkZip Clean Design CSS */

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #16a34a;
    --success-hover: #15803d;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #d1d5db;
    --background-light: #f8f9fa;
    --card-background: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background-light);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Container and section spacing */
.container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
}

/* Hero section spacing */
.display-4 {
    margin-bottom: 1rem !important;
}

.lead {
    margin-bottom: 1.5rem !important;
}

/* Navigation */
.navbar {
    padding: 1rem 0 !important;
    margin-bottom: 1rem;
}

.navbar-brand {
    font-weight: 700;
    color: var(--text-primary) !important;
}

.nav-link {
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

/* Cards */
.card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-body {
    padding: 1.5rem !important;
}

.card-body.p-4 {
    padding: 1.5rem !important;
}

.card-body.p-3 {
    padding: 1rem !important;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.3s ease;
    border: none;
    padding: 0.875rem 2.25rem;
    margin: 0.5rem 0.25rem;
    font-size: 1.05rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-lg {
    padding: 1.125rem 2.75rem !important;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-sm {
    padding: 0.625rem 1.25rem !important;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.btn-success:hover {
    background-color: var(--success-hover);
    border-color: var(--success-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-outline-secondary {
    color: #888888;
    border-color: #888888;
    background-color: white;
    box-shadow: 0 2px 8px rgba(136, 136, 136, 0.15);
}

.btn-outline-secondary:hover {
    background-color: #888888;
    border-color: #888888;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(136, 136, 136, 0.25);
}

/* Enhanced button shadows and hover effects */
.btn.shadow-sm {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.btn:hover.shadow-sm {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;
}

/* Cloud storage button specific styling */
#googleDriveBtn {
    color: #4285f4;
    border-color: #4285f4;
    background-color: white;
    box-shadow: 0 3px 10px rgba(66, 133, 244, 0.15);
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    border-radius: 10px;
    min-width: 120px;
    max-width: 180px;
}

#googleDriveBtn:hover {
    background-color: #4285f4 !important;
    border-color: #4285f4 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.35) !important;
}

#dropboxBtn {
    color: #0061ff;
    border-color: #0061ff;
    background-color: white;
    box-shadow: 0 3px 10px rgba(0, 97, 255, 0.15);
    padding: 0.875rem 2.25rem;
    font-size: 1.05rem;
    border-radius: 10px;
    flex: 1;
    min-width: 140px;
}

#dropboxBtn:hover {
    background-color: #0061ff !important;
    border-color: #0061ff !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 97, 255, 0.35) !important;
}

/* Cloud storage container styling */
.d-flex.gap-3.justify-content-center.flex-wrap:has(#googleDriveBtn) {
    max-width: 400px;
    margin: 0 auto;
}

/* Compress All button centering */
#compressAllImagesBtn {
    display: block !important;
    margin: 0 auto !important;
    min-width: 150px;
}

/* Upload zone icon animation */
#uploadZone i.bi-cloud-upload {
    transition: all 0.3s ease;
}

#uploadZone:hover i.bi-cloud-upload {
    transform: translateY(-5px);
    animation: bounce 2s infinite;
}

/* Improved image containers */
.image-container {
    height: 200px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.image-container img {
    max-height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(-5px);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-7px);
    }
}

/* Results Section */
#resultsSection {
    margin-bottom: 2rem !important;
    background: linear-gradient(135deg, #f8faff 0%, #eff3ff 100%);
    min-height: 100vh;
    padding: 2rem 0;
}

/* Queue Management Styles */
#queueProgress {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e5e7eb;
}

#queueProgressBar {
    transition: width 0.3s ease;
}

.badge {
    font-size: 0.875rem;
    font-weight: 600;
}

#queueStats, #queueSpeed {
    font-size: 0.8rem;
}

.small.text-muted {
    font-size: 0.75rem;
}

.results-container {
    max-width: 100%;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.results-title-section h4 {
    color: #1f2937;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.results-summary {
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.4;
}

.results-actions {
    display: flex !important;
    justify-content: center !important;
    flex-direction: row !important;
    gap: 0.75rem !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
}

.results-actions .btn {
    flex: 1 1 auto !important;
    min-width: 100px !important;
    max-width: none !important;
    justify-content: center !important;
    font-size: 0.85rem !important;
    padding: 0.7rem 0.8rem !important;
    white-space: nowrap !important;
}

.btn-download-all {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    border: none;
    color: white;
}

.btn-download-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.3);
}

.btn-clear-all {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #dc2626;
}

.btn-clear-all:hover {
    background: #fef2f2;
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

/* Ensure toolbar buttons stay in single line */
.toolbar-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Button container for toolbar - Force horizontal layout */
.d-flex.gap-2.flex-shrink-0.flex-nowrap {
    min-width: fit-content !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
}

/* Ensure buttons container stays horizontal on all screen sizes */
.d-flex.gap-2.flex-shrink-0.flex-nowrap .btn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

/* Override any Bootstrap responsive behavior that might cause stacking */
@media (max-width: 767.98px) {
    .d-flex.gap-2.flex-shrink-0.flex-nowrap {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
    }
}

.image-result-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.image-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.image-card-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.image-info h6 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.size-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.size-arrow {
    color: #9ca3af;
    font-weight: bold;
}

.reduction-badge {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.image-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.image-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.image-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
}

.image-container img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.image-label {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.label-original {
    background: #3b82f6;
    color: white;
}

.label-compressed {
    background: #16a34a;
    color: white;
}

.size-badge {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.savings-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.final-download-section {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.final-download-text {
    color: #6b7280;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.btn-final-download {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    border: none;
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.25);
}

.btn-final-download:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(22, 163, 74, 0.35);
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mt-5 {
    margin-top: 2rem !important;
}

.pt-4 {
    padding-top: 1.5rem !important;
}

/* Feature sections */
.row.g-4 {
    margin-bottom: 2rem;
}

.col-md-4 {
    padding: 1rem;
}

/* Upload Zone */
#uploadZone {
    transition: all 0.3s ease;
    background-color: transparent !important;
    padding: 3.5rem 2.5rem !important;
    border: 2px dashed #d1d5db !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    border-radius: 15px !important;
}

#uploadZone:hover {
    border-color: #9ca3af !important;
    background-color: transparent !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12) !important;
}

#uploadZone.dragover {
    border-color: var(--primary-color) !important;
    background-color: transparent !important;
    transform: scale(1.02);
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.18) !important;
}

/* Form Controls */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
    background-color: var(--card-background);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

/* Form labels and headings */
.form-label {
    margin-bottom: 0.5rem !important;
    font-weight: 600;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem !important;
    margin-top: 1rem !important;
}

h1:first-child, h2:first-child, h3:first-child,
h4:first-child, h5:first-child, h6:first-child {
    margin-top: 0 !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-switch .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Range Slider */
.form-range {
    height: 8px;
    background: linear-gradient(90deg, #e5e7eb 0%, #e5e7eb 100%);
    border-radius: 10px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    position: relative;
}

.form-range::-webkit-slider-track {
    background: linear-gradient(90deg, var(--primary-color) 0%, #8b5cf6 100%);
    border-radius: 10px;
    height: 8px;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
    transition: all 0.2s ease;
    border: 2px solid white;
}

.form-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.6);
}

.form-range::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
    transition: all 0.2s ease;
}

.form-range::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.6);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
    border-radius: 6px;
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
}

.badge.bg-success {
    background-color: var(--success-color) !important;
}

/* Enhanced Split View for Image Comparison */
.split-view-container {
    position: relative;
    background: #f8f9fa;
    touch-action: none;
    user-select: none;
    overflow: hidden;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 8px;
}

/* Split View Labels */
#originalLabel, #compressedLabel {
    position: absolute;
    top: 15px;
    z-index: 10;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#originalLabel {
    left: 15px;
    background: #3b82f6;
    color: white;
}

#compressedLabel {
    right: 15px;
    background: #16a34a;
    color: white;
}

/* Mobile label positioning */
@media (max-width: 768px) {
    #originalLabel, #compressedLabel {
        top: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }

    #originalLabel {
        left: 10px;
    }

    #compressedLabel {
        right: 10px;
    }
}

@media (max-width: 576px) {
    #originalLabel, #compressedLabel {
        top: 8px;
        font-size: 10px;
        padding: 4px 8px;
    }

    #originalLabel {
        left: 8px;
    }

    #compressedLabel {
        right: 8px;
    }
}

.split-view-container img {
    transition: transform 0.3s ease;
    transform-origin: center center;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    object-fit: contain;
    object-position: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
}

/* Enhanced Split Slider */
.split-slider-enhanced {
    width: 4px;
    background: linear-gradient(180deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
    cursor: ew-resize;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
    border-radius: 2px;
    touch-action: none;
}

.split-slider-enhanced:hover {
    width: 5px;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.6);
}

.split-slider-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -20px;
    width: 44px;
    height: 100%;
    background: transparent;
    cursor: ew-resize;
}

.split-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #2563eb;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    cursor: ew-resize;
}

.split-slider-enhanced:hover .split-handle {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

/* Touch-friendly split slider for mobile */
@media (hover: none) and (pointer: coarse) {
    .split-slider-enhanced {
        width: 8px;
        background: linear-gradient(180deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%);
        box-shadow: 0 0 20px rgba(37, 99, 235, 0.6);
    }

    .split-slider-enhanced::before {
        left: -30px;
        width: 68px;
    }

    .split-handle {
        width: 28px;
        height: 28px;
        border-width: 4px;
        box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    }

    .split-slider-enhanced:hover .split-handle {
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* Quality Analysis Panel Styling */
.analysis-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.analysis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    margin-bottom: 12px;
}

.analysis-header i {
    font-size: 16px;
}

.file-name {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* File Size Comparison */
.size-comparison {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.size-item {
    flex: 1;
    text-align: center;
}

.size-label {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.size-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.size-value.original {
    color: #1f2937;
}

.size-value.compressed {
    color: #16a34a;
}

.size-reduction {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.reduction-label {
    font-size: 12px;
    color: #6b7280;
}

.reduction-value {
    font-size: 16px;
    font-weight: 700;
}

.reduction-value.positive {
    color: #dc2626;
}

.reduction-value.negative {
    color: #dc2626;
}

/* Image Details */
.detail-row {
    display: flex;
    gap: 16px;
}

.detail-item {
    flex: 1;
}

.detail-label {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

/* Quality Metrics Grid */
.metrics-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.metric-info {
    flex: 1;
}

.metric-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 2px;
}

.metric-subtitle {
    font-size: 11px;
    color: #9ca3af;
}

.metric-result {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.metric-value {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.text-purple {
    color: #8b5cf6 !important;
}

/* Metric Badges */
.metric-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-excellent {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-good {
    background: #dcfce7;
    color: #166534;
}

/* View Mode Controls */
.btn-check:checked + .btn-primary {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: white !important;
}

.btn-outline-secondary {
    color: #6b7280;
    border-color: #d1d5db;
}

.btn-outline-secondary:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

/* Mobile Optimizations nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn*/
@media (max-width: 768px) {
    .split-slider-enhanced {
        width: 6px;
    }

    .split-handle {
        width: 24px;
        height: 24px;
    }

    .analysis-card {
        padding: 12px;
    }

    .size-comparison {
        flex-direction: column;
        gap: 8px;
    }

    .size-arrow {
        transform: rotate(90deg);
    }

    .detail-row {
        flex-direction: column;
        gap: 12px;
    }

    .metric-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .metric-result {
        align-items: flex-start;
        text-align: left;
    }

    /* Enhanced Mobile Modal Layout */
    .modal-fullscreen .modal-body {
        padding: 0 !important;
    }

    .modal-fullscreen .modal-body .row {
        flex-direction: column !important;
        margin: 0 !important;
        height: auto !important;
    }

    .modal-fullscreen .col-lg-8,
    .modal-fullscreen .col-lg-4 {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        height: auto !important;
    }

    /* Mobile Split View Container */
    .split-view-container {
        padding: 0 !important;
        height: 400px !important;
        min-height: 300px !important;
        position: relative !important;
    }

    .split-view-container img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }

    /* Mobile Split Slider */
    .split-slider-enhanced {
        width: 8px !important;
        background: linear-gradient(180deg, #2563eb 0%, #3b82f6 50%, #60a5fa 100%) !important;
        box-shadow: 0 0 20px rgba(37, 99, 235, 0.6) !important;
    }

    .split-handle {
        width: 32px !important;
        height: 32px !important;
        border-width: 4px !important;
        box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4) !important;
    }

    /* Mobile View Controls - only apply on actual mobile screens */

    /* Mobile Quality Analysis Panel */
    .col-lg-4 .p-3.flex-grow-1 {
        padding: 1rem !important;
        max-height: 40vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
        scrollbar-color: #d1d5db transparent !important;
    }

    .col-lg-4 .p-3.flex-grow-1::-webkit-scrollbar {
        width: 6px !important;
    }

    .col-lg-4 .p-3.flex-grow-1::-webkit-scrollbar-track {
        background: transparent !important;
    }

    .col-lg-4 .p-3.flex-grow-1::-webkit-scrollbar-thumb {
        background: #d1d5db !important;
        border-radius: 3px !important;
    }

    .col-lg-4 .p-3.flex-grow-1::-webkit-scrollbar-thumb:hover {
        background: #9ca3af !important;
    }

    /* Mobile File Size Section */
    .mb-4:has(.d-flex.align-items-center.mb-3:has(.bi-hdd-fill)) {
        margin-bottom: 1rem !important;
    }

    .d-flex.justify-content-between.align-items-center.mb-3 {
        flex-direction: column !important;
        gap: 0.75rem !important;
        text-align: center !important;
    }

    .d-flex.justify-content-between.align-items-center.mb-3 > div {
        flex: none !important;
        width: 100% !important;
    }

    .d-flex.justify-content-between.align-items-center.mb-3 .bi-arrow-right {
        transform: rotate(90deg) !important;
        font-size: 1.2rem !important;
        margin: 0.5rem 0 !important;
    }

    /* Mobile Image Details */
    .d-flex.gap-2:has(.border-1px) {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .d-flex.gap-2:has(.border-1px) > div {
        width: 100% !important;
        text-align: center !important;
    }

    /* Mobile Quality Metrics */
    .d-flex.flex-column.gap-3 {
        gap: 1rem !important;
    }

    .d-flex.justify-content-between.align-items-center {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        text-align: center !important;
    }

    .d-flex.justify-content-between.align-items-center > div {
        width: 100% !important;
    }

    .d-flex.justify-content-between.align-items-center .text-end {
        text-align: center !important;
        align-items: center !important;
    }

    /* Mobile Action Buttons */
    .p-4.border-top {
        padding: 1rem !important;
        position: sticky !important;
        bottom: 0 !important;
        background: white !important;
        z-index: 999 !important;
        border-top: 1px solid #e5e7eb !important;
        box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05) !important;
    }

    .p-4.border-top .btn {
        min-height: 48px !important;
        font-size: 1rem !important;
        padding: 0.875rem 1rem !important;
        border-radius: 8px !important;
        transition: all 0.2s ease !important;
    }

    .p-4.border-top .btn:active {
        transform: scale(0.98) !important;
    }

    /* Mobile Modal Header */
    .modal-header {
        padding: 1rem !important;
    }

    .modal-header .modal-title {
        font-size: 1.1rem !important;
    }

    .btn-close {
        padding: 0.5rem !important;
        font-size: 1.5rem !important;
    }
}

/* Small Mobile Devices */
@media (max-width: 576px) {
    .split-view-container {
        padding: 0 !important;
        height: 350px !important;
        min-height: 250px !important;
    }

    .split-slider-enhanced {
        width: 10px !important;
    }

    .split-handle {
        width: 36px !important;
        height: 36px !important;
    }

    .modal-header .modal-title {
        font-size: 1rem !important;
    }

    .modal-header .modal-title .bi {
        font-size: 1.2rem !important;
    }

    .p-3.border-bottom {
        padding: 0.75rem !important;
    }

    .btn-group .btn {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.6rem !important;
        min-height: 32px !important;
    }

    .col-lg-4 .p-3.flex-grow-1 {
        padding: 0.75rem !important;
    }

    .p-4.border-top {
        padding: 0.75rem !important;
    }

    .p-4.border-top .btn {
        min-height: 44px !important;
        font-size: 0.95rem !important;
        padding: 0.75rem 0.875rem !important;
    }

    /* Ultra-compact mobile layout */
    .d-flex.justify-content-between.align-items-center.mb-3 {
        gap: 0.5rem !important;
    }

    .d-flex.justify-content-between.align-items-center.mb-3 .size-value {
        font-size: 1.1rem !important;
    }

    .d-flex.justify-content-between.align-items-center.mb-3 .size-label {
        font-size: 0.7rem !important;
    }

    .d-flex.flex-column.gap-3 {
        gap: 0.75rem !important;
    }

    .d-flex.justify-content-between.align-items-center {
        gap: 0.5rem !important;
    }

    .d-flex.justify-content-between.align-items-center .metric-label {
        font-size: 0.9rem !important;
    }

    .d-flex.justify-content-between.align-items-center .metric-subtitle {
        font-size: 0.7rem !important;
    }

    .d-flex.justify-content-between.align-items-center .metric-value {
        font-size: 1.1rem !important;
    }

    .d-flex.justify-content-between.align-items-center .metric-tag {
        font-size: 0.6rem !important;
        padding: 1px 6px !important;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-fullscreen .modal-body .row {
        flex-direction: row !important;
        height: calc(100vh - 60px) !important;
    }

    .modal-fullscreen .col-lg-8 {
        height: 100% !important;
        flex: 0 0 60% !important;
    }

    .modal-fullscreen .col-lg-4 {
        height: 100% !important;
        flex: 0 0 40% !important;
    }

    .split-view-container {
        height: 100% !important;
        min-height: auto !important;
    }

    .col-lg-4 .p-3.flex-grow-1 {
        max-height: none !important;
    }
}

/* Progress */
.progress {
    background-color: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.6s ease;
    border-radius: 10px;
}

/* Text Colors */
.text-primary {
    color: var(--primary-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

/* Feature Icons */
.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 1rem;
}

/* Step Numbers */
.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    margin-bottom: 1rem;
}

/* Modal Enhancements */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.btn-close {
    font-size: 1rem !important;
    padding: 0.75rem !important;
    margin: 0 !important;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.btn-close:hover {
    opacity: 1;
}

/* Mobile Modal Header Improvements */
@media (max-width: 768px) {
    .modal-header {
        padding: 1rem !important;
        position: sticky !important;
        top: 0 !important;
        background: white !important;
        z-index: 1000 !important;
        border-bottom: 1px solid #e5e7eb !important;
    }

    .modal-header .modal-title {
        font-size: 1.1rem !important;
        line-height: 1.3 !important;
        max-width: 70% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .btn-close {
        padding: 0.5rem !important;
        font-size: 1.5rem !important;
        min-width: 44px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
        transition: all 0.2s ease !important;
    }

    .btn-close:hover {
        background: #f3f4f6 !important;
        opacity: 1 !important;
    }

    .btn-close:active {
        background: #e5e7eb !important;
        transform: scale(0.95) !important;
    }
}

/* Enhanced View Controls for Mobile */
@media (max-width: 768px) {
    .modal .p-3.border-bottom {
        padding: 1rem !important;
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: stretch !important;
    }

    /* First row: View mode buttons (Split View, Original, Compressed) */
    .modal .btn-group {
        width: 100% !important;
        margin-bottom: 0 !important;
        display: flex !important;
        flex-direction: row !important;
    }

    .modal .btn-group .btn {
        flex: 1 !important;
        font-size: 0.875rem !important;
        padding: 0.625rem 0.5rem !important;
        white-space: nowrap !important;
        min-height: 44px !important;
        text-align: center !important;
    }

    /* Second row: Zoom controls */
    .modal .d-flex.align-items-center.gap-2:has(#zoomLevel) {
        width: 100% !important;
        justify-content: center !important;
        flex-direction: row !important;
        gap: 0.75rem !important;
        align-items: center !important;
        margin-top: 0 !important;
    }

    .modal #zoomLevel {
        background: #f8f9fa !important;
        padding: 0.375rem 0.75rem !important;
        border-radius: 6px !important;
        border: 1px solid #e5e7eb !important;
        font-weight: 600 !important;
        color: #374151 !important;
        min-width: 70px !important;
        text-align: center !important;
        font-size: 0.875rem !important;
    }

    .modal .btn-group:has(#zoomOut) {
        width: auto !important;
        gap: 0.5rem !important;
        display: flex !important;
        flex-direction: row !important;
        margin-left: 0 !important;
    }

    .modal .btn-group:has(#zoomOut) .btn {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0.5rem !important;
        flex: none !important;
        font-size: 1rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* Quality Comparison Modal Controls */
.modal .p-3.border-bottom {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.5rem !important;
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

/* Ensure proper desktop layout */
@media (min-width: 769px) {
    .modal .p-3.border-bottom {
        flex-direction: row !important;
        align-items: center !important;
        gap: 1rem !important;
    }

    .modal .btn-group {
        flex: none !important;
        width: auto !important;
    }

    .modal .d-flex.align-items-center.gap-2:has(#zoomLevel) {
        flex: none !important;
        width: auto !important;
        max-width: none !important;
    }
}

.modal .btn-group {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.modal .btn-group .btn {
    border-radius: 0 !important;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    border-right: none;
}

.modal .btn-group .btn:last-child {
    border-right: 1px solid #d1d5db;
}

.modal .btn-group .btn:first-child {
    border-radius: 8px 0 0 8px !important;
}

.modal .btn-group .btn:last-child {
    border-radius: 0 8px 8px 0 !important;
}

.modal .btn-group .btn.active {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
    z-index: 1;
}

.modal .btn-group .btn:hover:not(.active) {
    background: #f8f9fa;
    border-color: #9ca3af;
}

/* Zoom Controls Styling */
.modal .d-flex.align-items-center.gap-2:has(#zoomLevel) {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.25rem;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal #zoomLevel {
    background: transparent !important;
    border: none !important;
    font-weight: 600 !important;
    color: #374151 !important;
    font-size: 0.875rem !important;
    padding: 0.25rem 0.5rem !important;
    margin: 0 !important;
    min-width: 50px !important;
    text-align: center !important;
}

.modal .btn-group:has(#zoomOut) {
    background: transparent;
    border: none;
    box-shadow: none;
    gap: 0.25rem;
}

.modal .btn-group:has(#zoomOut) .btn {
    background: white !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    color: #6b7280 !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.875rem !important;
    margin: 0 !important;
    flex: none !important;
}

.modal .btn-group:has(#zoomOut) .btn:hover {
    background: #f9fafb !important;
    border-color: #9ca3af !important;
    color: #374151 !important;
}

.modal .btn-group:has(#zoomOut) .btn:active {
    background: #f3f4f6 !important;
    transform: scale(0.95) !important;
}

/* Image Thumbnails */
.img-thumbnail-custom {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.img-thumbnail-custom:hover {
    border-color: var(--primary-color);
    transform: scale(1.02);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Gap utilities */
.gap-3 {
    gap: 2rem !important;
}

.gap-4 {
    gap: 2.5rem !important;
}

.d-flex.gap-2 {
    gap: 1rem !important;
}

/* Feature and step elements */
.feature-icon, .step-number {
    margin-bottom: 2rem !important;
}

.text-center {
    padding: 1.5rem 1rem;
}

/* Navigation Mobile Styles */
.navbar-toggler {
    border: none !important;
    padding: 4px 8px !important;
    background: transparent !important;
    box-shadow: none !important;
}

.navbar-toggler:focus {
    box-shadow: none !important;
    outline: none !important;
}

.navbar-nav .nav-link.active {
    border-bottom: 2px solid #3b82f6 !important;
    padding-bottom: 4px !important;
}

/* Mobile Navigation Menu */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background-color: #ffffff;
        border-radius: 8px;
        margin-top: 1rem;
        padding: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border: 1px solid #e5e7eb;
        position: relative;
        z-index: 1000;
    }

    .navbar-nav {
        flex-direction: column !important;
        gap: 0 !important;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        border-radius: 6px;
        margin: 0.25rem 0;
        text-align: center;
        transition: all 0.2s ease;
        cursor: pointer;
        display: block;
    }

    .navbar-nav .nav-link:hover {
        background-color: #f3f4f6;
    }

    .navbar-nav .nav-link.active {
        background-color: #eff6ff !important;
        color: #3b82f6 !important;
        border-bottom: none !important;
        padding-bottom: 0.75rem !important;
    }

    /* Ensure hamburger menu is always visible and clickable */
    .navbar-toggler {
        position: relative;
        z-index: 1001;
        background: transparent !important;
        border: none !important;
        padding: 8px !important;
        margin: 0 !important;
    }

    .navbar-toggler:focus {
        box-shadow: none !important;
        outline: none !important;
    }

    .navbar-toggler span {
        display: block;
        width: 25px;
        height: 3px;
        background-color: #1f2937;
        margin: 5px 0;
        transition: 0.3s;
        transform-origin: center;
    }

    .navbar-toggler[aria-expanded="true"] span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .navbar-toggler[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .navbar-toggler[aria-expanded="true"] span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
}

/* How It Works Section */
#howItWorksSteps {
    margin-bottom: 2rem !important;
    padding-bottom: 1.5rem;
    width: 100%;
}

#howItWorksSteps .d-flex {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    padding: 0 1rem;
    justify-content: center;
    align-items: flex-start;
}

.step-container {
    flex: 1;
    min-width: 0;
    max-width: 350px;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.step-container .mb-3 {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.step-circle {
    width: 60px;
    height: 60px;
    background-color: #3b82f6;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 700;
    position: relative;
    z-index: 2;
    margin: 0 auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .py-5 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    .card-body {
        padding: 1.25rem !important;
    }

    .card-body.p-4 {
        padding: 1rem !important;
    }

    #uploadZone {
        padding: 2rem 1rem !important;
    }

    .btn {
        font-size: 0.9rem;
        padding: 0.75rem 1.5rem;
        margin: 0.25rem 0.125rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-lg {
        padding: 1rem 2rem !important;
        font-size: 1rem !important;
        min-height: 48px !important;
    }

    .display-4 {
        font-size: 2rem;
        margin-bottom: 0.75rem !important;
        line-height: 1.2;
    }

    .lead {
        font-size: 1rem;
        margin-bottom: 1rem !important;
    }

    .step-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
        margin-bottom: 1rem !important;
    }

    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
        margin-bottom: 1rem !important;
    }

    .col-md-4 {
        padding: 0.75rem;
        margin-bottom: 1.5rem;
    }

    /* Cloud storage buttons - keep them on same line */
    #googleDriveBtn, #dropboxBtn {
        flex: 1 !important;
        min-width: 110px !important;
        max-width: 160px !important;
        width: auto !important;
        margin: 0 !important;
        justify-content: center;
        display: flex !important;
        padding: 0.75rem 0.8rem !important;
        font-size: 0.85rem !important;
    }

    /* Ensure cloud storage container stays flex on mobile */
    .d-flex.gap-3.justify-content-center.flex-wrap:has(#googleDriveBtn) {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.75rem !important;
        max-width: 100% !important;
        justify-content: center !important;
    }

    /* Reduce cloud storage section spacing on mobile */
    .row.justify-content-center.mb-4:has(#googleDriveBtn) {
        margin-bottom: 0.5rem !important;
        margin-top: -0.75rem !important;
    }

    /* Results section improvements */
    .results-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }

    .results-actions {
        justify-content: center;
        flex-direction: row !important;
        gap: 0.5rem !important;
        flex-wrap: nowrap !important;
    }

    .results-actions .btn {
        flex: 1;
        min-width: 90px;
        max-width: 140px;
        justify-content: center;
        font-size: 0.8rem !important;
        padding: 0.6rem 0.5rem !important;
    }

    .image-result-card {
        padding: 1rem !important;
    }

    .image-card-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }

    .image-actions {
        flex-direction: column;
        gap: 0.5rem !important;
    }

    .image-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .image-comparison {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .image-container img {
        height: 150px !important;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .py-5 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .card-body {
        padding: 1rem !important;
    }

    #uploadZone {
        padding: 1.5rem 0.75rem !important;
    }

    #uploadZone h4 {
        font-size: 1.25rem;
    }

    #uploadZone p {
        font-size: 0.95rem;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .btn-group .btn {
        border-radius: 8px !important;
        margin-bottom: 0.5rem;
        width: 100%;
    }

    .d-flex.gap-2 {
        flex-direction: column;
        gap: 0.75rem !important;
    }

    .d-flex.gap-3 {
        flex-direction: column;
        gap: 1rem !important;
    }

    .mb-5 {
        margin-bottom: 1.5rem !important;
    }

    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .text-center {
        padding: 0.75rem 0.5rem;
    }

    /* Enhanced mobile buttons */
    .btn {
        min-height: 48px;
        font-size: 0.95rem;
        padding: 0.875rem 1.25rem;
    }

    .btn i {
        font-size: 1rem;
    }

    /* Modal improvements for mobile */
    .modal-fullscreen .modal-body .row {
        flex-direction: column;
    }

    .modal-fullscreen .col-lg-8,
    .modal-fullscreen .col-lg-4 {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Results section mobile improvements */
    .results-container {
        padding: 1rem !important;
        margin: 0.5rem !important;
        border-radius: 12px !important;
    }

    .results-title-section h4 {
        font-size: 1.25rem;
    }

    .image-result-card {
        margin-bottom: 1rem !important;
        padding: 0.75rem !important;
    }

    .size-info {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.25rem !important;
        font-size: 0.85rem;
    }

    .reduction-badge {
        margin-top: 0.25rem;
        align-self: flex-start;
    }

    /* Compression settings mobile */
    .form-check {
        margin-bottom: 1rem;
    }

    .form-check-label {
        font-size: 0.95rem;
    }

    .form-range {
        margin: 1rem 0;
    }

    .input-group {
        margin-bottom: 1rem;
    }

    /* Touch-friendly form controls */
    .form-control, .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }

    /* Ensure compress all button is centered on all devices */
    #compressAllImagesBtn {
        display: block !important;
        margin: 0 auto !important;
        min-width: 200px;
    }
}

/* Quality Analysis Modal Styling */
.quality-analysis-panel {
    font-family: "Inter", "Roboto", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f8f9fa;
}

/* Modal Image Container Fixes */
.modal .split-view-container img {
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
    transform-origin: center center;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
}

@media (max-width: 768px) {
    .modal .split-view-container img {
        width: 100%;
        height: 100%;
    }
}

.quality-card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid #f1f3f4;
}

.quality-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    text-align: left;
}

.quality-card-header i {
    color: #3b82f6;
    font-size: 16px;
}

/* File Size Section */
.file-size-container {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.size-box {
    flex: 1;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px 8px;
    text-align: left;
    border: 1px solid #e9ecef;
}

.size-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 400;
}

.size-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

/* Image Details Section */
.image-details-container {
    display: flex;
    gap: 8px;
}

.format-box {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 12px 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.format-box:hover {
    border-color: #9ca3af;
}

.format-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 400;
}

.format-value {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.format-value.original {
    color: #007BFF;
}

.format-value.output {
    color: #28A745;
}

/* Quality Metrics Section */
.quality-metrics-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}

.metric-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.metric-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.metric-label {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
    margin-bottom: 2px;
}

.metric-sublabel {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.2;
    font-weight: 400;
}

.metric-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.metric-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.metric-value.ssim {
    color: #007BFF;
}

.metric-value.psnr {
    color: #28A745;
}

.metric-value.quality {
    color: #8b5cf6;
}

.metric-value.ratio {
    color: #f59e0b;
}

.metric-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: capitalize;
    letter-spacing: 0.025em;
}

.metric-tag.excellent {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

.metric-tag.good {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

/* Buttons */
.quality-buttons {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-download-compressed {
    width: 100%;
    background: #28A745;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-download-compressed:hover {
    background: #218838;
}

.btn-close-analysis {
    width: 100%;
    background: white;
    color: #1f2937;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close-analysis:hover {
    background: #f9fafb;
}

/* Image Remove Button */
.btn-danger.btn-sm.rounded-circle {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(220, 38, 38, 0.9);
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.btn-danger.btn-sm.rounded-circle:hover {
    background-color: var(--danger-color);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

.btn-danger.btn-sm.rounded-circle i {
    font-size: 14px !important;
    font-weight: bold;
}

/* Image Preview Enhancements */
.position-relative img {
    transition: all 0.3s ease;
}

.position-relative:hover img {
    transform: scale(1.02);
}

.position-relative:hover .btn-danger {
    opacity: 1;
}

/* Utility Classes */
.border-radius-lg {
    border-radius: 12px !important;
}

.shadow-custom {
    box-shadow: var(--shadow-md) !important;
}

.transition-all {
    transition: all 0.3s ease !important;
}

/* Small-screen: make per-image action buttons inline (two per row) and icon-only
   This overrides the generic stacking `.d-flex.gap-2` rule used elsewhere. */
@media (max-width: 576px) {
    /* Target the action containers inside the image preview cards */
    .card-body .d-grid.gap-2.mb-3 .d-flex.gap-2 {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        align-items: center;
        justify-content: center;
    }

    .card-body .d-grid.gap-2.mb-3 .d-flex.gap-2 .btn {
        width: calc(50% - 0.5rem) !important; /* two per row */
        display: inline-flex !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 0.5rem 0.5rem !important;
        min-height: 40px !important;
        font-size: 0.95rem !important;
    }

    /* Ensure icons are visible and slightly larger */
    .card-body .d-grid.gap-2.mb-3 .d-flex.gap-2 .btn i {
        font-size: 1.15rem !important;
    }

    /* Hide any leftover inline text inside buttons (defensive) */
    .card-body .d-grid.gap-2.mb-3 .d-flex.gap-2 .btn span {
        display: none !important;
    }
}