/* public/css/mobile.css */

/* Structure de base */
body { font-family: Arial, sans-serif; background-color: #f3f4f6; margin: 0; padding: 0; display: flex; flex-direction: column; min-height: 100vh; }
.header { background-color: #1e3a8a; color: white; padding: 1.5rem 1rem; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.header h1 { margin: 0; font-size: 1.5rem; }
.header p { margin: 5px 0 0 0; font-size: 0.9rem; opacity: 0.8; }
.container { flex: 1; padding: 1rem; display: flex; flex-direction: column; justify-content: center; align-items: center; }

/* Dashboard (Grille et Boutons) — responsive mobile-first : la même
   grille fluide s'élargit avec l'écran, toujours centrée. Base (mobile) :
   2 tuiles par ligne ; dès 768px : 3 ; dès 1024px : 4. Les max-width
   gardent des tuiles de taille comparable (~235px) à chaque palier. */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; width: 100%; max-width: 500px; margin: 0 auto; }
@media (min-width: 768px) {
    .dashboard-grid { grid-template-columns: repeat(3, 1fr); max-width: 768px; }
}
@media (min-width: 1024px) {
    .dashboard-grid { grid-template-columns: repeat(4, 1fr); max-width: 1024px; }
}
.btn-dashboard { background-color: white; border-radius: 15px; padding: 2rem 1rem; text-align: center; text-decoration: none; color: #333; box-shadow: 0 4px 6px rgba(0,0,0,0.05); transition: transform 0.1s; display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 1 / 1; }
.btn-dashboard:active { transform: scale(0.95); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.btn-dashboard .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.btn-dashboard .btn-title { font-weight: bold; font-size: 1.1rem; }
.logout-form { margin-top: 2rem; text-align: center; width: 100%; }
.btn-logout { background: none; border: none; color: #dc2626; font-size: 1rem; font-weight: bold; text-decoration: underline; cursor: pointer; padding: 10px; }

/* Formulaires (pour tes vues de connexion) */
.login-card { background: white; padding: 2rem; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; max-width: 400px; box-sizing: border-box; }
.login-card h2 { text-align: center; color: #333; font-size: 1.3rem; margin-top: 0; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1rem; width: 100%; }
label { display: block; margin-bottom: 0.5rem; color: #666; font-size: 0.9rem; }
input[type="email"], input[type="password"], input[type="text"] { width: 100%; padding: 0.75rem; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; font-size: 1rem; }
input[readonly] { background-color: #e5e7eb; color: #6b7280; outline: none; }
.btn-primary { width: 100%; padding: 0.75rem; background-color: #2563eb; color: white; border: none; border-radius: 5px; font-size: 1rem; cursor: pointer; margin-top: 1rem; }
.error { color: #dc2626; font-size: 0.85rem; margin-bottom: 1rem; text-align: center; }
.status { color: #15803d; font-size: 0.9rem; margin-bottom: 1rem; text-align: center; padding: 10px; background: #dcfce7; border-radius: 5px; }
.link-center { display: block; text-align: center; margin-top: 1rem; color: #2563eb; text-decoration: none; font-size: 0.9rem; }


/* Barre de recherche et Liste */
.search-bar { width: 100%; padding: 1rem; border: 1px solid #ccc; border-radius: 10px; font-size: 1rem; margin-bottom: 1.5rem; box-sizing: border-box; }
.list-container { width: 100%; max-width: 500px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.8rem; }
.list-item { background: white; padding: 1rem; border-radius: 10px; text-decoration: none; color: #333; box-shadow: 0 2px 4px rgba(0,0,0,0.05); display: flex; align-items: center; justify-content: space-between; }
.list-item:active { background: #f9fafb; transform: scale(0.98); }
.item-info { display: flex; flex-direction: column; }
.item-name { font-weight: bold; font-size: 1.1rem; margin-bottom: 0.2rem; }
.item-city { color: #666; font-size: 0.9rem; }
.item-arrow { color: #2563eb; font-weight: bold; font-size: 1.5rem; }

/* --- Boutons d'action pour les machines --- */
.item-actions { display: flex; gap: 0.5rem; flex-direction: column; justify-content: center; }
.btn-action { padding: 0.6rem 0.8rem; border-radius: 8px; color: white; font-weight: bold; font-size: 0.85rem; text-align: center; text-decoration: none; border: none; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-action:active { transform: scale(0.95); }
.btn-green { background-color: #16a34a; }
.btn-orange { background-color: #f59e0b; }
.btn-red { background-color: #dc2626; }

.list-item { 
    background: white; 
    padding: 1rem; 
    border-radius: 10px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
    display: flex; /* Très important pour aligner les infos et les boutons */
    align-items: center; 
    justify-content: space-between;
    margin-bottom: 0.8rem;
    min-width: 0;
}
/* ===== Identité Le Tilt (flipper, fléchettes, billard) ===== */
:root {
    --tilt-nuit: #10162e;
    --tilt-panneau: #223059;
    --tilt-ambre: #ffb42e;
    --tilt-rouge: #e63946;
}
.btn-primary { background: linear-gradient(180deg, #ffc55c, #f59e0b); color: #10162e; font-weight: bold; border: none; }
.btn-primary:hover, .btn-primary:active { background: linear-gradient(180deg, #ffb42e, #e08c00); color: #10162e; }
.item-arrow { color: #f59e0b; }
.link-center { color: #b45309; }

/* Écran de connexion : ambiance backglass */
.page-login { background: var(--tilt-nuit); background-image: radial-gradient(circle at 20% 15%, rgba(255,180,46,0.14), transparent 40%), radial-gradient(circle at 80% 80%, rgba(230,57,70,0.12), transparent 45%), radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1.5px); background-size: auto, auto, 26px 26px; }
.page-login .header { display: none; }
.logo-splash { display: block; width: min(340px, 82vw); margin: 2.2rem auto 1.6rem; }
.page-login .login-card { border-top: 4px solid var(--tilt-ambre); box-shadow: 0 12px 30px rgba(0,0,0,0.45); }
.page-login .login-card h2 { color: var(--tilt-nuit); }
.signature-tilt { text-align: center; color: #8b96b8; font-size: 0.8rem; margin: 1.2rem 0 2rem; }
.signature-tilt b { color: var(--tilt-ambre); font-style: italic; }

/* Accueil : même ambiance backglass que la connexion */
.page-tilt { background: var(--tilt-nuit); background-image: radial-gradient(circle at 20% 15%, rgba(255,180,46,0.14), transparent 40%), radial-gradient(circle at 80% 80%, rgba(230,57,70,0.12), transparent 45%), radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1.5px); background-size: auto, auto, 26px 26px; }
.page-tilt .btn-dashboard { background: linear-gradient(180deg, #26345f, #1a2140); color: #fff; border: 1px solid rgba(255,180,46,0.35); border-top: 3px solid var(--tilt-ambre); box-shadow: 0 8px 18px rgba(0,0,0,0.35); }
.page-tilt .btn-dashboard .btn-title { color: #fff; }
.page-tilt .btn-dashboard:active { border-color: var(--tilt-ambre); box-shadow: 0 0 14px rgba(255,180,46,0.45); }
.page-tilt .btn-logout { color: #ff8b95; }

/* Signature Le Tilt en pied de page */
.pied-tilt { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px 0 26px; color: #64748b; font-size: 0.82rem; }
.pied-tilt img { height: 22px; }
.pied-tilt b { color: #f59e0b; font-style: italic; }
.page-tilt .pied-tilt, .page-login .pied-tilt { color: #8b96b8; }

/* ===== Listes responsives (Clients, Machines, Atelier) — mobile-first,
   mêmes paliers que l'accueil : 768px puis 1024px. Base = look mobile
   historique ; les classes remplacent les styles inline/utilitaires
   Bootstrap des vues pour être surchargeables en media query. ===== */
.page-liste { width: 100%; max-width: 500px; margin: 0 auto auto; min-height: 85vh; align-self: flex-start; }
.liste-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.liste-recherche { position: sticky; top: 0; z-index: 3; background-color: #f8f9fa; padding: 1rem 0 0.5rem; border-bottom: 1px solid #dee2e6; box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075); }
.liste-tous { display: flex; align-items: center; gap: 0.5rem; color: #4b5563; font-weight: bold; cursor: pointer; font-size: 0.9rem; margin: 8px 0 0; }
.liste-options { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; font-size: 0.9rem; padding-top: 10px; }
/* Le label global (margin-bottom:0.5rem) désalignait les libellés des
   rangées centrées (cases à cocher, compteur). */
.liste-options label, .liste-tous { margin-bottom: 0; }
/* Fiches machines (ex-styles inline des vues, sortis pour que la grille
   puisse surcharger bordure et marge) */
.fiche-machine { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid #e5e7eb; background: #fff; margin-bottom: 8px; border-radius: 8px; }
.fiche-machine-colonne { display: flex; flex-direction: column; align-items: flex-start; padding: 12px; border-bottom: 1px solid #e5e7eb; background: #fff; margin-bottom: 8px; border-radius: 8px; }
/* Cartes des historiques (bons de caisse, factures, factures PA) */
.carte-fiche { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-bottom: 10px; color: #111827; }
/* Bloc de filtres des historiques (recherche + mois/année/nb + Filtrer) */
.filtre-bloc { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.filtre-champs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.filtre-champs input[type="text"] { grid-column: 1 / -1; }
.filtre-actions { display: flex; gap: 8px; }

@media (min-width: 768px) {
    .page-liste { max-width: 768px; }
    /* Toutes les infos du haut sur UNE ligne collante (repli en 2 lignes
       seulement si elles ne tiennent physiquement pas) */
    .liste-entete { position: sticky; top: 0; z-index: 3; background-color: #f8f9fa; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.75rem 0; border-bottom: 1px solid #dee2e6; box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075); margin-bottom: 1rem; }
    .liste-nav { margin-bottom: 0; gap: 0.5rem; flex-shrink: 0; }
    .liste-recherche { position: static; padding: 0; border: 0; box-shadow: none; display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
    .liste-recherche .input-group { flex: 1; min-width: 110px; }
    .liste-recherche > form { flex: 1; min-width: 0; } /* recherche dans un <form> (interventions) */
    .liste-tous { margin: 0; white-space: nowrap; flex-shrink: 0; }
    .liste-options { margin-bottom: 0; padding-top: 0; gap: 0.5rem; flex-shrink: 0; }
    .liste-options label, #compteurLignes { white-space: nowrap; }
    /* Fiches en grille : 2 par ligne, chacune dans son petit cadre.
       Bordure #d1d5db (celle des champs de saisie) : le #e5e7eb des
       cartes se confond avec le fond #f3f4f6 sur grand écran. */
    .liste-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: none; }
    .liste-grille > .list-item { margin-bottom: 0; border: 1px solid #d1d5db; box-shadow: 0 2px 6px rgba(0,0,0,0.10); }
    .liste-grille > .carte-fiche { margin-bottom: 0; border-color: #d1d5db; box-shadow: 0 2px 6px rgba(0,0,0,0.10); }
    /* Messages vides, boutons pleine largeur… : sur toute la ligne */
    .liste-grille > :not(.list-item):not(.carte-fiche) { grid-column: 1 / -1; }
    /* Bloc de filtres sur UNE ligne : recherche compressible, selects au
       contenu, boutons à droite */
    .filtre-bloc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
    .filtre-champs { display: flex; flex: 1; min-width: 0; margin-bottom: 0; }
    .filtre-champs input[type="text"] { flex: 1 1 150px; min-width: 0; }
    .filtre-champs select { width: auto; flex: 0 1 auto; }
    .filtre-actions { flex-shrink: 0; }
}
@media (min-width: 1024px) {
    .page-liste { max-width: 1024px; }
    /* 3 fiches par ligne */
    .liste-grille { grid-template-columns: repeat(3, 1fr); }
}
