/* ==========================================================================
   pixxu.net - Image Editor CSS
   Spezifische Styles für den Bildeditor
   ========================================================================== */

/* ==========================================================================
   IMAGE EDITOR SPECIFIC STYLES
   ========================================================================== */

/* Enhanced range sliders for image editor */
#percentSlider,
#pixelateSlider,
#rotationSlider {
    background: linear-gradient(to right, var(--primary-color) 0%, var(--border-color) 0%);
    background-size: 0% 100%;
    background-repeat: no-repeat;
}

#percentSlider::-webkit-slider-thumb,
#pixelateSlider::-webkit-slider-thumb,
#rotationSlider::-webkit-slider-thumb {
    background: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

#percentSlider::-moz-range-thumb,
#pixelateSlider::-moz-range-thumb,
#rotationSlider::-moz-range-thumb {
    background: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Slider value indicators */
#percentValue,
#pixelateValue,
#rotationValue {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* ==========================================================================
   TRANSFORM CONTROLS
   ========================================================================== */

/* Transform section specific styles */
#transformCollapse .btn-group .btn {
    flex: 1;
    font-size: 0.9rem;
}

#transformCollapse .btn-outline-secondary:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

/* Rotation controls */
.rotation-controls {
    background: var(--light-bg);
    padding: 1rem;
    border-radius: 8px;
    margin: 0.5rem 0;
}

/* ==========================================================================
   EFFECTS CONTROLS
   ========================================================================== */

/* Pixelate controls */
.pixelate-controls h6 {
    color: var(--danger-color);
    border-bottom-color: rgba(239, 68, 68, 0.2);
}

.pixelate-controls .btn-outline-danger:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

/* Black & White controls */
.blackwhite-controls h6 {
    color: var(--text-primary);
}

.blackwhite-controls .btn-outline-dark {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.blackwhite-controls .btn-outline-dark:hover {
    background: var(--text-primary);
    color: white;
}

/* ==========================================================================
   CROP CONTROLS
   ========================================================================== */

/* Crop preset dropdown */
#cropPresets {
    background: var(--light-bg);
    border: 2px solid var(--border-color);
}

#cropPresets:focus {
    border-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Crop dimension inputs */
#cropWidth,
#cropHeight {
    border-color: var(--success-color);
}

#cropWidth:focus,
#cropHeight:focus {
    border-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ==========================================================================
   RESIZE CONTROLS
   ========================================================================== */

/* Resize mode buttons */
input[name="resizeMode"]:checked + label {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

/* Maintain aspect ratio checkbox */
#maintainAspectRatio:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Resize input validation */
#resizeWidth:invalid,
#resizeHeight:invalid {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   EXPORT CONTROLS
   ========================================================================== */

/* Compression controls */
.compression-controls {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(217, 119, 6, 0.05) 100%);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    margin-bottom: 1.5rem;
}

.compression-controls h6 {
    color: var(--warning-color);
    margin-bottom: 1rem;
}

#targetSize {
    border-color: var(--warning-color);
}

#targetSize:focus {
    border-color: var(--warning-color);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* Format conversion controls */
.format-controls {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(37, 99, 235, 0.05) 100%);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.format-controls h6 {
    color: var(--info-color);
    margin-bottom: 1rem;
}

/* ==========================================================================
   HISTORY CONTROLS
   ========================================================================== */

/* History button states */
#undoBtn:not(:disabled) {
    border-color: var(--info-color);
    color: var(--info-color);
}

#undoBtn:not(:disabled):hover {
    background: var(--info-color);
    color: white;
}

#redoBtn:not(:disabled) {
    border-color: var(--info-color);
    color: var(--info-color);
}

#redoBtn:not(:disabled):hover {
    background: var(--info-color);
    color: white;
}

/* History info text */
#historyInfo {
    color: var(--text-secondary);
    font-style: italic;
    background: var(--light-bg);
    padding: 0.5rem;
    border-radius: 6px;
    margin-top: 0.5rem;
}

/* ==========================================================================
   DOWNLOAD BUTTON
   ========================================================================== */

/* Enhanced download button */
.action-buttons .btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 2rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    position: relative;
    overflow: hidden;
}

.action-buttons .btn-success::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.action-buttons .btn-success:hover::before {
    left: 100%;
}

.action-buttons .btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   IMAGE QUALITY INDICATORS
   ========================================================================== */

/* Quality indicator for different formats */
.format-indicator {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.format-indicator.png {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.format-indicator.jpg {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.format-indicator.gif {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

/* ==========================================================================
   PROCESSING STATES
   ========================================================================== */

/* Processing overlay for heavy operations */
.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: inherit;
    backdrop-filter: blur(2px);
}

.processing-content {
    text-align: center;
    color: var(--primary-color);
}

.processing-content .spinner-border {
    margin-bottom: 1rem;
}

/* ==========================================================================
   TOOL SPECIFIC ANIMATIONS
   ========================================================================== */

/* Smooth transitions for value changes */
.value-transition {
    transition: all 0.3s ease;
}

/* Pulse animation for active tools */
@keyframes pulse-primary {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.active-tool {
    animation: pulse-primary 2s infinite;
}

/* ==========================================================================
   KEYBOARD SHORTCUTS HINTS
   ========================================================================== */

.keyboard-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--light-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-family: 'Courier New', monospace;
}

.shortcuts-info {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    margin-top: 1rem;
}

.shortcuts-info h6 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 768px) {
    /* Mobile-specific adjustments for image editor */
    .compression-controls,
    .format-controls {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .action-buttons .btn-success {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
    
    .keyboard-hint {
        display: none; /* Hide keyboard hints on mobile */
    }
    
    .shortcuts-info {
        display: none; /* Hide shortcuts info on mobile */
    }
}

@media (max-width: 576px) {
    /* Extra small screens */
    .format-controls .btn-group {
        flex-direction: column;
    }
    
    .format-controls .btn-group .btn {
        margin-bottom: 0.5rem;
        border-radius: 8px !important;
    }
    
    .format-controls .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

/* ==========================================================================
   RESET BUTTON GROUP STYLES
   ========================================================================== */

/* Reset button group specific styling */
.action-buttons .btn-group .btn-outline-warning {
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.action-buttons .btn-group .btn-outline-warning:hover {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.action-buttons .btn-group .btn-outline-danger {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.action-buttons .btn-group .btn-outline-danger:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

/* Ensure proper spacing between reset buttons */
.action-buttons .btn-group .btn-outline-warning {
    border-right: 1px solid var(--border-color);
}

.action-buttons .btn-group .btn-outline-danger {
    border-left: 1px solid transparent;
}

/* Mobile responsive adjustments for reset buttons */
@media (max-width: 576px) {
    .action-buttons .btn-group .btn {
        font-size: 0.85rem;
        padding: 0.625rem 0.75rem;
    }
    
    .action-buttons .btn-group .btn i {
        margin-right: 0.25rem;
    }
}

/* ==========================================================================
   WELCOME STATE CENTERING FIX
   ========================================================================== */

/* Ensure image container always has proper flex properties */
.image-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: var(--light-bg);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden;
    min-height: 400px;
    transition: all 0.3s ease;
}

/* Welcome state specific styles */
.welcome-state {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 400px !important;
    position: relative;
    z-index: 1;
}

.welcome-content {
    text-align: center;
    max-width: 500px;
    padding: 2rem;
    width: 100%;
}

/* Ensure proper display when image is loaded */
.image-container.has-image {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem;
}

/* Preview image positioning when loaded */
.image-container.has-image .preview-image {
    width: auto;
    height: auto;
    max-width: calc(100% - 2rem);
    max-height: calc(400px - 2rem);
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Hide welcome state when image is loaded */
.image-container.has-image .welcome-state {
    display: none !important;
}

/* Show welcome state when no image */
.image-container:not(.has-image) .welcome-state {
    display: flex !important;
}

/* Hide preview image when no image loaded */
.image-container:not(.has-image) .preview-image {
    display: none !important;
}

/* ==========================================================================
   RESET BUTTON GROUP STYLES
   ========================================================================== */

/* Reset button group specific styling */
.action-buttons .btn-group .btn-outline-warning {
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.action-buttons .btn-group .btn-outline-warning:hover {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.action-buttons .btn-group .btn-outline-danger {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.action-buttons .btn-group .btn-outline-danger:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

/* Ensure proper spacing between reset buttons */
.action-buttons .btn-group .btn-outline-warning {
    border-right: 1px solid var(--border-color);
}

.action-buttons .btn-group .btn-outline-danger {
    border-left: 1px solid transparent;
}

/* ==========================================================================
   MODAL STYLES ENHANCEMENT
   ========================================================================== */

/* Enhanced modal styling for clear editor confirmation */
#clearEditorModal .modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

#clearEditorModal .modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    background: var(--light-bg);
    border-radius: 16px 16px 0 0;
}

#clearEditorModal .modal-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.25rem;
}

#clearEditorModal .modal-body {
    padding: 2rem 1.5rem;
}

#clearEditorModal .modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    background: var(--light-bg);
    border-radius: 0 0 16px 16px;
}

#clearEditorModal .alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #92400e;
    border-radius: 8px;
    font-size: 0.9rem;
}

#clearEditorModal .text-danger {
    color: var(--danger-color) !important;
}

#clearEditorModal .text-warning {
    color: var(--warning-color) !important;
}

/* Button enhancements in modal */
#clearEditorModal .btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    border: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

#clearEditorModal .btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

#clearEditorModal .btn-secondary {
    background: var(--text-secondary);
    border: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

#clearEditorModal .btn-secondary:hover {
    background: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(71, 85, 105, 0.3);
}

/* Modal icon styling */
#clearEditorModal .fa-trash-alt {
    margin-bottom: 1rem;
    opacity: 0.8;
}

#clearEditorModal .fa-exclamation-triangle {
    opacity: 0.9;
}

/* Modal text styling */
#clearEditorModal h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

#clearEditorModal .text-muted {
    color: var(--text-secondary) !important;
    line-height: 1.5;
}

/* ==========================================================================
   LOADING OVERLAY ENHANCEMENTS
   ========================================================================== */

/* Enhanced loading overlay for image container */
.image-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 100;
}

/* Spin animation for loading indicator */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================================================== */

/* Focus states for modal elements */
#clearEditorModal .btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

#clearEditorModal .btn-close:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #clearEditorModal .modal-content {
        border: 2px solid var(--text-primary);
    }
    
    #clearEditorModal .alert-warning {
        border: 2px solid var(--warning-color);
    }
    
    .image-container {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #clearEditorModal .modal-content,
    #clearEditorModal .btn,
    .image-container {
        transition: none !important;
        animation: none !important;
    }
    
    #clearEditorModal .btn:hover {
        transform: none !important;
    }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .welcome-content {
        padding: 1.5rem;
    }
    
    .image-container {
        min-height: 300px;
    }
    
    .welcome-state {
        min-height: 300px !important;
    }
    
    .image-container.has-image .preview-image {
        max-height: calc(300px - 2rem);
    }
    
    #clearEditorModal .modal-body {
        padding: 1.5rem 1rem;
    }
    
    #clearEditorModal .modal-title {
        font-size: 1.1rem;
    }
    
    .action-buttons .btn-group .btn {
        font-size: 0.85rem;
        padding: 0.625rem 0.75rem;
    }
    
    .action-buttons .btn-group .btn i {
        margin-right: 0.25rem;
    }
}

@media (max-width: 576px) {
    .welcome-content {
        padding: 1rem;
    }
    
    .welcome-content h4 {
        font-size: 1.25rem;
    }
    
    .welcome-content .fa-5x {
        font-size: 3rem !important;
    }
    
    .image-container {
        min-height: 250px;
    }
    
    .welcome-state {
        min-height: 250px !important;
    }
    
    .image-container.has-image .preview-image {
        max-height: calc(250px - 2rem);
    }
    
    #clearEditorModal .modal-header,
    #clearEditorModal .modal-footer {
        padding: 1rem;
    }
    
    #clearEditorModal .modal-body {
        padding: 1rem;
    }
    
    #clearEditorModal .modal-title {
        font-size: 1rem;
    }
    
    #clearEditorModal .fa-trash-alt.fa-3x {
        font-size: 2rem !important;
    }
    
    #clearEditorModal .btn {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
    }
    
    .action-buttons .btn-group {
        flex-direction: column;
    }
    
    .action-buttons .btn-group .btn {
        border-radius: 8px !important;
        margin-bottom: 0.5rem;
    }
    
    .action-buttons .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

/* ==========================================================================
   DARK MODE PREPARATION (FUTURE)
   ========================================================================== */

/* Dark mode variables and styles for future implementation */
@media (prefers-color-scheme: dark) {
    #clearEditorModal .modal-content {
        background-color: #1e293b;
        color: #e2e8f0;
    }
    
    #clearEditorModal .modal-header,
    #clearEditorModal .modal-footer {
        background-color: #0f172a;
        border-color: #334155;
    }
    
    #clearEditorModal .alert-warning {
        background: rgba(245, 158, 11, 0.2);
        border-color: rgba(245, 158, 11, 0.3);
        color: #fbbf24;
    }
    
    .image-container {
        background-color: #0f172a;
        border-color: #334155;
    }
    
    .welcome-content h4 {
        color: #e2e8f0;
    }
    
    .welcome-content .text-muted {
        color: #94a3b8 !important;
    }
}
