/* Variables de couleur pour le thème clair et sombre */
:root {
    --bg-color: #f4f7f6;
    --text-color: #333;
    --container-bg: #ffffff;
    --input-bg: #ffffff;
    --input-border: #ddd;
    --button-bg: #3498db;
    --button-text: #ffffff;
    --button-hover-bg: #2980b9;
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --error-color: #e74c3c;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --icon-color: #555;

    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
    --bg-color: #2c3e50;
    --text-color: #ecf0f1;
    --container-bg: #34495e;
    --input-bg: #4a6278;
    --input-border: #56708a;
    --button-bg: #3498db; /* Peut rester le même ou changer */
    --button-text: #ffffff;
    --button-hover-bg: #2980b9;
    --primary-color: #3498db;
    --secondary-color: #27ae60;
    --error-color: #c0392b;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --icon-color: #bdc3c7;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column; /* Pour placer le toggle en haut */
    align-items: center;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.theme-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 12px;
    background-color: var(--container-bg);
    color: var(--text-color);
    border: 1px solid var(--input-border);
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    box-shadow: 0 2px 5px var(--shadow-color);
}
.theme-switcher:hover {
    opacity: 0.8;
}


.container {
    background-color: var(--container-bg);
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 6px 20px var(--shadow-color);
    width: 100%;
    max-width: 650px;
    text-align: center;
    margin-top: 60px; /* Espace pour le switcher */
    transition: background-color 0.3s;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 2em;
}

p {
    color: var(--text-color);
    opacity: 0.9;
    margin-bottom: 30px;
    font-size: 1em;
}

.form-group {
    margin-bottom: 25px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

/* Zone de Glisser-Déposer */
#dropZone {
    border: 3px dashed var(--input-border);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s;
    background-color: var(--bg-color); /* légèrement différent du fond principal */
    margin-bottom: 20px;
}

#dropZone.dragover {
    border-color: var(--primary-color);
    background-color: rgba(52, 152, 219, 0.1); /* Teinte de la couleur primaire */
}

#dropZone p {
    margin: 0;
    font-size: 1.1em;
    color: var(--text-color);
    opacity: 0.7;
}
#dropZone p strong {
    color: var(--primary-color);
}

#fileToUpload { /* Input de fichier caché, mais fonctionnel */
    display: none;
}

/* Affichage des informations du fichier sélectionné */
#fileInfo {
    display: flex;
    align-items: center;
    background-color: var(--bg-color);
    border: 1px solid var(--input-border);
    border-radius: 5px;
    padding: 10px 15px;
    margin-top: 15px;
    font-size: 0.95em;
}

#fileIcon {
    font-size: 2em; /* Taille de l'emoji/icône */
    margin-right: 15px;
    color: var(--icon-color);
}

#fileName {
    color: var(--text-color);
    word-break: break-all;
}


button[type="submit"], .copy-link-button {
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.1s ease;
    width: 100%;
    display: inline-block; /* Pour copy-link-button */
}

button[type="submit"]:hover, .copy-link-button:hover {
    background-color: var(--button-hover-bg);
}
button[type="submit"]:active, .copy-link-button:active {
    transform: translateY(1px);
}

button[type="submit"]:disabled {
    background-color: #bdc3c7; /* Gris neutre */
    cursor: not-allowed;
    opacity: 0.7;
}

.message {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 0.95em;
    text-align: left;
    border: 1px solid transparent;
    word-wrap: break-word;
}

.message.success {
    background-color: rgba(46, 204, 113, 0.1); /* Teinte de var(--secondary-color) */
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.message.success strong { /* Pour le lien de téléchargement */
    font-weight: 600;
}

.message.success a { /* Style du lien */
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}
.message.success a:hover {
    text-decoration: underline;
}


.message.error {
    background-color: rgba(231, 76, 60, 0.1); /* Teinte de var(--error-color) */
    color: var(--error-color);
    border-color: var(--error-color);
}

/* Barre de progression */
#progressContainer {
    width: 100%;
    background-color: var(--input-border);
    border-radius: 8px;
    margin-top: 20px;
    overflow: hidden;
    height: 24px;
}

#progressBar {
    width: 0%;
    height: 100%;
    background-color: var(--secondary-color); /* Vert pour succès/progression */
    text-align: center;
    line-height: 24px;
    color: white;
    border-radius: 8px 0 0 8px; /* coins arrondis à gauche */
    transition: width 0.3s ease-in-out;
}
#progressText { /* Peut être affiché à l'intérieur ou à l'extérieur de la barre */
    text-align: center;
    font-size: 0.85em;
    margin-top: 5px;
    color: var(--text-color);
}
/* Ajustement pour afficher le texte DANS la barre */
#progressBar #progressTextInBar {
    color: white;
    font-weight: bold;
    position: relative; /* Ou absolute si vous jouez avec le positionnement */
}


/* Bouton Copier Lien */
.download-info {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Aligne le lien et le bouton */
    gap: 10px; /* Espace entre lien et bouton */
    word-break: break-all; /* Pour que le lien ne déborde pas */
}

.download-info .link-text {
    flex-grow: 1; /* Le lien prend l'espace disponible */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-link-button {
    padding: 8px 15px;
    font-size: 0.9em;
    width: auto; /* Ajuste la largeur au contenu */
    flex-shrink: 0; /* Empêche le bouton de rétrécir */
}


/* Responsive adjustments */
@media (max-width: 700px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 20px 25px;
        margin-top: 70px; /* Un peu plus d'espace pour le switcher */
    }
    h1 {
        font-size: 1.8em;
    }
    #dropZone {
        padding: 30px 15px;
    }
    .download-info {
        flex-direction: column; /* Empile le lien et le bouton sur mobile */
        align-items: stretch; /* Étire les éléments */
    }
    .copy-link-button {
        width: 100%; /* Le bouton prend toute la largeur */
        margin-top: 10px;
    }
}

/* Styles pour la balise main pour pousser le footer en bas */
main {
    flex-grow: 1; /* Fait en sorte que main prenne tout l'espace vertical disponible */
    width: 100%; /* S'assurer que main prend toute la largeur */
    display: flex; /* Pour centrer le .container à l'intérieur */
    justify-content: center;
    align-items: flex-start; /* Ou center si vous préférez */
    padding-top: 20px; /* Un peu d'espace en haut de main */
    padding-bottom: 40px; /* Espace avant le footer */
}


/* Styles pour le Footer */
footer {
    background-color: var(--container-bg); /* Un peu différent du fond général pour le démarquer */
    color: var(--text-color);
    padding: 40px 20px;
    width: 100%;
    box-shadow: 0 -4px 15px var(--shadow-color); /* Ombre en haut du footer */
    border-top: 1px solid var(--input-border);
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.footer-container {
    max-width: 1100px; /* Largeur max du contenu du footer */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px; /* Espace entre les sections principales et le bas */
}

.footer-main {
    display: flex;
    flex-wrap: wrap; /* Permet aux sections de passer à la ligne sur mobile */
    justify-content: space-between;
    gap: 30px; /* Espace entre les sections du footer */
}

.footer-section {
    flex: 1; /* Permet aux sections de grandir */
    min-width: 200px; /* Largeur minimale avant de passer à la ligne */
    margin-bottom: 20px; /* Espace en bas de chaque section (pour mobile) */
}

.footer-section h3, .footer-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

.footer-branding p {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 0; /* Ajuster si nécessaire */
    line-height: 1.5;
}

.footer-links ul, .footer-legal ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links ul li, .footer-legal ul li {
    margin-bottom: 10px;
}

.footer-links ul li a, .footer-legal ul li a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
    font-size: 0.95em;
}

.footer-links ul li a:hover, .footer-legal ul li a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.footer-social {
    display: flex;
    gap: 15px; /* Espace entre les icônes sociales */
    align-items: center; /* Centre les icônes verticalement si elles ont des tailles différentes */
    margin-top: 20px; /* Espace au-dessus des icônes sociales si elles sont séparées */
    justify-content: center; /* Centre les icônes si .footer-main est en colonne */
}

.footer-social a {
    color: var(--icon-color); /* Couleur des icônes sociales */
    text-decoration: none;
    display: inline-block; /* Pour que les transformations fonctionnent bien */
    transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
}
.footer-social a img { /* Si vous utilisez des <img> pour les SVGs */
    width: 24px; /* Taille des icônes */
    height: 24px;
    vertical-align: middle;
    fill: currentColor; /* Permet aux SVGs inline de prendre la couleur du lien */
}

.footer-social a:hover {
    color: var(--primary-color);
    transform: translateY(-2px); /* Petit effet de lévitation */
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--input-border);
    font-size: 0.85em;
    opacity: 0.7;
}

.footer-bottom .heart {
    color: var(--error-color); /* Ou une couleur spécifique pour le coeur */
    font-size: 1.1em; /* Un peu plus grand */
    display: inline-block;
    animation: heartbeat 1.5s infinite;
}

/* Animation pour le coeur (optionnel) */
@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}


/* Responsive pour le footer */
@media (max-width: 768px) {
    .footer-main {
        flex-direction: column; /* Empile les sections sur mobile */
        align-items: center; /* Centre les sections empilées */
        text-align: center; /* Centre le texte dans les sections */
    }
    .footer-section {
        min-width: 100%; /* Chaque section prend toute la largeur */
        margin-bottom: 30px;
    }
    .footer-social {
        justify-content: center; /* S'assurer que les icônes sont centrées */
    }
}