/* 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: #1565C0;
    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; }
.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;
    }
}
