/* ==========================================
   VARIABLES CSS
   ========================================== */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6366f1;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #ffffff36;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* ==========================================
   RESET & BASE
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: background: #3ab4a6;
background: linear-gradient(180deg, rgba(58, 180, 166, 0.33) 0%, rgba(90, 109, 219, 0.41) 50%, rgba(69, 215, 252, 0.56) 100%);;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

/* ==========================================
   CONTAINER
   ========================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    background: #833AB4;
    background: linear-gradient(180deg, rgba(131, 58, 180, 0.33) 0%, rgba(250, 112, 197, 0.41) 50%, rgba(69, 215, 252, 0.56) 100%);
}

/* ==========================================
   HEADER
   ========================================== */
header {
    text-align: center;
    padding: 40px 20px 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 400;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
main {
    padding: 40px 30px;
}

/* ==========================================
   DROP ZONE
   ========================================== */
.drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 60px 20px;
    text-align: center;
    background: var(--bg-light);
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
    transform: scale(1.01);
}

.drop-zone-content h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 600;
}

.drop-zone-content p {
    color: var(--text-secondary);
    margin: 15px 0;
}

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

.file-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 20px !important;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn-primary,
.btn-secondary,
.btn-clear {
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    width: 100%;
    margin-top: 30px;
    font-size: 1.3rem;
    padding: 18px 32px;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-clear {
    background: transparent;
    color: var(--danger-color);
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-clear:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ==========================================
   FILES SECTION
   ========================================== */
.files-section {
    margin-top: 30px;
}

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

.section-header h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    font-weight: 600;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ==========================================
   FILES LIST
   ========================================== */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: move;
}

.file-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}

.file-item.dragging {
    opacity: 0.6;
    border-style: dashed;
}

.file-item.drop-target {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.06);
}

.file-meta {
    flex: 1;
    min-width: 0;
}

.file-handle {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 6px;
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: white;
    cursor: grab;
    user-select: none;
    margin-left: 8px;
}

.file-handle:active {
    cursor: grabbing;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.file-preview {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    font-weight: 700;
    border-radius: 8px;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.file-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.file-info-content {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.file-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ==========================================
   PROGRESS BAR
   ========================================== */
.progress-container {
    margin: 25px 0;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-light);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==========================================
   SUCCESS MESSAGE
   ========================================== */
.success-message {
    text-align: center;
    padding: 60px 20px;
    animation: fadeIn 0.5s ease;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-width: 540px;
    margin: 30px auto;
    position: relative;
    overflow: hidden;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 20px;
    animation: scaleIn 0.5s ease;
}

.success-message::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.15), rgba(16, 185, 129, 0.15));
    opacity: 0.4;
    pointer-events: none;
}

.success-message .success-body {
    position: relative;
    z-index: 1;
}

.success-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.success-message h3 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.success-message p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* ==========================================
   FOOTER
   ========================================== */
footer {
    text-align: center;
    padding: 20px;
    background: var(--bg-light);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

/* ==========================================
   SCROLLBAR CUSTOM
   ========================================== */
.files-list::-webkit-scrollbar {
    width: 8px;
}

.files-list::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.files-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.files-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==========================================
   RESPONSIVE - TABLET
   ========================================== */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 30px 20px;
    }

    .drop-zone {
        padding: 40px 15px;
    }

    .drop-zone-content h2 {
        font-size: 1.2rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ==========================================
   RESPONSIVE - MOBILE
   ========================================== */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header {
        padding: 30px 15px 25px;
    }

    header h1 {
        font-size: 1.7rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    main {
        padding: 25px 15px;
    }

    .drop-zone {
        padding: 30px 10px;
    }

    .upload-icon {
        font-size: 3rem;
    }

    .btn-primary {
        font-size: 1.1rem;
        padding: 16px 24px;
    }

    .btn-secondary {
        padding: 12px 24px;
        font-size: 1rem;
    }

    .file-item {
        padding: 12px;
        gap: 10px;
    }

    .file-icon {
        font-size: 1.5rem;
    }

    .file-name {
        font-size: 0.9rem;
    }

    .file-size {
        font-size: 0.8rem;
    }

    .success-message {
        padding: 40px 15px;
    }

    .success-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .success-message h3 {
        font-size: 1.4rem;
    }
}

/* ==========================================
   BOUTON RETOUR EN HAUT
   ========================================== */
.back-to-top {
    position: fixed;
    bottom: 55px;
    left: 55px;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
}

.back-to-top:active {
    transform: translateY(-1px);
}

.back-to-top:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

/* Responsive - mobile */
@media (max-width: 480px) {
    .back-to-top {
        width: 42px;
        height: 42px;
        bottom: 16px;
        left: 16px;
    }
    
    .back-to-top svg {
        width: 20px;
        height: 20px;
    }
}

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

/* ==========================================
   SECTION FONCTIONNALITÉS
   ========================================== */
.features-section {
    margin-top: 65px;
    padding-top: 45px;
    border-top: 1px solid var(--border-color);
}

.features-section h2 {
    text-align: center;
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 35px;
    font-weight: 700;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.feature-card {
    background: var(--bg-light);
    padding: 25px 20px;
    border-radius: var(--radius-md);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.feature-card:hover {
    background: #eba2ff;
    border-color: var(--border-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 600;
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ==========================================
   SECTION POURQUOI UTILISER
   ========================================== */
.why-section {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.why-section h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 25px;
    font-weight: 700;
}

.why-content {
    color: var(--text-secondary);
    line-height: 1.8;
}

.why-content p {
    margin-bottom: 20px;
}

.why-content h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 30px 0 15px;
    font-weight: 600;
}

.benefits-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.benefits-list li {
    padding: 12px 0 12px 35px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.benefits-list li:last-child {
    border-bottom: none;
}

.benefits-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* ==========================================
   SECTION COMMENT ÇA MARCHE
   ========================================== */
.howto-section {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.howto-section h2 {
    text-align: center;
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 35px;
    font-weight: 700;
}

.steps-container {
    display: flex;
    justify-content: space-between;
    gap: 30px;
}

.step {
    flex: 1;
    text-align: center;
    padding: 25px 20px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    position: relative;
}

.step-number {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 20px;
}

.step h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 600;
}

.step p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ==========================================
   SECTION FAQ
   ========================================== */
.faq-section {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.faq-section h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 30px;
    font-weight: 700;
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item[open] {
    background: white;
    box-shadow: var(--shadow-sm);
}

.faq-item summary {
    padding: 18px 20px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s ease;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 300;
    transition: transform 0.3s ease;
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-item summary:hover {
    background: rgba(79, 70, 229, 0.05);
}

.faq-item summary h3 {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
    padding-right: 20px;
}

.faq-item p {
    padding: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.95rem;
}

/* ==========================================
   FOOTER AMÉLIORÉ
   ========================================== */
.footer-content {
    text-align: center;
}

.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.footer-nav a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-nav a:hover {
    text-decoration: underline;
}

/* ==========================================
   RESPONSIVE - SECTIONS SEO (Tablet)
   ========================================== */
@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .steps-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .features-section h2,
    .why-section h2,
    .howto-section h2,
    .faq-section h2 {
        font-size: 1.5rem;
    }
    
    .feature-card {
        padding: 20px 15px;
    }
    
    .feature-icon {
        font-size: 2rem;
    }
}

/* ==========================================
   RESPONSIVE - SECTIONS SEO (Mobile)
   ========================================== */
@media (max-width: 480px) {
    .features-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .features-section,
    .why-section,
    .howto-section,
    .faq-section {
        margin-top: 35px;
        padding-top: 30px;
    }
    
    .features-section h2,
    .why-section h2,
    .howto-section h2,
    .faq-section h2 {
        font-size: 1.3rem;
        margin-bottom: 25px;
    }
    
    .why-content h3 {
        font-size: 1.1rem;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .faq-item summary h3 {
        font-size: 0.95rem;
    }
    
    .benefits-list li {
        padding: 10px 0 10px 30px;
        font-size: 0.95rem;
    }
}

/* ==========================================
   OPTIMISATIONS PERFORMANCE (CLS)
   ========================================== */
.drop-zone {
    min-height: 280px;
}

.feature-card {
    min-height: 180px;
}

.step {
    min-height: 160px;
}

/* Prevent layout shift on images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================
   FOCUS STATES (Accessibilité)
   ========================================== */
button:focus-visible,
a:focus-visible,
details:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
    .drop-zone,
    .files-section,
    .btn-primary,
    .btn-secondary {
        display: none !important;
    }
    
    body {
        background: white;
        padding: 0;
    }
    
    .container {
        box-shadow: none;
    }
}
