/* BuilderTracker — app-level styles */

/* Reconnect overlay */
#components-reconnect-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}
#components-reconnect-modal.components-reconnect-show { display: flex; }
.bt-reconnect-card {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-width: 280px;
}
.bt-spinner {
    width: 40px; height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #EA6A1F;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile touch targets */
/* Le rond d'un MudSwitch est lui aussi un .mud-button-root : sans cette exclusion il est poussé sous sa glissière */
.mud-button-root:not(.mud-switch-base) { min-height: 44px; }
.mud-fab { min-width: 56px; min-height: 56px; }

/* Clickable cards — hover lift effect */
.card-clickable {
    cursor: pointer;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.card-clickable:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.18) !important;
    transform: translateY(-2px);
}

/* Signature canvas */
.signature-canvas {
    border: 2px dashed #9e9e9e;
    border-radius: 4px;
    touch-action: none;
    width: 100%;
    max-height: 200px;
    display: block;
}

/* Page offre : en-tête fixe (client / boutons + totaux à droite, sous les boutons sur mobile) et colonne d'articles réglable */
/* Barre d'application dense : hauteur = --mud-appbar-height moins un quart (48 px) */
.offre-entete { position: sticky; top: calc(var(--mud-appbar-height) - var(--mud-appbar-height) / 4); z-index: 5; background: var(--mud-palette-background); margin: -8px -8px 12px; padding: 8px; border-bottom: 1px solid var(--mud-palette-divider); }
.offre-entete-ligne { display: flex; gap: 16px; align-items: flex-start; }
.offre-totaux { width: 300px; flex-shrink: 0; }
/* Résultat de recherche d'article : caractéristiques du produit en liste compacte */
.article-resultat-caracteristiques { margin: 2px 0 4px 16px; padding: 0; font-size: 0.75rem; line-height: 1.35; color: var(--mud-palette-text-secondary); }
.offre-colonne-articles { width: 380px; min-width: 260px; max-width: 60vw; flex-shrink: 0; position: sticky; resize: horizontal; overflow: auto; padding-bottom: 4px; }
@media (max-width: 959px) {
    .offre-entete { position: static; } /* trop haut pour rester fixe sur un téléphone */
    .offre-entete-ligne { flex-direction: column; }
    .offre-totaux { width: 100%; }
    .offre-colonne-articles { width: 100%; max-width: none; position: static; resize: none; }
}
@media (max-width: 599px) {
    .offre-colonne-articles { display: none; } /* téléphone : recherche d'article en dialogue (offre et facture) */
}

/* Ligne d'article d'une position (offre / facture) : le libellé prend toute la place restante, les champs qté / prix / rabais
   restent sur une seule ligne et ne rétrécissent pas ; sur mobile les champs passent sous le libellé */
.offre-position-entete { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.offre-position-actions { display: contents; } /* desktop : boutons en ligne avec le libellé et le total */
.offre-ligne { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.offre-ligne-libelle { flex: 1 1 200px; min-width: 200px; }
.offre-ligne > .mud-input-control { flex: 0 0 auto; }
.offre-ligne .mud-input-control-input-container .mud-input.mud-input-outlined .mud-input-slot { padding-left: 8px; padding-right: 6px; }
@media (max-width: 599px) {
    /* Téléphone : libellé puis qté, prix et rabais chacun sur sa propre ligne, pleine largeur (les largeurs inline sont écrasées) */
    .offre-ligne-libelle { flex-basis: 100%; }
    .offre-ligne > .mud-input-control { flex: 0 0 100%; width: 100% !important; }
    .offre-ligne > .mud-input-control .mud-input { width: 100% !important; } /* MudBlazor reporte aussi le Style inline sur .mud-input */
    /* En-tête de position : les actions (monter, descendre, modifier, supprimer) passent sous le libellé et le total, réparties sur la largeur */
    .offre-position-actions { display: flex; flex-basis: 100%; justify-content: space-evenly; border-top: 1px solid var(--mud-palette-divider); margin-top: 4px; padding-top: 2px; }
    /* … puis œil (rabais visible / intégré), total et suppression sur une rangée en trois colonnes égales, contenu centré */
    .offre-ligne > .mud-tooltip-root, .offre-ligne > .mud-typography, .offre-ligne > .mud-icon-button {
        flex: 1 1 0; width: auto !important; display: flex; justify-content: center; text-align: center !important;
    }
}

/* Maintenance à modules : un point de contrôle = libellé + statut (R / RG / D / NR / NA) + valeur, remarque dessous ; empilé sur téléphone */
.point-controle { display: grid; grid-template-columns: minmax(200px, 1fr) auto; gap: 4px 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--mud-palette-divider); }
.point-controle-saisie { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.point-controle-remarque { grid-column: 1 / -1; }
@media (max-width: 599.98px) {
    .point-controle { grid-template-columns: 1fr; }
    .point-controle-saisie { justify-content: flex-start; }
}

/* Ligne d'offre / de facture qui vient d'être ajoutée : 4 clignotements orange ; amenée vers le milieu de l'écran (sous l'en-tête fixe) */
.ligne-nouvelle { animation: ligne-nouvelle 0.6s ease-in-out 4; border-radius: 4px; scroll-margin-top: 40vh; scroll-margin-bottom: 20vh; }
@keyframes ligne-nouvelle {
    0%, 100% { background-color: transparent; box-shadow: none; }
    50% { background-color: rgba(234, 106, 31, 0.22); box-shadow: 0 0 0 2px #EA6A1F; }
}
@media (prefers-reduced-motion: reduce) {
    .ligne-nouvelle { animation: none; background-color: rgba(234, 106, 31, 0.15); box-shadow: 0 0 0 2px #EA6A1F; }
}

/* Zone de dépôt / d'ajout d'article (offre, facture) : orange, « + » bien visible */
.zone-depot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; padding: 12px; border: 2px dashed #EA6A1F; border-radius: 6px;
              background: rgba(234, 106, 31, 0.06); color: #EA6A1F; font-weight: 600; cursor: pointer; transition: background-color 0.15s; }
.zone-depot:hover { background: rgba(234, 106, 31, 0.14); }

/* Zone de dépôt de fichiers (DocumentsPanel) : input fichier transparent posé sur toute la zone */
.depot-fichiers-input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; }
