* { box-sizing: border-box; }
/* l'attribut hidden doit l'emporter sur les display:flex/grid des vues que app.js permute */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
    font-family: Roboto, -apple-system, "Segoe UI", Arial, sans-serif;
    margin: 0; padding: 8px 16px;
    background: #f7f7f8; color: #1a1a1a;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.app-header {
    flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid #e5e7eb;
}
.app-header-titles { min-width: 0; }
.app-header h1 { font-size: 1.1rem; margin: 0; }
.app-sub { color: #666; font-size: 0.75rem; margin: 2px 0 0; }
.app-header-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; flex-wrap: wrap; }
/* en-tête uniformisée avec les autres services Gnet (transcription/videos/mon-compte/protectis/
   geneatique-net/toponymes) : retour à l'espace services + prénom du compte + déconnexion, groupés
   à droite du titre. */
.back-link, .account-name { color: #64748b; text-decoration: none; font-size: .9em; }
.back-link:hover { color: #4fa066; }
.logout-link { color: #64748b; text-decoration: none; font-size: .9em; }
.logout-link:hover { color: #4fa066; }
.account-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid #cbd5e1;
                border-radius: 6px; color: #64748b; text-decoration: none; font-size: .8em; font-weight: 600; }
.account-btn:hover { background: #f1f5f9; color: #4fa066; border-color: #4fa066; }
/* choix de la langue d'interface (cf. inc/i18n.php::gnet_rendreSelecteurLangue) - meme gabarit visuel que .account-btn */
.lang-select { padding: 4px 6px; border: 1px solid #cbd5e1; border-radius: 6px; color: #64748b;
               font-size: .8em; font-weight: 600; background: #fff; cursor: pointer; }
.lang-select:hover { border-color: #4fa066; color: #4fa066; }
.gnet-footer { flex-shrink: 0; background: #fff; border-top: 1px solid #e5e7eb; padding: 6px 16px;
               margin: 8px -16px -8px; display: flex; justify-content: space-between; align-items: center; font-size: .75em; }
.gnet-footer .gnet-footer-brand { color: #4fa066; font-weight: 700; }
.gnet-footer .gnet-footer-version { color: #000; }
.panel-toggle-btn {
    border: 1px solid #ccc; border-radius: 6px; background: #fff; color: #333;
    font-size: 0.78rem; font-weight: 600; padding: 5px 10px; cursor: pointer; white-space: nowrap;
}
.panel-toggle-btn:hover { background: #f3f4f6; }
.panel-toggle-btn.is-collapsed { background: #eff6ff; border-color: #93c5fd; color: #1e3a8a; }

/* panneau lateral "Mes photos" : quand replie (manuellement via le bouton de l'entete, ou
   automatiquement des qu'une analyse est en cours d'affichage), entierement retire du flux
   (display:none) pour ne laisser aucun espace mort - on le rouvre via son bouton, toujours visible
   dans l'entete. */
.layout {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 20px;
    align-items: stretch;
}
.panel-history { width: 280px; flex-shrink: 0; }
.layout.history-collapsed .panel-history { display: none; }
@media (max-width: 1000px) {
    body { overflow: auto; height: auto; }
    .layout { height: auto; flex-direction: column; }
    .panel-history { width: 100%; }
    .panel { height: auto !important; }
}

.panel {
    background: #fff; border: 1px solid #ddd; border-radius: 8px;
    padding: 14px; height: 100%; min-height: 0;
}
.panel h2 { font-size: 0.95rem; margin: 0 0 10px; }

.panel-history { overflow-y: auto; }

label { display: block; margin-top: 10px; font-weight: 600; font-size: 0.82rem; }
textarea {
    width: 100%; padding: 6px 8px; margin-top: 4px;
    border: 1px solid #ccc; border-radius: 4px; font-family: inherit; font-size: 0.85rem;
    resize: vertical;
}

.dropzone {
    margin-top: 0; margin-bottom: 16px; border: 2px dashed #93c5fd; border-radius: 8px;
    padding: 24px 12px; text-align: center; cursor: pointer;
    background: #eff6ff; color: #1e3a8a; transition: background 0.15s, border-color 0.15s;
}
.dropzone:hover, .dropzone.dragover { background: #e6f4ea; border-color: #4fa066; }
.dropzone-icon { font-size: 2rem; }
.dropzone p { margin: 6px 0 0; font-size: 0.85rem; }
.dropzone-hint { color: #6b7280; font-size: 0.72rem !important; }

.progress-block { margin-top: 16px; }
.progress-label { font-size: 0.8rem; color: #333; margin: 0 0 4px; font-weight: 600; }
.progress-bar { height: 8px; border-radius: 4px; background: #e5e7eb; overflow: hidden; position: relative; }
.progress-fill { height: 100%; background: #4fa066; width: 0%; transition: width 0.2s; }
.progress-bar.indeterminate .progress-fill {
    width: 40% !important; position: absolute;
    animation: indeterminate 1.1s infinite linear;
}
@keyframes indeterminate {
    0% { left: -40%; }
    100% { left: 100%; }
}

.error-msg { color: #b91c1c; font-size: 0.82rem; font-weight: 600; margin-top: 12px; }

.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-empty { color: #888; font-size: 0.82rem; }
.history-item {
    display: flex; align-items: center; gap: 2px;
    border: 1px solid #eee; border-radius: 6px;
    background: #fff; width: 100%;
}
.history-item:hover { border-color: #93c5fd; }
.history-item-open {
    display: flex; gap: 8px; align-items: center; padding: 6px;
    border: none; border-radius: 6px 0 0 6px; cursor: pointer; text-align: left;
    background: none; font: inherit; color: inherit; flex: 1; min-width: 0;
}
.history-item-open:hover { background: #f0f4ff; }
.history-item-delete {
    flex-shrink: 0; width: 26px; height: 26px; margin-right: 6px;
    border: none; border-radius: 4px; background: none; color: #999;
    cursor: pointer; font-size: 0.8rem;
}
.history-item-delete:hover { background: #fee2e2; color: #b91c1c; }
.history-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.history-item-info { min-width: 0; }
.history-item-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item-meta { font-size: 0.72rem; color: #777; }
.history-item-status { font-size: 0.68rem; padding: 1px 6px; border-radius: 10px; display: inline-block; margin-top: 2px; }
.status-termine { background: #dcfce7; color: #166534; }
.status-termine_avec_erreurs { background: #ffedd5; color: #9a3412; }
.status-erreur_analyse { background: #fee2e2; color: #991b1b; }

.btn-primary, .btn-secondary {
    border-radius: 6px; padding: 7px 14px; font-size: 0.82rem; font-weight: 600;
    cursor: pointer; border: 1px solid transparent; white-space: nowrap;
}
.btn-primary { background: #4fa066; color: #fff; }
.btn-primary:hover { background: #3d8552; }
.btn-primary:disabled { background: #93c5fd; cursor: default; }
.btn-secondary { background: #fff; border-color: #ccc; color: #333; }
.btn-secondary:hover { background: #f3f4f6; }
.btn-secondary:disabled { color: #aaa; cursor: default; }

.panel-result { display: flex; flex-direction: column; overflow: hidden; flex: 1 1 auto; min-width: 0; }
/* bandeau de l'analyse d'exemple (visiteur non connecte, cf. #demoBanniere dans index.php) : teinte ambre,
   volontairement differente du vert du service et du rouge des erreurs - c'est un avertissement, pas un
   resultat ni une panne. flex-shrink:0 parce que .panel-result est une colonne flex : sans cela le bandeau
   serait comprime (voire reduit a un trait) par la zone de resultat qui occupe toute la hauteur. */
.demo-banner { flex-shrink: 0; margin: 0 0 8px; padding: 8px 12px; border-radius: 6px;
    border: 1px solid #fcd34d; background: #fffbeb; color: #92400e;
    font-size: 0.82rem; font-weight: 600; line-height: 1.4; }
.result-toolbar { flex-shrink: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.result-toolbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.credits-info { font-size: 0.78rem; color: #555; }
/* solde + credits consommes par la derniere analyse : mis en avant (demande explicite du service),
   contrairement a .credits-info (discret, juste informatif dans le panneau lateral). */
.credits-consumed { font-size: 0.8rem; color: #166534; font-weight: 600; background: #dcfce7;
    border-radius: 6px; padding: 4px 10px; }

/* zone resultat : photo (gauche, 1/2) + description par themes (droite, 1/2) toujours cote a cote,
   meme hauteur, chacune avec son propre defilement interne. */
.edit-area { flex: 1; min-height: 0; display: flex; flex-direction: row; gap: 12px; overflow: hidden; }
.image-col { position: relative; flex: 1 1 50%; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.text-col { flex: 1 1 50%; min-width: 0; min-height: 0; overflow-y: auto; }

@media (max-width: 1000px) {
    .edit-area { flex-direction: column; }
    .image-col { flex: 0 0 auto; }
}

.image-wrap {
    flex: 1; min-height: 0; overflow: auto;
    border: 1px solid #eee; border-radius: 6px; margin-bottom: 10px; background: #fafafa;
    display: flex; align-items: center; justify-content: center;
}
#photoImg { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; }
.image-col textarea#contexte { flex-shrink: 0; margin-bottom: 0; }

.resume-text {
    font-size: 0.88rem; font-style: italic; color: #334155; margin: 0 0 14px;
    padding: 10px 12px; background: #f9fafb; border: 1px solid #eee; border-radius: 6px;
}

.themes-list { display: flex; flex-direction: column; gap: 10px; }
.theme-card { border: 1px solid #ddd; border-radius: 8px; padding: 10px 12px; }
.theme-card-title { font-size: 0.85rem; font-weight: 700; color: #3d8552; margin: 0 0 6px; }
.theme-card-text { font-size: 0.85rem; color: #1a1a1a; margin: 0; white-space: pre-wrap; }
.theme-card.theme-erreur { border-color: #fecaca; background: #fef2f2; }
.theme-card.theme-erreur .theme-card-title { color: #991b1b; }

/* --- retouche / colorisation (02/10/2026) ---------------------------------------------------------------
   Le panneau de resultat porte desormais le choix du traitement au-dessus du resultat : il defile au lieu de
   comprimer son contenu, et la zone d'analyse garde une hauteur utile. */
.panel-result { overflow-y: auto; }
.edit-area { min-height: 420px; }
.history-note { font-size: 0.72rem; color: #777; margin: -6px 0 8px; }
/* un nom de fichier long ne doit jamais elargir le panneau (barre de defilement horizontale) : il est
   tronque avec des points de suspension */
.panel-history { overflow-x: hidden; }
.history-item-info { flex: 1; }
.history-item-name { display: block; }
.status-retouche, .status-colorisation { background: #e0e7ff; color: #3730a3; }
.status-analyse { background: #dcfce7; color: #166534; }

.mode-picker { flex-shrink: 0; border: none; margin: 0 0 10px; padding: 0;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mode-picker legend { font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; padding: 0; }
.mode-card { margin: 0; font-weight: normal; position: relative; cursor: pointer;
    border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px 8px 32px; background: #fff; }
.mode-card input { position: absolute; left: 10px; top: 10px; margin: 0; }
.mode-card:hover { border-color: #93c5fd; }
.mode-card:has(input:checked) { border-color: #4fa066; background: #f0faf3; box-shadow: 0 0 0 1px #4fa066 inset; }
.mode-card-titre { display: block; font-weight: 700; font-size: 0.86rem; }
.mode-card-desc { display: block; font-size: 0.75rem; color: #555; margin-top: 2px; line-height: 1.35; }
@media (max-width: 700px) { .mode-picker { grid-template-columns: 1fr; } }

.options-retouche { flex-shrink: 0; margin-bottom: 8px; }
.options-titre { font-weight: 700; font-size: 0.82rem; margin: 0 0 6px; }
.tailles { display: flex; gap: 8px; flex-wrap: wrap; }
.taille-choix { margin: 0; font-weight: normal; cursor: pointer; display: flex; flex-direction: column;
    border: 1px solid #ddd; border-radius: 8px; padding: 6px 10px; min-width: 130px; position: relative; padding-left: 30px; }
.taille-choix input { position: absolute; left: 9px; top: 9px; margin: 0; }
.taille-choix:has(input:checked) { border-color: #4fa066; background: #f0faf3; }
.taille-nom { font-weight: 700; font-size: 0.85rem; }
.taille-desc { font-size: 0.72rem; color: #555; }
.taille-prix { font-size: 0.75rem; color: #3d8552; font-weight: 700; margin-top: 2px; }
.option-coloriser { font-weight: 600; font-size: 0.82rem; margin-top: 8px; cursor: pointer; }
.option-coloriser input { margin-right: 6px; }
/* rendu fidele / ameliore : meme gabarit que les tailles */
.options-rendu-titre { margin-top: 10px; }
.rendus { display: flex; gap: 8px; flex-wrap: wrap; }
.rendu-choix { margin: 0; font-weight: normal; cursor: pointer; display: flex; flex-direction: column;
    border: 1px solid #ddd; border-radius: 8px; padding: 6px 10px 6px 30px; position: relative; flex: 1 1 260px; max-width: 420px; }
.rendu-choix input { position: absolute; left: 9px; top: 9px; margin: 0; }
.rendu-choix:has(input:checked) { border-color: #4fa066; background: #f0faf3; }

/* le prix annonce AVANT de lancer : mis en avant, c'est lui qui engage le client */
.prix-info { flex-shrink: 0; font-size: 0.82rem; color: #1e3a8a; background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: 6px; padding: 6px 10px; margin: 0 0 8px; line-height: 1.4; }

/* curseur avant / apres : deux images de 400 px au plus, superposees. L'original (.comparateur-avant) est
   rogne a gauche du trait par clip-path ; le range invisible couvre toute l'image pour glisser n'importe ou. */
.vue-comparaison { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.comparateur { --pos: 50%; position: relative; display: inline-block; max-width: 100%; line-height: 0;
    border-radius: 6px; overflow: hidden; border: 1px solid #ddd; background: #fafafa; user-select: none; }
.comparateur-img { display: block; max-width: 100%; max-height: 400px; width: auto; height: auto; }
.comparateur-avant { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none;
    clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.comparateur-ligne { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px;
    background: #fff; box-shadow: 0 0 3px rgba(0,0,0,.6); pointer-events: none; }
.comparateur-poignee { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 30px; height: 30px; border-radius: 50%; background: #fff; color: #333; font-size: 16px;
    line-height: 30px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.comparateur-etiquette { position: absolute; top: 6px; font-size: 0.7rem; line-height: 1; font-weight: 700;
    color: #fff; background: rgba(0,0,0,.55); padding: 3px 6px; border-radius: 4px; pointer-events: none; }
.etiquette-avant { left: 6px; }
.etiquette-apres { right: 6px; }
.comparateur-curseur { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.traitement-info { font-size: 0.8rem; color: #444; margin: 0; text-align: center; }
.telechargements { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* photo trop petite ou trop floue pour la taille choisie : avertissement (ambre), pas une erreur */
.alerte-qualite { flex-shrink: 0; margin: 0 0 8px; padding: 6px 10px; border-radius: 6px;
    border: 1px solid #fcd34d; background: #fffbeb; color: #92400e; font-size: 0.82rem; line-height: 1.4; }

/* envoi par mail : formulaire sous les boutons de telechargement */
.form-mail { width: 100%; max-width: 560px; border: 1px solid #ddd; border-radius: 8px; padding: 10px 14px;
    background: #fafafa; text-align: left; }
.form-mail-titre { font-weight: 700; font-size: 0.88rem; margin: 0 0 4px; }
.form-mail input[type="email"], .form-mail input[type="text"] { width: 100%; padding: 6px 8px; margin-top: 4px;
    border: 1px solid #ccc; border-radius: 4px; font-family: inherit; font-size: 0.85rem; }
.mail-quoi { border: none; margin: 10px 0 0; padding: 0; }
.mail-quoi legend { font-weight: 600; font-size: 0.82rem; padding: 0; }
.mail-quoi label { font-weight: normal; margin-top: 4px; cursor: pointer; }
.mail-cout { font-size: 0.78rem; color: #1e3a8a; background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: 6px; padding: 6px 10px; margin: 10px 0 0; line-height: 1.4; }
.form-mail-actions { display: flex; gap: 8px; margin-top: 10px; }
.mail-resultat { font-size: 0.82rem; font-weight: 600; margin: 10px 0 0; }
.mail-ok { color: #166534; }
.mail-erreur { color: #b91c1c; }

.vue-source { flex-shrink: 0; display: flex; justify-content: center; }
.vue-source img { display: block; max-width: 100%; max-height: 400px; border: 1px solid #eee; border-radius: 6px; }
