/**
 * Image Editor Styles
 * Dark theme with RTL support
 */

/* Modal Overlay */
.image-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Editor Container */
.image-editor-container {
    background: #1f2937;
    border-radius: 12px;
    width: 90vw;
    max-width: 900px;
    height: 90vh;
    max-height: 750px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Header */
.editor-header {
    padding: 20px 24px;
    border-bottom: 1px solid #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111827;
}

.editor-header h3 {
    color: white;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.btn-editor-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-editor-close:hover {
    color: white;
}

/* Crop Container */
.crop-container {
    position: relative;
    flex: 1;
    background: #000;
    min-height: 300px;
    overflow: hidden;
}

#editor-image {
    max-width: 100%;
    display: block;
}

/* Cropper.js Overrides */
.cropper-view-box {
    outline: 1px solid #3b82f6;
    outline-color: rgba(59, 130, 246, 0.75);
}

.cropper-point {
    background-color: #3b82f6;
}

.cropper-line {
    background-color: #3b82f6;
}

.cropper-face {
    background-color: transparent;
}

/* Controls */
.editor-controls {
    padding: 24px;
    background: #111827;
    border-top: 1px solid #374151;
}

.control-group {
    margin-bottom: 20px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #d1d5db;
    font-size: 14px;
    font-weight: 500;
}

.control-group span {
    min-width: 100px;
    white-space: nowrap;
}

.slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #374151;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.slider:hover::-webkit-slider-thumb {
    background: #2563eb;
}

.slider:hover::-moz-range-thumb {
    background: #2563eb;
}

.value-display {
    color: #9ca3af;
    font-size: 14px;
    min-width: 50px;
    text-align: right;
    font-weight: 500;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
}

.btn-icon {
    background: #374151;
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.btn-icon:hover {
    background: #4b5563;
    border-color: #6b7280;
}

.btn-icon:active {
    transform: scale(0.95);
}

/* Action Buttons */
.editor-actions {
    padding: 20px 24px;
    background: #111827;
    border-top: 1px solid #374151;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-editor-cancel,
.btn-editor-save {
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-editor-cancel {
    background: transparent;
    color: #d1d5db;
    border: 1px solid #4b5563;
}

.btn-editor-cancel:hover {
    background: #374151;
    border-color: #6b7280;
}

.btn-editor-save {
    background: #3b82f6;
    color: white;
}

.btn-editor-save:hover {
    background: #2563eb;
}

.btn-editor-save:disabled {
    background: #4b5563;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ===========================
   RTL SUPPORT
   =========================== */

[dir="rtl"] .editor-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .control-group label {
    flex-direction: row-reverse;
}

[dir="rtl"] .control-group span {
    text-align: right;
}

[dir="rtl"] .value-display {
    text-align: left;
}

[dir="rtl"] .quick-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .editor-actions {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* ===========================
   MOBILE RESPONSIVE
   =========================== */

@media (max-width: 768px) {
    .image-editor-container {
        width: 100vw;
        height: 100vh;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .editor-header {
        padding: 16px 20px;
    }

    .editor-header h3 {
        font-size: 16px;
    }

    .crop-container {
        min-height: 250px;
    }

    .editor-controls {
        padding: 16px 20px;
    }

    .control-group {
        margin-bottom: 16px;
    }

    .control-group span {
        min-width: 80px;
        font-size: 13px;
    }

    .quick-actions {
        margin-top: 12px;
        gap: 8px;
    }

    .btn-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .editor-actions {
        padding: 16px 20px;
    }

    .btn-editor-cancel,
    .btn-editor-save {
        padding: 10px 20px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .editor-controls {
        padding: 12px 16px;
    }

    .control-group span {
        min-width: 60px;
        font-size: 12px;
    }

    .quick-actions {
        flex-wrap: wrap;
    }

    .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .value-display {
        font-size: 12px;
        min-width: 40px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {

    .btn-icon,
    .btn-editor-cancel,
    .btn-editor-save {
        min-height: 44px;
    }

    .slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }

    .slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}