/* ===================================
   VERSION MOBILE FINALE - OPTIMISÉE
   Design simple et fonctionnel
   =================================== */

/* BASE MOBILE */
@media (max-width: 768px) {
    
    /* Reset et base */
    * {
        box-sizing: border-box;
    }
    
    html, body {
        overflow-x: hidden;
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* ================================
       HEADER MOBILE - SIMPLE ET FIXE
       ================================ */
    
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: white;
        border-bottom: 1px solid #e5e7eb;
        padding: 16px 20px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        max-width: 100%;
    }
    
    .logo {
        font-size: 22px;
        font-weight: 700;
        color: #FF6B35;
    }
    
    .nav-links {
        display: none !important;
    }
    
    /* Cacher aussi dans le menu si visible */
    .nav-links li a[href*="fonctionnalites"] {
        display: none !important;
    }
    
    .user-menu {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    /* CACHER CRÉDITS ET NAVIGATION */
    .credits-display,
    .nav-links,
    a[href*="fonctionnalites"],
    a[href*="#fonctionnalites"] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
    }
    
    .header .btn-secondary,
    .header .btn-primary {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 8px;
    }
    
    /* ================================
       PAGE UPLOAD MOBILE
       ================================ */
    
    .upload-container {
        padding: 20px;
        margin-top: 80px;
        width: 100%;
    }
    
    .upload-card {
        padding: 24px 20px;
        background: white;
        border-radius: 16px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        width: 100%;
    }
    
    .upload-card h1 {
        font-size: 26px;
        margin-bottom: 12px;
        color: #1f2937;
    }
    
    .upload-card > p {
        font-size: 15px;
        color: #6b7280;
        margin-bottom: 24px;
        line-height: 1.5;
    }
    
    /* Zone d'upload */
    .upload-zone {
        padding: 48px 24px;
        border: 3px dashed #d1d5db;
        border-radius: 16px;
        background: #f9fafb;
        text-align: center;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .upload-zone:active {
        border-color: #FF6B35;
        background: #fff5f0;
    }
    
    .upload-zone svg {
        width: 64px;
        height: 64px;
        margin: 0 auto 20px;
        color: #FF6B35;
    }
    
    .upload-zone h3 {
        font-size: 18px;
        margin-bottom: 8px;
        color: #1f2937;
        font-weight: 600;
    }
    
    .upload-zone p {
        font-size: 14px;
        color: #6b7280;
        margin-bottom: 20px;
    }
    
    .btn-upload {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 14px 28px;
        font-size: 16px;
        background: #FF6B35;
        color: white;
        border: none;
        border-radius: 10px;
        font-weight: 600;
    }
    
    /* ================================
       PREVIEW IMAGES - GRANDES ET VISIBLES
       ================================ */
    
    .preview-grid,
    .file-list {
        display: flex;
        flex-direction: column;
        gap: 16px;
        margin-top: 24px;
        width: 100%;
    }
    
    .preview-item {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 16px;
        background: white;
        border: 2px solid #e5e7eb;
        border-radius: 12px;
        width: 100%;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    /* IMAGE GRANDE ET VISIBLE */
    .preview-item img {
        width: 140px !important;
        height: 140px !important;
        min-width: 140px !important;
        min-height: 140px !important;
        object-fit: cover;
        border-radius: 10px;
        flex-shrink: 0;
        background: #f3f4f6;
        border: 2px solid #e5e7eb;
    }
    
    /* Info fichier */
    .file-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .file-info h4 {
        font-size: 16px;
        font-weight: 600;
        color: #1f2937;
        margin: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .file-info p {
        font-size: 14px;
        color: #6b7280;
        margin: 0;
    }
    
    /* Bouton supprimer */
    .remove-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fee2e2;
        color: #dc2626;
        border: 2px solid #fecaca;
        border-radius: 10px;
        font-size: 24px;
        font-weight: 700;
        cursor: pointer;
    }
    
    /* Boutons d'action */
    .btn-process,
    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 16px 24px;
        font-size: 17px;
        font-weight: 600;
        border-radius: 12px;
        margin-top: 24px;
        min-height: 56px;
        cursor: pointer;
    }
    
    .btn-process,
    .btn-primary {
        background: #FF6B35;
        color: white;
        border: none;
    }
    
    /* ================================
       ÉDITEUR MOBILE
       ================================ */
    
    .editor-container {
        display: flex;
        flex-direction: column-reverse;
        min-height: 100vh;
        padding-top: 80px;
    }
    
    /* Canvas en haut */
    .canvas-area {
        flex: 1;
        padding: 20px;
        background: #f9fafb;
        min-height: 50vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    canvas {
        max-width: 100%;
        max-height: 45vh;
        width: auto;
        height: auto;
        display: block;
        margin: 0 auto;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    
    /* Slider Avant/Après */
    .comparison-wrapper {
        position: relative;
        width: 100%;
        max-width: 100%;
    }
    
    .slider-button {
        width: 56px;
        height: 56px;
        background: white;
        border-radius: 50%;
        box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    }
    
    .comparison-labels {
        top: 16px;
        padding: 0 16px;
    }
    
    .label-before,
    .label-after {
        font-size: 13px;
        padding: 8px 14px;
        background: rgba(0,0,0,0.75);
        color: white;
        border-radius: 20px;
    }
    
    /* Panneau de contrôles en bas */
    .controls-panel {
        width: 100%;
        max-height: 45vh;
        overflow-y: auto;
        background: white;
        border-top: 2px solid #e5e7eb;
        padding: 20px;
    }
    
    .panel-section {
        margin-bottom: 24px;
    }
    
    .panel-section h3 {
        font-size: 17px;
        margin-bottom: 16px;
        color: #1f2937;
        font-weight: 600;
    }
    
    /* Contrôles */
    .control-group {
        margin-bottom: 20px;
    }
    
    .control-group label {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
        font-size: 15px;
        color: #374151;
    }
    
    .control-group input[type="range"] {
        width: 100%;
        height: 8px;
        -webkit-appearance: none;
        background: #e5e7eb;
        border-radius: 4px;
    }
    
    .control-group input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 24px;
        height: 24px;
        background: #FF6B35;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(255,107,53,0.4);
    }
    
    /* Filtres en grille */
    .filters-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .filter-btn {
        padding: 12px 8px;
        background: #f3f4f6;
        border: 2px solid transparent;
        border-radius: 10px;
        font-size: 13px;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .filter-btn:active,
    .filter-btn.active {
        border-color: #FF6B35;
        background: #fff5f0;
    }
    
    .filter-preview {
        height: 60px;
        border-radius: 8px;
        margin-bottom: 8px;
    }
    
    /* Boutons */
    .btn-reset {
        width: 100%;
        padding: 14px;
        background: white;
        color: #FF6B35;
        border: 2px solid #FF6B35;
        border-radius: 10px;
        font-size: 16px;
        font-weight: 600;
    }
    
    /* ================================
       MODAL MOBILE
       ================================ */
    
    .modal-content {
        width: 94%;
        max-width: 420px;
        padding: 28px 24px;
        margin: 20px auto;
        border-radius: 16px;
    }
    
    .modal-title {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .modal-subtitle {
        font-size: 15px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea {
        width: 100%;
        font-size: 16px;
        padding: 14px;
        border-radius: 10px;
    }
    
    /* ================================
       FOOTER MOBILE
       ================================ */
    
    .footer {
        padding: 40px 20px;
        text-align: center;
        font-size: 14px;
    }
}

/* TRÈS PETIT MOBILE (< 480px) */
@media (max-width: 480px) {
    
    .logo {
        font-size: 20px;
    }
    
    .credits-display {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .header .btn-secondary,
    .header .btn-primary {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .upload-card h1 {
        font-size: 22px;
    }
    
    .preview-item img {
        width: 120px !important;
        height: 120px !important;
        min-width: 120px !important;
        min-height: 120px !important;
    }
    
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
