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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    margin: 0 auto;
    padding: 20px;
    padding-left: 200px;
    padding-right: 200px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 16px;
}

.main-content {
    display: flex;
    gap: 20px;
    min-height: 600px;
}

/* Ad Panels */
.ad-panel {
    position: fixed;
    top: 0;
    width: 180px;
    height: 100vh;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-panel-left {
    left: 0;
}

.ad-panel-right {
    right: 0;
}

.ad-placeholder {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    width: 160px;
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-content {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

.ad-content p {
    margin: 0 0 10px 0;
    font-weight: 500;
}

.ad-dimensions {
    font-size: 12px;
    color: #adb5bd;
}

/* Image Panel */
.image-panel {
    flex: 2;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    position: relative;
    min-height: 400px;
    overflow: visible;
    margin-right: 80px;
}

#imageCanvas {
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    object-fit: contain;
    display: none;
}

.placeholder {
    text-align: center;
    color: #6c757d;
    font-size: 18px;
}

.image-controls {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.image-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.batch-controls {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.batch-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    color: #495057;
}

.batch-navigation {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#fileName {
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Controls Panel */
.controls-panel {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.controls-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.control-group {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
}

.control-group h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 16px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 8px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #1e7e34;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

/* Form Controls */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.select-group {
    margin-bottom: 15px;
}

.select-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.select-group select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

/* Sliders */
.slider-group {
    margin-bottom: 15px;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider-row {
    display: flex;
    gap: 15px;
}

.slider-row .slider-group {
    flex: 1;
}

/* Advanced Controls */
.levels-controls,
.unsharp-controls,
.sharpening-controls,
.contrast-controls,
.curve-controls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.curve-controls button {
    width: 100%;
    margin-top: 5px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    word-wrap: break-word;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.toast.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.toast.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.toast.warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .container {
        padding-left: 140px;
        padding-right: 140px;
    }
    
    .ad-panel {
        width: 120px;
    }
    
    .ad-placeholder {
        width: 100px;
        height: 400px;
    }
    
    .ad-dimensions {
        font-size: 10px;
    }
}

@media (max-width: 1024px) {
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .ad-panel {
        display: none;
    }
    
    .controls-panel {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .slider-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .image-controls {
        justify-content: center;
    }
    
    .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Scrollbar Styling */
.controls-panel::-webkit-scrollbar {
    width: 8px;
}

.controls-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.controls-panel::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Curve Editor Modal */
.curve-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.curve-modal-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.curve-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.curve-modal-header h3 {
    margin: 0;
    color: #495057;
}

.curve-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.curve-close:hover {
    color: #495057;
}

.curve-editor-main {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.curve-canvas-container {
    flex: 2;
    height: 400px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
}

.curve-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.curve-preview-container h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 14px;
    text-align: center;
}

#curvePreviewCanvas {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
}

.curve-legend {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.curve-legend h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 16px;
}

.curve-legend ul {
    margin: 0;
    padding-left: 20px;
}

.curve-legend li {
    margin-bottom: 5px;
    font-size: 14px;
    color: #6c757d;
}

.curve-legend strong {
    color: #495057;
}

.curve-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Visual Editing Overlay */
.edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.crop-box {
    position: absolute;
    border: 2px solid #007bff;
    background: rgba(0, 123, 255, 0.1);
    pointer-events: all;
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    pointer-events: all;
    z-index: 11;
}

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

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

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

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

.crop-handle-n {
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    cursor: n-resize;
}

.crop-handle-s {
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    cursor: s-resize;
}

.crop-handle-w {
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    cursor: w-resize;
}

.crop-handle-e {
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    cursor: e-resize;
}

.rotation-handle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    pointer-events: all;
    z-index: 11;
}

.rotation-knob {
    width: 100%;
    height: 100%;
    background: #28a745;
    border: 3px solid white;
    border-radius: 50%;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.rotation-knob:active {
    cursor: grabbing;
}

.rotation-knob::before {
    content: '↻';
    color: white;
    font-size: 18px;
    font-weight: bold;
}

.edit-overlay.active {
    pointer-events: all;
}

/* Vertical Rotation Slider */
.rotation-slider {
    position: absolute;
    top: 20px;
    right: -60px;
    width: 40px;
    height: calc(100% - 40px);
    pointer-events: all;
    z-index: 11;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    border: 2px solid #28a745;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    padding: 8px;
}

.rotation-slider-track {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #28a745 0%, #ffc107 50%, #dc3545 100%);
    border-radius: 20px;
    border: 1px solid #dee2e6;
}

.rotation-slider-thumb {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #007bff;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
}

.rotation-slider-thumb:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
}

.rotation-slider-labels {
    position: absolute;
    right: -35px;
    top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 11px;
    font-weight: bold;
    color: #495057;
    pointer-events: none;
}

.rotation-label-top {
    color: #28a745;
}

.rotation-label-center {
    color: #ffc107;
}

.rotation-label-bottom {
    color: #dc3545;
}

/* Cookie Consent Banner */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 20px;
    z-index: 2000;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    border-top: 3px solid #007bff;
}

.cookie-consent.show {
    transform: translateY(0);
}

.cookie-content {
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.cookie-text h4 {
    margin: 0 0 8px 0;
    color: #fff;
    font-size: 18px;
}

.cookie-text p {
    margin: 0;
    color: #e9ecef;
    font-size: 14px;
    line-height: 1.4;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.cookie-buttons .btn {
    min-width: 100px;
    white-space: nowrap;
}

/* Responsive cookie banner */
@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .cookie-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .cookie-buttons .btn {
        flex: 1;
        max-width: 120px;
    }
}
