/* =========================================================
   FREE WEBP IMAGE OPTIMIZER — STYLES PARTAGÉS
   Auteur : Maison Artichaut
   Utilisé par toutes les pages et toutes les langues.
   ========================================================= */

/* === 1. VARIABLES ET STYLES DE BASE === */
*, *::before, *::after { box-sizing: border-box; }
:root {
    --primary: #2ecc71;
    --accent: #3498db;
    --bg: #0f1113;
    --card: #1c1f22;
    --text: #e0e0e0;
    --input-bg: #2a2e33;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* === 2. CONTENEUR PRINCIPAL DE L'APP === */
.app-container {
    width: 95%; max-width: 430px;
    background: var(--card);
    padding: 14px; border-radius: 22px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
    margin: 12px 0;
}

/* === ÉCRAN D'ACCUEIL === */
.home-intro {
    display: flex; flex-direction: column; align-items: center;
    gap: 10px; margin-bottom: 14px; text-align: center;
}
.home-logo {
    width: 78px; height: 78px; border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 30px rgba(46, 204, 113, 0.15);
}
.home-title {
    font-size: 1.05rem; font-weight: 800; color: #fff;
    margin: 0; letter-spacing: -0.2px;
}
.home-title span { color: var(--primary); }
.home-tagline {
    font-size: 0.82rem; color: #888; margin: 0;
    line-height: 1.4; padding: 0 4px; max-width: 320px;
}

/* === 3. ZONE DE GLISSER-DÉPOSER === */
.upload-zone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 2px dashed #3d4248; border-radius: 14px;
    padding: 30px 16px; text-align: center; gap: 6px;
    cursor: pointer; transition: all 0.2s ease; background: rgba(255,255,255,0.02);
    font-size: 0.9rem;
}
.upload-zone.dragover { border-color: var(--primary); background: rgba(46, 204, 113, 0.1); }

/* === 4. ÉDITEUR ET PRÉVISUALISATION === */
.editor-wrapper { width: 100%; height: 210px; background: #000; border-radius: 12px; overflow: hidden; display: none; margin-bottom: 10px; }
.live-preview-container { text-align: center; margin-bottom: 10px; display: none; width: 100%; }
.live-preview-container label { font-size: 0.6rem; color: var(--primary); font-weight: 800; text-transform: uppercase; margin-bottom: 5px; display: block; letter-spacing: 0.5px; }

.preview-box {
    width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid #3d4248;
    background-color: #1a1a1a;
    background-image: linear-gradient(45deg, #222 25%, transparent 25%), linear-gradient(-45deg, #222 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #222 75%), linear-gradient(-45deg, transparent 75%, #222 75%);
    background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}
#livePreviewImg { width: 100%; height: auto; display: block; }

/* === 5. RÉGLAGES ET BOUTONS === */
.settings { display: none; grid-template-columns: 1fr 1fr; gap: 7px; }
.input-group { display: flex; flex-direction: column; gap: 2px; }
label.field-label { font-size: 0.6rem; color: #888; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }

input[type="number"], input[type="text"] { width: 100%; background: var(--input-bg); border: 1px solid #3d4248; padding: 8px 10px; border-radius: 9px; color: white; font-size: 0.85rem; outline: none; }
.full-width { grid-column: span 2; }

.compression-header { display: flex; justify-content: space-between; align-items: center; }
.compression-value { color: var(--primary); font-weight: bold; font-size: 0.78rem; }
input[type="range"] { width: 100%; accent-color: var(--primary); margin: 3px 0; height: 18px; }

.toggle-group { display: flex; justify-content: space-between; align-items: center; background: var(--input-bg); padding: 7px 12px; border-radius: 9px; }
.toggle-group > label { font-size: 0.8rem !important; font-weight: 600; }
.actions-grid { display: none; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }

/* === RETOUCHES D'IMAGE === */
.adjust-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.adjust-label-wrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.adjust-value { color: var(--primary); font-weight: bold; font-size: 0.78rem; min-width: 30px; text-align: right; }
.adjust-section-title { font-size: 0.6rem; color: #555; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: space-between; align-items: center; }
.reset-adjust { background: transparent; border: none; color: #555; font-size: 0.65rem; cursor: pointer; text-decoration: underline; padding: 0; }
.reset-adjust:hover { color: var(--primary); }

/* Toggle "Avancé" pour la luminosité */
.advanced-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.6rem; color: #888; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.3px;
    cursor: pointer; user-select: none;
}
.advanced-toggle input { display: none; }
.advanced-toggle .switch {
    width: 26px; height: 14px; background: #3d4248; border-radius: 8px;
    position: relative; transition: background 0.2s;
}
.advanced-toggle .switch::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 10px; height: 10px; background: #888; border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.advanced-toggle input:checked + .switch { background: rgba(46, 204, 113, 0.3); }
.advanced-toggle input:checked + .switch::after { transform: translateX(12px); background: var(--primary); }
.advanced-toggle:has(input:checked) { color: var(--primary); }

.brightness-advanced { display: none; flex-direction: column; gap: 4px; margin-top: 2px;
    padding: 8px 10px; background: rgba(255,255,255,0.02); border-radius: 9px; border: 1px solid rgba(255,255,255,0.04); }
.brightness-advanced.show { display: flex; }
.brightness-advanced .sub-row { display: flex; justify-content: space-between; align-items: center; }
.brightness-advanced .sub-label { font-size: 0.7rem; color: #aaa; font-weight: 600; }
.brightness-advanced input[type="range"] { margin: 1px 0 4px; }
.brightness-advanced .sub-block:last-child input[type="range"] { margin-bottom: 0; }

#resetBtn { display: none; width: 100%; background: transparent; border: 1px solid #3d4248; color: #888; margin-top: 8px; padding: 8px; border-radius: 9px; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: 0.2s; }
#resetBtn:hover { border-color: var(--primary); color: var(--primary); }

button.main-btn { background: linear-gradient(135deg, var(--primary), #27ae60); color: white; border: none; padding: 13px; border-radius: 12px; font-size: 0.95rem; font-weight: 700; cursor: pointer; }
#shareBtn { background: var(--input-bg); border: 1px solid #3d4248; width: 52px; display: flex; align-items: center; justify-content: center; color: white; border-radius: 12px; cursor: pointer;}
#imageInput { display: none; }

/* === 6. MODALE INTERSTITIELLE === */
.ad-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 17, 19, 0.95); backdrop-filter: blur(5px); z-index: 9999;
    justify-content: center; align-items: center; flex-direction: column; padding: 20px;
}
.ad-container { width: 300px; height: 250px; background: #1c1f22; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #888; font-size: 0.8rem; margin-bottom: 15px; position: relative; overflow: hidden; }
.ad-container iframe { border: 0; display: block; }
.aff-container { width: 100%; max-width: 336px; background: linear-gradient(135deg, #8e44ad, #9b59b6); border-radius: 16px; padding: 20px; text-align: center; text-decoration: none; box-shadow: 0 10px 20px rgba(142, 68, 173, 0.2); margin-bottom: 30px; transition: transform 0.2s ease; display: block; cursor: pointer;}
.aff-container:hover { transform: scale(1.02); }
#closeAdAndDownload { width: 100%; max-width: 336px; background: var(--input-bg); border: 2px solid #3d4248; color: white; padding: 18px; border-radius: 16px; font-size: 0.9rem; font-weight: 700; cursor: pointer; transition: 0.2s; }
#closeAdAndDownload:hover { border-color: var(--primary); color: var(--primary); }

/* === 7. FOOTER COMMUN (Navigation + langues) === */
.site-footer {
    width: 95%; max-width: 430px;
    margin: 0 auto 20px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.page-nav {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 6px;
    width: 100%;
}
.page-nav a {
    background: var(--card);
    color: #cfd2d6;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.06);
    transition: 0.2s;
}
.page-nav a:hover, .page-nav a.active {
    color: var(--primary);
    border-color: var(--primary);
}
.lang-switcher {
    display: flex; align-items: center; gap: 8px;
    background: var(--card);
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
}
.lang-switcher label {
    font-size: 0.7rem; color: #888;
    text-transform: uppercase; letter-spacing: 0.3px;
    font-weight: 700;
}
.lang-switcher select {
    background: var(--input-bg);
    color: #fff;
    border: 1px solid #3d4248;
    border-radius: 7px;
    padding: 5px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
}
.footer-marketing { text-align: center; font-size: 0.72rem; color: #555; padding-bottom: 12px; }
.footer-marketing a { color: #888; text-decoration: none; font-weight: 600; margin: 0 8px; }

/* === 8. PAGES DE CONTENU SEO === */
.content-wrapper {
    width: 95%; max-width: 760px;
    margin: 12px auto 16px;
    color: var(--text);
    line-height: 1.65;
    font-size: 0.92rem;
}
.content-header {
    text-align: center;
    margin-bottom: 18px;
}
.content-header a.back-home {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--primary); text-decoration: none;
    font-size: 0.82rem; font-weight: 600;
}
.content-header a.back-home:hover { text-decoration: underline; }
.content-header h1 {
    font-size: 1.6rem; color: #fff;
    margin: 14px 0 6px; letter-spacing: -0.4px;
    font-weight: 800;
}
.content-header .lead {
    color: #888; font-size: 0.92rem; margin: 0;
    max-width: 540px; margin-left: auto; margin-right: auto;
}
.content-section {
    background: var(--card);
    padding: 22px 20px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 16px;
}
.content-section h2 {
    font-size: 1.2rem;
    color: #fff;
    margin: 0 0 14px;
    letter-spacing: -0.2px;
    border-bottom: 1px solid rgba(46, 204, 113, 0.25);
    padding-bottom: 8px;
}
.content-section h3 {
    font-size: 1rem;
    color: var(--primary);
    margin: 18px 0 8px;
    font-weight: 700;
}
.content-section p { margin: 0 0 12px; color: #cfd2d6; }
.content-section ul { padding-left: 18px; margin: 0 0 12px; }
.content-section li { margin-bottom: 7px; color: #cfd2d6; }
.content-section strong { color: #fff; font-weight: 700; }
.content-section a { color: var(--accent); text-decoration: none; }
.content-section a:hover { text-decoration: underline; }

/* Tableau comparatif */
.compare-table-wrap { overflow-x: auto; margin: 10px 0 6px; -webkit-overflow-scrolling: touch; }
.compare-table {
    width: 100%; border-collapse: collapse;
    background: rgba(255,255,255,0.02);
    border-radius: 10px; overflow: hidden;
    font-size: 0.82rem;
    min-width: 520px;
}
.compare-table th, .compare-table td {
    padding: 10px 12px; text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.compare-table thead th {
    background: rgba(46, 204, 113, 0.08);
    color: #fff; font-weight: 700; font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.4px;
}
.compare-table tbody th {
    color: #aaa; font-weight: 600; background: rgba(0,0,0,0.15);
}
.compare-table tbody tr:last-child td,
.compare-table tbody tr:last-child th { border-bottom: none; }
.compare-table td.highlight { color: var(--primary); font-weight: 600; }

/* FAQ details/summary */
.faq-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 0;
    margin-bottom: 8px;
    overflow: hidden;
}
.faq-item summary {
    cursor: pointer; list-style: none;
    padding: 12px 14px;
    font-weight: 600; color: #fff;
    font-size: 0.92rem;
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+'; color: var(--primary); font-size: 1.3rem;
    font-weight: 700; line-height: 1; transition: transform 0.2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-answer {
    padding: 0 14px 14px;
    color: #cfd2d6; font-size: 0.88rem;
}

/* Notes légales / RGPD */
.legal-note {
    font-size: 0.85rem; color: #aaa;
    padding: 12px 14px;
    background: rgba(0,0,0,0.2);
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    margin-bottom: 10px;
}
.legal-note strong { color: #fff; }

/* === HEIGHT CROP (rognage hauteur : boutons verticaux + curseur d'ancre) === */
.height-crop-panel { display: block; }
.anchor-control { display: flex; gap: 12px; margin-top: 4px; align-items: stretch; }
.anchor-buttons { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.anchor-buttons button {
    background: var(--input-bg);
    border: 1px solid #3d4248;
    border-radius: 8px;
    padding: 9px 4px;
    cursor: pointer;
    color: #aaa;
    font-size: 0.72rem;
    font-weight: 700;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.anchor-buttons button:hover { border-color: #5a6068; color: #fff; }
.anchor-buttons button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.anchor-slider-wrap {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: var(--input-bg); border: 1px solid #3d4248;
    border-radius: 8px; padding: 10px 8px; flex-shrink: 0;
}
.anchor-slider-wrap input[type="range"] {
    writing-mode: vertical-lr;     /* curseur vertical : 0% en haut, 100% en bas */
    width: 16px; flex: 1; min-height: 70px;
    margin: 0; accent-color: var(--primary); cursor: pointer;
}
.anchor-slider-val { font-size: 0.62rem; color: var(--primary); font-weight: 700; }

/* === BANDEAU D'ALERTE (téléchargement bloqué par un bloqueur de pub) === */
.site-notice {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #2a1518;
    color: #ffdede;
    border-top: 2px solid #e74c3c;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 -6px 22px rgba(0,0,0,0.55);
    animation: site-notice-in 0.25s ease-out;
}
@keyframes site-notice-in {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.site-notice svg { color: #e74c3c; flex: 0 0 auto; }
.site-notice__text { flex: 1 1 auto; }
.site-notice__close {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    color: #ffdede;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
}
.site-notice__close:hover { color: #fff; }
