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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
}

.main-content {
    flex: 1;
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.photo-editor {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    flex: 2;
}

.canvas-container {
    position: relative;
    margin-bottom: 30px;
    border-radius: 15px;
    overflow: hidden;
    background: #f8f9fa;
    border: 3px dashed #dee2e6;
    transition: all 0.3s ease;
}

.canvas-container:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.15);
}

#photoCanvas {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.upload-area {
    text-align: center;
    padding: 40px;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.7;
}

.upload-area p {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #495057;
}

.upload-hint {
    font-size: 0.9rem !important;
    color: #6c757d !important;
    font-style: italic;
}

.controls {
    display: grid;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 500;
    color: #495057;
    font-size: 0.95rem;
}

.input-group input {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group select {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.input-group select:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group select:hover {
    border-color: #667eea;
    background-color: white;
}

.input-group select option {
    padding: 8px 12px;
    background: white;
    color: #333;
}

.input-group select option:hover {
    background: #f8f9fa;
}

.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.btn-primary {
    background: #667eea;
    color: white;
    grid-column: 1 / -1;
}

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

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

/* Instructions avec bouton d'aide pour mobile */
.instructions {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    flex: 1;
    height: fit-content;
}

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

.instructions h3 {
    color: #495057;
    font-size: 1.3rem;
    margin: 0;
}

.help-toggle {
    background: #667eea;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.help-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.help-toggle.active {
    background: #28a745;
    transform: rotate(180deg);
}

.help-icon {
    font-size: 1.2rem;
    color: white;
}

.instructions-content {
    transition: all 0.3s ease;
}

.instructions-content ol {
    list-style: none;
    counter-reset: step-counter;
}

.instructions-content li {
    counter-increment: step-counter;
    margin-bottom: 15px;
    padding-left: 40px;
    position: relative;
    line-height: 1.6;
    color: #6c757d;
}

.instructions-content li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: #667eea;
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .main-content {
        flex-direction: column;
        gap: 30px;
    }
    
    .photo-editor,
    .instructions {
        padding: 20px;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
    
    .btn-primary {
        grid-column: 1;
    }
    
    .upload-area {
        padding: 30px 20px;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    /* Instructions mobiles - cachées par défaut */
    .instructions-content {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
    }
    
    .instructions-content.show {
        max-height: 300px;
        opacity: 1;
        margin-top: 15px;
    }
    
    /* Bouton d'aide plus visible sur mobile */
    .help-toggle {
        animation: pulse 2s infinite;
    }
    
    @keyframes pulse {
        0% {
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }
        50% {
            box-shadow: 0 4px 20px rgba(102, 126, 234, 0.6);
        }
        100% {
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .photo-editor,
    .instructions {
        padding: 15px;
    }
    
    .upload-area {
        padding: 20px 15px;
    }
    
    .upload-area p {
        font-size: 1rem;
    }
    
    .upload-hint {
        font-size: 0.8rem !important;
    }
    
    /* Instructions encore plus compactes sur très petit écran */
    .instructions-header {
        margin-bottom: 10px;
    }
    
    .instructions h3 {
        font-size: 1.1rem;
    }
    
    .help-toggle {
        width: 35px;
        height: 35px;
    }
    
    .help-icon {
        font-size: 1rem;
    }
}

/* Desktop - instructions toujours visibles */
@media (min-width: 769px) {
    .instructions-content {
        max-height: none !important;
        opacity: 1 !important;
    }
    
    .help-toggle {
        display: none;
    }
}

/* Animation pour le drag & drop */
.canvas-container.drag-over {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
    transform: scale(1.02);
}

/* Animation de chargement */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}


.footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
    font-size: 0.9rem;
}

