/* ============================================================
   PHOTO EDITOR CSS - Modern Clean Design
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Override body styles from base.html */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5 !important;
    color: #1a1a2e !important;
    min-height: 100vh;
}

/* Main container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Header - Clean Modern */
.header {
    text-align: center;
    padding: 24px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.25);
}

.header h1 {
    color: white;
    font-size: 2rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Editor Container */
.editor-container {
    display: flex;
    gap: 20px;
    min-height: 600px;
}

/* Sidebar - Clean Light */
.sidebar {
    width: 280px;
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.tool-section h3,
.tool-options h3 {
    margin-bottom: 10px;
    color: #4a4a6a;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

/* Tool Buttons - Clean */
.tool-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin: 3px 0;
    background: #f7f8fa;
    color: #4a4a6a;
    border: 1px solid #e8e8ee;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    font-size: 0.9rem;
    text-align: left;
}

.tool-btn:hover {
    background: #eef0f7;
    border-color: #667eea;
    color: #667eea;
    transform: translateX(4px);
}

.tool-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

/* Tool Options - Clean */
.tool-options {
    background: #f7f8fa;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e8e8ee;
}

.option-group {
    margin-bottom: 14px;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #6a6a8a;
    font-weight: 500;
}

.option-group input[type="range"] {
    width: 100%;
    height: 4px;
    background: #e0e0ea;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

.option-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: all 0.2s;
}

.option-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.option-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.option-group input[type="number"] {
    width: 100%;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #e0e0ea;
    color: #1a1a2e;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.25s;
}

.option-group input[type="number"]:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.08);
}

.option-group input[type="checkbox"] {
    margin-right: 6px;
    accent-color: #667eea;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.option-group select {
    width: 100%;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #e0e0ea;
    color: #1a1a2e;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.25s;
    cursor: pointer;
}

.option-group select:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.08);
}

input[type="radio"] {
    margin: 0 5px 0 10px;
    cursor: pointer;
    accent-color: #667eea;
    width: 14px;
    height: 14px;
}

input[type="radio"] + label {
    cursor: pointer;
    color: #6a6a8a;
    display: inline !important;
    font-size: 0.9rem;
}

input[type="radio"]:checked + label {
    color: #667eea;
    font-weight: 600;
}

/* File Operations - Clean */
.file-operations {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#imageUpload {
    display: none;
}

.upload-btn,
#downloadBtn,
#saveToServer,
#resetBtn {
    padding: 10px 16px;
    background: #f7f8fa;
    color: #4a4a6a;
    border: 1px solid #e8e8ee;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.25s ease;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
}

.upload-btn:hover,
#downloadBtn:hover,
#saveToServer:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

.upload-btn {
    border: 2px dashed #d0d0de;
    background: #fafbfc;
}

.upload-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

#resetBtn {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

#resetBtn:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

/* Canvas Container - Clean */
.canvas-container {
    flex: 1;
    background: #ffffff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    position: relative;
    min-height: 400px;
    border: 1px solid #e8e8ee;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

#mainCanvas {
    max-width: 100%;
    max-height: 100%;
    background: transparent;
}

/* History Panel - Clean */
.history-panel {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e8e8ee;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.history-panel h3 {
    color: #4a4a6a;
    margin-bottom: 12px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

#undoBtn,
#redoBtn {
    padding: 8px 18px;
    margin: 5px 5px 5px 0;
    background: #f7f8fa;
    color: #4a4a6a;
    border: 1px solid #e8e8ee;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.25s ease;
    font-weight: 500;
}

#undoBtn:hover,
#redoBtn:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

#undoBtn:disabled,
#redoBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

#historyList {
    max-height: 100px;
    overflow-y: auto;
    margin-top: 10px;
}

#historyList::-webkit-scrollbar {
    width: 4px;
}

#historyList::-webkit-scrollbar-track {
    background: transparent;
}

#historyList::-webkit-scrollbar-thumb {
    background: #d0d0de;
    border-radius: 2px;
}

.history-item {
    padding: 6px 12px;
    background: #f7f8fa;
    margin: 4px 0;
    border-radius: 6px;
    font-size: 12px;
    color: #6a6a8a;
    transition: all 0.25s;
    border-left: 2px solid transparent;
}

.history-item:hover {
    background: #eef0f7;
}

.history-item.current {
    border-left: 2px solid #667eea;
    background: rgba(102, 126, 234, 0.06);
    color: #4a4a6a;
    font-weight: 500;
}

/* Action Buttons */
.action-btn {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.25s ease;
    font-family: inherit;
    font-weight: 500;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

.cancel-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.cancel-btn:hover {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

/* Drawing Tools */
.draw-tool-btn {
    width: 42px;
    height: 42px;
    background: #f7f8fa;
    border: 2px solid #e8e8ee;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    color: #4a4a6a;
}

.draw-tool-btn:hover {
    background: #eef0f7;
    border-color: #667eea;
    transform: scale(1.05);
    color: #667eea;
}

.draw-tool-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.quick-color {
    transition: all 0.25s ease;
    cursor: pointer;
    border-radius: 50%;
}

.quick-color:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .editor-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 16px;
    }
    
    .tool-section {
        width: 100%;
    }
    
    .tool-section .tool-btn {
        display: inline-block;
        width: auto;
        padding: 8px 16px;
        margin: 3px;
    }
    
    .tool-options {
        width: 100%;
    }
    
    .file-operations {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .file-operations .upload-btn,
    .file-operations #downloadBtn,
    .file-operations #saveToServer,
    .file-operations #resetBtn {
        flex: 1;
        min-width: 100px;
    }
    
    .canvas-container {
        min-height: 350px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .sidebar {
        padding: 12px;
    }
    
    .file-operations .upload-btn,
    .file-operations #downloadBtn,
    .file-operations #saveToServer,
    .file-operations #resetBtn {
        flex: 1 1 100%;
    }
    
    .canvas-container {
        min-height: 250px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 14px;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .tool-section .tool-btn {
        font-size: 0.8rem;
        padding: 5px 12px;
    }
    
    .sidebar {
        gap: 8px;
        padding: 10px;
    }
}