/* Photo Editor Modal Styles */
.photo-editor-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.photo-editor-modal[style*="display: flex"] {
    display: flex !important;
}

.photo-editor-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    max-width: 96vw;
    max-height: 96vh;
    min-width: 800px;
    width: auto;
    height: 96vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.photo-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.03);
}

.photo-editor-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #243243;
}

.close-editor-btn {
    background: none;
    border: none;
    color: rgba(0, 0, 0, 0.4);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.close-editor-btn:hover {
    color: rgba(0, 0, 0, 0.8);
}

.photo-editor-body {
    padding: 15px;
    overflow: hidden;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.canvas-container-with-controls {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-height: 100%;
    width: auto;
}

#photoEditorCanvas {
    display: block;
    max-width: calc(96vw - 100px);
    max-height: calc(96vh - 250px);
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#photoEditorCanvas.dragging {
    cursor: grabbing !important;
}

/* Vertical Perspective Slider (Left of Canvas) */
.slider-vertical-left {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 12px 8px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    width: 40px;
    height: 200px;
}

.slider-vertical-left .arrow-icon {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
    user-select: none;
    line-height: 1;
    flex-shrink: 0;
}

.slider-vertical-left input[type="range"] {
    width: 160px;
    height: 4px;
    transform: rotate(-90deg);
    margin: 0;
    flex-shrink: 0;
}

/* Horizon Slider (Bottom of Canvas) */
.slider-bottom-center {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.slider-bottom-center label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(0, 0, 0, 0.6);
    white-space: nowrap;
}

.slider-bottom-center input[type="range"] {
    width: 300px;
}

.slider-bottom-center span {
    font-size: 13px;
    font-weight: 600;
    color: #243243;
    font-family: 'SF Mono', Monaco, monospace;
    min-width: 40px;
    text-align: center;
}

/* Bottom Controls Group */
.bottom-controls-group {
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.action-buttons-row {
    display: contents;
}

/* Aspect Ratio Buttons */
.aspect-ratio-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.aspect-ratio-buttons .ratio-btn,
.aspect-ratio-buttons .rotate-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #243243;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.aspect-ratio-buttons .ratio-btn:hover,
.aspect-ratio-buttons .rotate-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.25);
}

.aspect-ratio-buttons .ratio-btn.active {
    background: var(--accent, #6c7ea0);
    border-color: var(--accent, #6c7ea0);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(108, 126, 160, 0.3);
}

.aspect-ratio-buttons .rotate-btn {
    margin-left: 6px;
    background: rgba(0, 0, 0, 0.03);
    padding: 8px;
    font-size: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Action Buttons */
.action-buttons-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.action-btn {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #243243;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-height: 44px;
    max-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.25);
}

.action-btn-right {
    background: var(--accent, #6c7ea0);
    border: 1px solid rgba(108, 126, 160, 0.3);
    box-shadow: 0 4px 16px rgba(108, 126, 160, 0.2);
    color: #ffffff;
}

.action-btn-right:hover {
    background: #7c8fb0;
    box-shadow: 0 4px 16px rgba(108, 126, 160, 0.3);
}

.action-btn.compare-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #243243;
}

.action-btn.compare-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.25);
}

.action-btn.compare-btn.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: #243243;
}

/* Range Sliders */
input[type="range"] {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.1);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent, #6c7ea0);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent, #6c7ea0);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 860px) {
    .photo-editor-content {
        height: 100vh;
        max-height: 100vh;
        min-width: 650px;
    }
    
    .photo-editor-body {
        padding: 12px;
    }
    
    .canvas-container-with-controls {
        width: 100%;
        height: 100%;
    }
    
    #photoEditorCanvas {
        max-width: calc(100vw - 60px);
        max-height: calc(100vh - 400px);
    }
    
    .slider-vertical-left {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        padding: 10px 8px;
        width: 40px;
        height: 180px;
    }
    
    .slider-vertical-left input[type="range"] {
        width: 130px;
    }
    
    .slider-bottom-center {
        position: relative;
        bottom: auto;
        margin: 16px auto 0 auto;
        max-width: calc(100vw - 60px);
    }
    
    .slider-bottom-center input[type="range"] {
        width: 220px;
    }
    
    .bottom-controls-group {
        position: relative;
        bottom: auto;
        flex-direction: column;
        align-items: center;
        margin: 16px auto 0 auto;
        max-width: calc(100vw - 40px);
        gap: 12px;
    }
    
    .aspect-ratio-buttons {
        order: 1;
        width: 100%;
        max-width: 500px;
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .aspect-ratio-buttons .ratio-btn,
    .aspect-ratio-buttons .rotate-btn {
        min-width: 70px;
        height: 40px;
    }
    
    .action-buttons-row {
        order: 2;
        width: 100%;
        max-width: 500px;
        margin-top: 0;
        gap: 12px;
    }
    
    .action-btn {
        flex: 1;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .photo-editor-content {
        max-width: 100vw;
        max-height: 100vh;
        min-width: 100vw;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
    
    .photo-editor-header {
        padding: 10px 12px;
    }
    
    .photo-editor-header h2 {
        font-size: 15px;
    }
    
    .photo-editor-body {
        padding: 8px;
    }
    
    .canvas-container-with-controls {
        margin-bottom: 0;
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        display: block;
        position: relative;
        padding: 0;
    }
    
    #photoEditorCanvas {
        width: 100%;
        max-width: 100%;
        max-height: calc(100vh - 310px);
        height: auto;
        margin: 0 auto;
        display: block;
        position: relative;
    }
    
    /* Perspective slider - overlay on canvas, left side */
    .slider-vertical-left {
        position: relative;
        left: 8px;
        top: auto;
        transform: none;
        width: 34px;
        height: 130px;
        padding: 8px 5px;
        flex-direction: column;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(12px);
        z-index: 10;
        gap: 0;
        margin-top: -220px;
        margin-bottom: auto;
        float: left;
        border: 1px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    }
    
    .slider-vertical-left input[type="range"] {
        width: 90px;
        transform: rotate(-90deg);
        margin: 0;
        flex-shrink: 0;
    }
    
    .slider-vertical-left .arrow-icon {
        font-size: 11px;
        opacity: 0.8;
        flex-shrink: 0;
        line-height: 1;
        color: rgba(0, 0, 0, 0.5);
    }
    
    /* Horizon slider - absolute overlay at bottom of canvas */
    .slider-bottom-center {
        position: relative;
        bottom: 45px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        max-width: calc(100% - 70px);
        padding: 8px 16px;
        margin: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 12px;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(12px);
        z-index: 10;
        border: 1px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    }
    
    .slider-bottom-center input[type="range"] {
        width: 130px;
        flex-shrink: 0;
    }
    
    .slider-bottom-center label {
        font-size: 9px;
        flex-shrink: 0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        opacity: 0.9;
        color: rgba(0, 0, 0, 0.6);
    }
    
    .slider-bottom-center span {
        font-size: 9px;
        min-width: 30px;
        flex-shrink: 0;
        font-family: 'SF Mono', Monaco, monospace;
        font-weight: 600;
        color: #243243;
    }
    
    /* Bottom controls - relative position, below horizon slider */
    .bottom-controls-group {
        position: relative;
        bottom: auto;
        top: auto;
        left: 0;
        right: 0;
        transform: none;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        margin: 10px 0 15px 0;
        padding: 0;
        flex-direction: column;
        align-items: center;
        box-sizing: border-box;
    }
    
    .aspect-ratio-buttons {
        order: 1;
        width: 100%;
        max-width: 100%;
        gap: 5px;
        padding: 6px;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: auto auto;
        grid-auto-flow: row;
        box-sizing: border-box;
        background: transparent;
        border: none;
        box-shadow: none;
    }
    
    /* ALL buttons EXACTLY same - complete reset of any differences */
    .aspect-ratio-buttons .ratio-btn {
        font-size: 10px;
        font-weight: 500;
        padding: 0;
        margin: 0;
        border: 1px solid rgba(0, 0, 0, 0.15);
        background: rgba(0, 0, 0, 0.05);
        color: #243243;
        width: 100%;
        height: 34px;
        min-width: 0;
        max-width: 100%;
        min-height: 34px;
        max-height: 34px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        line-height: 1;
    }
    
    .aspect-ratio-buttons .ratio-btn.active {
        background: var(--accent, #6c7ea0);
        border-color: var(--accent, #6c7ea0);
        color: #ffffff;
        box-shadow: 0 2px 8px rgba(108, 126, 160, 0.3);
    }
    
    /* Rotate buttons - IDENTICAL styling, only font-size differs */
    .aspect-ratio-buttons .rotate-btn {
        font-size: 16px;
        font-weight: 500;
        padding: 0;
        margin: 0;
        border: 1px solid rgba(0, 0, 0, 0.15);
        background: rgba(0, 0, 0, 0.05);
        color: #243243;
        width: 100%;
        height: 34px;
        min-width: 0;
        max-width: 100%;
        min-height: 34px;
        max-height: 34px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        line-height: 1;
    }
    
    /* Action buttons row - side by side, centered */
    .action-buttons-row {
        order: 2;
        display: flex;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .action-btn {
        font-size: 11px;
        padding: 10px 8px;
        flex: 1;
        text-align: center;
        box-sizing: border-box;
    }
}
