/* Image Drawing CSS - Fabric.js-based annotation tool styles
 * Glassmorphism theme matching existing design system
 * Desktop-only implementation (no mobile support)
 * Lines: ~250
 */

/* ============================================================================
 * CANVAS CONTAINER
 * ============================================================================ */

.drawing-canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: none; /* Hidden by default, shown when drawing enabled */
    flex-direction: column;
    background: rgba(0, 0, 0, 0.95); /* Dark overlay */
}

.drawing-canvas-container.active {
    display: flex;
}

/* Canvas wrapper for centering */
.drawing-canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

/* Main drawing canvas */
.drawing-canvas {
    cursor: crosshair;
    border: 2px solid rgba(255, 140, 0, 0.3);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.drawing-canvas:hover {
    border-color: rgba(255, 140, 0, 0.5);
}

/* Canvas cursor styles */
.drawing-canvas.brush-mode {
    cursor: crosshair;
}

.drawing-canvas.eraser-mode {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="white" stroke="black"><rect x="6" y="6" width="12" height="12"/></svg>') 12 12, auto;
}

/* ============================================================================
 * TOOL PANEL - GLASSMORPHISM THEME
 * ============================================================================ */

.drawing-tools-panel {
    background: rgba(15, 15, 15, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(80, 80, 80, 0.3);
    border-radius: 16px 16px 0 0;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    min-height: 80px;
    flex-wrap: nowrap;
}

/* ============================================================================
 * TOOL BUTTONS
 * ============================================================================ */
.enable-drawing-btn {
    display: flex;
    justify-content: center;
}

.drawing-tool-btn {
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid rgba(80, 80, 80, 0.3);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    position: relative;
}

.drawing-tool-btn:hover {
    background: rgba(60, 60, 60, 0.8);
    border-color: #ff8c00;
    color: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.2);
}

.drawing-tool-btn:active {
    transform: translateY(0);
}

.drawing-tool-btn.active,
.drawing-tool-btn-active {
    background: rgba(255, 140, 0, 0.2);
    border-color: #ff8c00;
    color: #ff8c00;
    box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.1);
}

.drawing-tool-btn.active:hover,
.drawing-tool-btn-active:hover {
    background: rgba(255, 140, 0, 0.3);
}

.drawing-tool-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.drawing-tool-btn:disabled:hover {
    background: rgba(40, 40, 40, 0.6);
    border-color: rgba(80, 80, 80, 0.3);
    transform: none;
}

/* Bootstrap Icons support */
.drawing-tool-btn i {
    font-size: 1.1rem;
}

/* ============================================================================
 * DIVIDER
 * ============================================================================ */

.drawing-divider {
    width: 1px;
    height: 40px;
    background: rgba(80, 80, 80, 0.3);
    margin: 0 8px;
}

/* ============================================================================
 * TOOL GROUPS AND LABELS
 * ============================================================================ */

.drawing-tool-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawing-slider-group {
    padding: 4px 12px;
    background: rgba(30, 30, 30, 0.5);
    border-radius: 8px;
}

.drawing-label {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

.drawing-size-value {
    color: #ff8c00;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 30px;
    text-align: right;
}

.drawing-btn-text {
    font-size: 0.85rem;
}

/* ============================================================================
 * COLOR PICKER
 * ============================================================================ */

.drawing-color-picker {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(80, 80, 80, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    padding: 0;
}

.drawing-color-picker:hover {
    border-color: #ff8c00;
    transform: scale(1.15);
}

.drawing-color-swatch {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.drawing-color-swatch:hover {
    transform: scale(1.15);
    border-color: #ff8c00;
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

.drawing-color-swatch.active,
.drawing-color-swatch-active {
    border-color: #ff8c00;
    box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.3);
    transform: scale(1.1);
}

/* Custom color input */
.drawing-custom-color-input {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(80, 80, 80, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    padding: 0;
}

.drawing-custom-color-input:hover {
    border-color: #ff8c00;
    transform: scale(1.15);
}

/* Hide default color picker appearance */
.drawing-custom-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 50%;
    overflow: hidden;
}

.drawing-custom-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.drawing-custom-color-input::-moz-color-swatch {
    border: none;
    border-radius: 50%;
}

/* ============================================================================
 * BRUSH SIZE CONTROL
 * ============================================================================ */

.drawing-brush-size-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px;
    background: rgba(30, 30, 30, 0.5);
    border-radius: 8px;
}

.drawing-brush-size-control label {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

.drawing-brush-slider {
    width: 120px;
    height: 6px;
    background: rgba(80, 80, 80, 0.3);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

/* Webkit (Chrome, Safari, Edge) */
.drawing-brush-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #ff8c00;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(255, 140, 0, 0.4);
}

.drawing-brush-slider::-webkit-slider-thumb:hover {
    background: #ff6b35;
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.6);
}

/* Firefox */
.drawing-brush-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #ff8c00;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(255, 140, 0, 0.4);
}

.drawing-brush-slider::-moz-range-thumb:hover {
    background: #ff6b35;
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.6);
}

/* Brush size value display */
#drawing-brush-size-value {
    color: #ff8c00;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

/* ============================================================================
 * ACTION BUTTONS
 * ============================================================================ */

.drawing-action-btn {
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid rgba(80, 80, 80, 0.3);
    border-radius: 8px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.drawing-action-btn:hover {
    background: rgba(60, 60, 60, 0.8);
    border-color: #ff8c00;
    color: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.2);
}

.drawing-action-btn:active {
    transform: translateY(0);
}

.drawing-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.drawing-action-btn i {
    font-size: 1rem;
}

/* ============================================================================
 * SPACER
 * ============================================================================ */

.drawing-spacer {
    flex: 1;
    min-width: 12px;
}

/* ============================================================================
 * SAVE/CANCEL BUTTONS
 * ============================================================================ */

.drawing-save-btn {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b35 100%);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.3);
}

.drawing-save-btn:hover {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c00 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 140, 0, 0.4);
}

.drawing-save-btn:active {
    transform: translateY(0);
}

.drawing-save-btn i {
    font-size: 1rem;
}

.drawing-cancel-btn {
    background: rgba(60, 50, 40, 0.6);
    border: 1px solid rgba(100, 80, 60, 0.3);
    border-radius: 8px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #c9a584;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.drawing-cancel-btn:hover {
    background: rgba(80, 65, 50, 0.8);
    border-color: rgba(150, 120, 90, 0.5);
    color: #f0e6d2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 80, 60, 0.3);
}

.drawing-cancel-btn:active {
    transform: translateY(0);
}

.drawing-cancel-btn i {
    font-size: 1rem;
}

/* ============================================================================
 * UNSUPPORTED MESSAGE
 * ============================================================================ */

#drawing-unsupported-message {
    display: none;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    color: #fca5a5;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

#drawing-unsupported-message.show {
    display: block;
}

/* ============================================================================
 * UNSAVED CHANGES INDICATOR
 * ============================================================================ */

#drawing-unsaved-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 8px;
    padding: 8px 16px;
    color: #fbbf24;
    font-size: 0.85rem;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 11;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#drawing-unsaved-indicator.show {
    display: flex;
}

/* ============================================================================
 * RESPONSIVE (DESKTOP ONLY - NO MOBILE SUPPORT PER PLAN)
 * ============================================================================ */

/* Large desktop adjustments */
@media (min-width: 1920px) {
    .drawing-tools-panel {
        padding: 20px 32px;
        gap: 16px;
    }

    .drawing-tool-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    .drawing-brush-slider {
        width: 150px;
    }
}

/* Small desktop adjustments */
@media (max-width: 1366px) {
    .drawing-tools-panel {
        padding: 12px 16px;
        gap: 8px;
    }

    .drawing-tool-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .drawing-color-swatch {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }

    .drawing-brush-slider {
        width: 100px;
    }

    .drawing-action-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* ============================================================================
 * ACCESSIBILITY (A11Y)
 * ============================================================================ */

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard navigation */
.drawing-tool-btn:focus-visible,
.drawing-action-btn:focus-visible,
.drawing-color-swatch:focus-visible,
.drawing-brush-slider:focus-visible {
    outline: 2px solid #ff8c00;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .drawing-tool-btn {
        border: 2px solid;
    }

    .drawing-tool-btn-active {
        border-width: 3px;
    }

    .drawing-color-swatch {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .drawing-tool-btn,
    .drawing-action-btn,
    .drawing-color-swatch,
    .drawing-brush-slider::-webkit-slider-thumb,
    .drawing-brush-slider::-moz-range-thumb {
        transition: none;
    }

    .drawing-tool-btn:hover,
    .drawing-action-btn:hover,
    .drawing-color-swatch:hover {
        transform: none;
    }
}

/* ============================================================================
 * LOADING STATE
 * ============================================================================ */

.drawing-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 12;
    text-align: center;
}

.drawing-loading .spinner {
    /* Inherits from main.css spinner */
    width: 50px;
    height: 50px;
    margin: 0 auto 16px;
}

.drawing-loading-text {
    color: #94a3b8;
    font-size: 0.9rem;
}

/* ============================================================================
 * PROGRESS DISPLAY ENHANCEMENTS
 * ============================================================================ */

/* Progress text container styling */
#progressText {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Progress icon styling */
.progress-icon {
    color: #ff8c00;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
}

.progress-icon i {
    font-size: 1.1rem;
}

/* Progress stage text */
.progress-stage {
    color: #e2e8f0;
    font-weight: 500;
    font-size: 0.95rem;
}

/* Progress details (file size, etc.) */
.progress-detail {
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 2px 8px;
    background: rgba(80, 80, 80, 0.3);
    border-radius: 4px;
}

/* Progress percentage display */
.progress-percentage {
    color: #ff8c00;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 2px 8px;
    background: rgba(255, 140, 0, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(255, 140, 0, 0.2);
}

/* Progress elapsed time display */
.progress-time {
    color: #94a3b8;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    padding: 2px 6px;
    background: rgba(60, 60, 60, 0.4);
    border-radius: 4px;
}

/* Progress bar container (for future enhancement) */
.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(80, 80, 80, 0.3);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff8c00 0%, #ff6b35 100%);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Compression ratio display */
.compression-ratio {
    color: #51cf66;
    font-size: 0.85rem;
    padding: 2px 8px;
    background: rgba(81, 207, 102, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(81, 207, 102, 0.2);
}

/* Responsive adjustments for progress elements */
@media (max-width: 1366px) {
    .progress-icon i {
        font-size: 1rem;
    }

    .progress-stage {
        font-size: 0.9rem;
    }

    .progress-detail,
    .progress-percentage,
    .progress-time {
        font-size: 0.8rem;
    }
}
