/**
 * ================================================================
 * Photo Editor - Éditeur avec stickers (Mobile-First v3.30.0)
 * ================================================================
 *
 * Éditeur de photo fullscreen avec emojis, stickers, et canvas interactif
 * Architecture mobile-first avec breakpoints progressifs
 *
 * @version 3.30.0
 */

/* ================================================================
   1. CSS VARIABLES
   ================================================================ */
:root {
    --editor-primary: #4F5BD5;
    --editor-secondary: #6C7BFF;
    --editor-gradient: linear-gradient(135deg, var(--editor-primary) 0%, var(--editor-secondary) 100%);
    --editor-bg-dark: #1a1a1a;
    --editor-bg-medium: #2a2a2a;
    --editor-bg-light: #3a3a3a;
    --editor-border: #333;
    --editor-delete: #dc3545;
    --editor-clear: #6c757d;
    --editor-white: #FFFFFF;

    --cal-transition-base: 0.3s ease;
    --cal-transition-fast: 0.2s ease;
}

/* ================================================================
   2. EDITOR CONTAINER
   ================================================================ */
.photo-editor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    overflow-y: auto;
    padding: 10px;
    transform: translate3d(0, 0, 0);
}

@media (min-width: 768px) {
    .photo-editor {
        padding: 20px;
    }
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.editor-header h3 {
    color: var(--editor-white);
    font-size: 18px;
    margin: 0;
}

@media (min-width: 768px) {
    .editor-header h3 {
        font-size: 24px;
    }
}

.editor-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--editor-white);
    font-size: 24px;
    cursor: pointer;
    transition: all var(--cal-transition-base);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transform: translate3d(0, 0, 0);
}

.editor-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) translate3d(0, 0, 0);
}

@media (hover: none) {
    .editor-close:active {
        opacity: 0.85;
    }
}

/* ================================================================
   3. EDITOR CONTENT
   ================================================================ */
.editor-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .editor-content {
        flex-direction: row;
    }
}

.editor-canvas-container {
    flex: 1;
    background: var(--editor-bg-medium);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transform: translate3d(0, 0, 0);
}

@media (min-width: 768px) {
    .editor-canvas-container {
        padding: 20px;
    }
}

.editor-canvas-container::after {
    content: "💡 Double-clic: rotation • Molette souris: taille • Pinch mobile: taille";
    display: block;
    position: relative;
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: var(--editor-white);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 10px;
    text-align: center;
    max-width: 100%;
}

@media (min-width: 768px) {
    .editor-canvas-container::after {
        font-size: 12px;
        margin-top: 20px;
    }
}

#photo-canvas {
    max-width: 100%;
    max-height: 50vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    cursor: move;
    touch-action: none;
}

@media (min-width: 768px) {
    #photo-canvas {
        max-height: 70vh;
    }
}

/* ================================================================
   4. TOOLS PANEL
   ================================================================ */
.editor-tools {
    width: 100%;
    background: var(--editor-bg-dark);
    border-radius: 12px;
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .editor-tools {
        width: 300px;
        max-height: 70vh;
    }
}

.tool-section {
    margin-bottom: 25px;
}

.tool-section h4 {
    color: var(--editor-white);
    font-size: 16px;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--editor-border);
}

.tool-section:first-child h4::after {
    content: " (clic pour ajouter)";
    font-size: 11px;
    color: #888;
    font-weight: normal;
}

.emoji-list,
.stickers-list {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

@media (min-width: 768px) {
    .emoji-list,
    .stickers-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

.emoji-btn,
.sticker-btn {
    background: var(--editor-bg-medium);
    border: 2px solid var(--editor-border);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all var(--cal-transition-fast);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transform: translate3d(0, 0, 0);
}

@media (min-width: 768px) {
    .emoji-btn,
    .sticker-btn {
        padding: 10px;
        font-size: 24px;
    }
}

.emoji-btn:hover,
.sticker-btn:hover {
    background: var(--editor-bg-light);
    border-color: var(--editor-primary);
    transform: scale(1.1) translate3d(0, 0, 0);
}

@media (hover: none) {
    .emoji-btn:active,
    .sticker-btn:active {
        opacity: 0.85;
        transform: scale(1.05) translate3d(0, 0, 0);
    }
}

.sticker-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ================================================================
   5. ACTION BUTTONS
   ================================================================ */
.action-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cal-transition-fast);
    margin-bottom: 10px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transform: translate3d(0, 0, 0);
}

.action-btn.delete-btn {
    background: var(--editor-delete);
    color: var(--editor-white);
}

.action-btn.delete-btn:hover {
    background: #c82333;
    transform: translateY(-2px) translate3d(0, 0, 0);
}

@media (hover: none) {
    .action-btn.delete-btn:active {
        opacity: 0.85;
    }
}

.action-btn.clear-btn {
    background: var(--editor-clear);
    color: var(--editor-white);
}

.action-btn.clear-btn:hover {
    background: #5a6268;
    transform: translateY(-2px) translate3d(0, 0, 0);
}

@media (hover: none) {
    .action-btn.clear-btn:active {
        opacity: 0.85;
    }
}

/* ================================================================
   6. FOOTER & SAVE BUTTON
   ================================================================ */
.editor-footer {
    text-align: center;
    margin-top: 30px;
}

.save-editor-btn {
    background: var(--editor-gradient);
    color: var(--editor-white);
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cal-transition-base);
    box-shadow: 0 4px 15px rgba(79, 91, 213, 0.4);
    width: 100%;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

@media (min-width: 768px) {
    .save-editor-btn {
        padding: 15px 40px;
        font-size: 18px;
        width: auto;
    }
}

.save-editor-btn:hover {
    transform: translateY(-2px) translate3d(0, 0, 0);
    box-shadow: 0 6px 20px rgba(79, 91, 213, 0.6);
}

@media (hover: none) {
    .save-editor-btn:active {
        opacity: 0.85;
        transform: scale(0.98) translate3d(0, 0, 0);
    }
}

/* ================================================================
   7. SCROLLBAR
   ================================================================ */
.editor-tools::-webkit-scrollbar {
    width: 8px;
}

.editor-tools::-webkit-scrollbar-track {
    background: var(--editor-bg-dark);
}

.editor-tools::-webkit-scrollbar-thumb {
    background: var(--editor-primary);
    border-radius: 4px;
}

.editor-tools::-webkit-scrollbar-thumb:hover {
    background: var(--editor-secondary);
}
