* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    margin: 0;
    padding: 0;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

/* Image Comparison Section */
.image-comparison-section {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 1.5rem;
}

.comparison-container {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    background: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.comparison-wrapper {
    position: relative;
    height: 300px;
    overflow: hidden;
}

.comparison-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-image.original {
    z-index: 1;
}

.comparison-image.edited {
    z-index: 2;
    clip-path: inset(0 0 0 50%);
}

.placeholder-image {
    width: 500px;
    height: 280px;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.2rem;
    border-radius: 4px;
}

.comparison-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: white;
    cursor: ew-resize;
    z-index: 3;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.comparison-slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.comparison-slider::after {
    content: '◀ ▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #666;
}

.comparison-labels {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    justify-content: space-between;
    z-index: 4;
    pointer-events: none;
}

.comparison-label {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.stat-group {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.stat-value.reduction {
    color: #27ae60;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: #ddd;
}

/* Bottom Section */
.bottom-section {
    display: flex;
    background: white;
    min-height: 600px;
}

/* Actions Panel (Left) */
.actions-panel {
    width: 50%;
    background: #f8f9fa;
    border-right: 2px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 1.5rem;
    background: white;
    border-bottom: 2px solid #e0e0e0;
}

.panel-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #2c3e50;
}

.panel-header p {
    font-size: 0.875rem;
    color: #666;
}

/* Actions List Container - Add this */
.actions-list {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Action Section - Fixed CSS */
.action-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.action-header {
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.action-header:hover {
    background: #e9ecef;
}

.action-icon {
    width: 32px;
    height: 32px;
    background: #3498db;
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.action-title {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.action-toggle {
    color: #666;
    transition: transform 0.3s ease;
    font-size: 0.875rem;
}

/* Fixed animation approach */
.action-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.action-section.expanded .action-content {
    max-height: 500px;
    /* Set this high enough for your content */
    transition: max-height 0.3s ease-in;
}

/* Add padding animation separately to avoid jumping */
.action-content>* {
    padding: 1.5rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.action-section.expanded .action-content>* {
    opacity: 1;
    transform: translateY(0);
}

.action-section.expanded .action-toggle {
    transform: rotate(90deg);
}

.action-section.expanded .action-header {
    border-bottom-color: #e0e0e0;
}

/* Control Styles */
.control-group {
    margin-bottom: 1.5rem;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: #333;
    font-size: 0.875rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.radio-option:hover {
    border-color: #3498db;
}

.radio-option input[type="radio"] {
    cursor: pointer;
}

.aspect-ratio-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    border-color: #3498db;
}

.chip.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.input-field {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.875rem;
}

.input-field:focus {
    outline: none;
    border-color: #3498db;
}

.slider-container {
    margin-top: 0.5rem;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
}

.slider-value {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #666;
}

.apply-btn {
    width: 100%;
    padding: 0.75rem;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s;
}

.apply-btn:hover {
    background: #229954;
}

.format-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.format-option {
    padding: 0.75rem;
    text-align: center;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.format-option:hover {
    border-color: #3498db;
}

.format-option.selected {
    border-color: #3498db;
    background: #e3f2fd;
    color: #1976d2;
}

/* History Panel (Right) */
.history-panel {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.history-item {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-item.current {
    background: #e3f2fd;
    border-color: #3498db;
    border-width: 2px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.history-info {
    flex: 1;
}

.history-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.history-number {
    width: 28px;
    height: 28px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

.history-action {
    font-weight: 600;
    color: #333;
}

.history-time {
    font-size: 0.75rem;
    color: #666;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

.history-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.history-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

.history-btn.download {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.history-btn.download:hover {
    background: #2980b9;
    border-color: #2980b9;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 4px;
    margin-top: 0.75rem;
}

.history-stat {
    text-align: center;
}

.history-stat-label {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.history-stat-value {
    font-weight: 600;
    color: #333;
    font-size: 0.875rem;
}

.history-stat-value.reduction {
    color: #27ae60;
}

.current-badge {
    background: #3498db;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Checkbox styling */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.875rem;
    cursor: pointer;
}

/* Crop Panel Styles - Add to main.css */

/* Crop Panel - Replaces history panel when active */
.crop-panel {
    width: 50%;
    background: white;
    display: flex;
    flex-direction: column;
    position: relative;
}

.crop-interface {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

/* Crop Preview Container */
.crop-preview-container {
    background: #f0f0f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-preview {
    position: relative;
    max-width: 100%;
    max-height: 400px;
    display: inline-block;
}

.crop-preview img {
    max-width: 100%;
    max-height: 400px;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Filename Editor Styles */
.filename-editor-section {
    padding: 16px 24px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.filename-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.filename-label {
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.filename-input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 6px;
    overflow: hidden;
    flex: 1;
    max-width: 400px;
    transition: border-color 0.2s;
}

.filename-input-wrapper:focus-within {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.1);
}

.filename-input {
    border: none;
    padding: 8px 12px;
    font-size: 14px;
    flex: 1;
    outline: none;
    background: transparent;
    color: #212529;
}

.filename-extension {
    padding: 8px 12px;
    background: #e9ecef;
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
    border-left: 1px solid #ced4da;
}

.filename-reset-btn {
    padding: 8px;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filename-reset-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.filename-reset-btn:active {
    transform: translateY(1px);
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .filename-editor-section {
        background: #1a1a1a;
        border-color: #333;
    }

    .filename-input-wrapper {
        background: #2a2a2a;
        border-color: #444;
    }

    .filename-input {
        color: #fff;
    }

    .filename-extension {
        background: #333;
        color: #aaa;
        border-color: #444;
    }

    .filename-reset-btn {
        background: #2a2a2a;
        border-color: #444;
    }

    .filename-reset-btn:hover {
        background: #333;
        border-color: #555;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .filename-editor-section {
        padding: 12px 16px;
    }

    .filename-container {
        flex-wrap: wrap;
        gap: 8px;
    }

    .filename-label {
        width: 100%;
        text-align: center;
    }

    .filename-input-wrapper {
        max-width: 100%;
    }
}


/* Crop Box Overlay */
.crop-box {
    position: absolute;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    cursor: move;
    z-index: 2;
}

/* Grid lines */
.crop-grid-vertical {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

.crop-grid-vertical.left {
    left: 33.33%;
}

.crop-grid-vertical.right {
    left: 66.66%;
}

.crop-box::before,
.crop-box::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

.crop-box::before {
    top: 33.33%;
    left: 0;
    right: 0;
    height: 1px;
}

.crop-box::after {
    top: 66.66%;
    left: 0;
    right: 0;
    height: 1px;
}

/* Resize Handles */
.crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border: 2px solid #3498db;
    border-radius: 2px;
}

.crop-handle.nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.crop-handle.n {
    top: -6px;
    left: 50%;
    margin-left: -6px;
    cursor: n-resize;
}

.crop-handle.ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.crop-handle.e {
    top: 50%;
    right: -6px;
    margin-top: -6px;
    cursor: e-resize;
}

.crop-handle.se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.crop-handle.s {
    bottom: -6px;
    left: 50%;
    margin-left: -6px;
    cursor: s-resize;
}

.crop-handle.sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.crop-handle.w {
    top: 50%;
    left: -6px;
    margin-top: -6px;
    cursor: w-resize;
}

/* Crop Info */
.crop-info {
    position: absolute;
    bottom: -30px;
    left: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

/* Crop Controls */
.crop-controls {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.crop-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.input-row {
    display: flex;
    gap: 1rem;
}

.crop-inputs .input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crop-inputs label {
    font-size: 0.875rem;
    color: #666;
    width: 20px;
}

.crop-inputs .input-field {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Mini Preview */
.crop-mini-preview {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0.5rem;
    text-align: center;
}

.crop-mini-preview canvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Crop Actions */
.crop-actions {
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.preset-btn {
    padding: 8px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.preset-btn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.preset-btn.selected {
    background: #4CAF50;
    color: white;
    border-color: #45a049;
}

/* Update apply button to be more prominent */
.action-content .apply-btn {
    width: 100%;
    padding: 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.action-content .apply-btn:hover {
    background: #1976D2;
}

.action-content .apply-btn svg {
    width: 18px;
    height: 18px;
}

/* Crop panel improvements */
.crop-panel {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Make the Apply Crop button in crop panel more prominent */
.crop-actions .btn-primary {
    background: #4CAF50;
    font-weight: 600;
    padding: 12px 24px;
}

.crop-actions .btn-primary:hover {
    background: #45a049;
}

/* Panel Transition Animation */
.panel-transition {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.panel-transition-out {
    animation: slideOut 0.3s ease-out;
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Ensure no blur issues */
.site-header * {
    filter: none !important;
    backdrop-filter: none !important;
}