/* * IDEL Factu Flex - Propriété de [KSONTINI EMIR]
 * Toute modification ou tentative de reverse-engineering est interdite.
 */
 
/* Style de l'alerte d'installation iOS */
#ios-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 9999;
    border: 2px solid #2563eb;
    animation: slideUp 0.5s ease-out;
}
#android-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 9999;
    border: 2px solid #2563eb;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.ios-icon {
    width: 20px;
    vertical-align: middle;
    margin: 0 5px;
}

*{
box-sizing:border-box;
margin:0;
padding:0;
}


.resultat-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resultat-type {
    font-size: 10px;
    text-transform: uppercase;
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
}

.resultat-nom {
    font-weight: 600;
    font-size: 14px;
}


body{
font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,Arial,sans-serif;
background:#f6f7fb;
color:#1f2937;
min-height:100vh;
padding-bottom:110px;
}
a[href^="tel:"] {
    text-decoration: none !important;
}
/* =====   ===== */
#modal-onboarding, #modal-legal {
    display: none !important; /* Cache tout par défaut */

}

/* On crée une classe pour annuler le "display: none" quand le JS est prêt */
#modal-onboarding.active, #modal-legal.active {
    display: flex !important;
}
/* Bloque scroll derrière */
body.modal-open {
    overflow: hidden !important;
}

/* Animation d'entrée */

/* Conteneur de base pour les deux modals */
#modal-legal, #modal-onboarding {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background-color: rgba(0, 0, 0, 0.8); /* Fond sombre */
    backdrop-filter: blur(8px); /* Flou d'arrière-plan */
    z-index: 999999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Spécificité pour le Onboarding (Fond bleu) */
#modal-onboarding {
    background-color: #2563eb !important; /* Ton bleu IDELAP */
}

/* La carte blanche des CGV */
#modal-legal .animate-in {
    width: 95%;
    max-width: 500px;
    max-height: 85dvh !important; /* On laisse 15% de marge pour respirer */
    background: white;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Le contenu texte interne qui DOIT scroller */
#legal-content {
    flex: 1;
    overflow-y: auto !important;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
}

#onboarding-gif {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* L'animation de la carte (le contenu blanc) */
.animate-in {
    animation: modalShow 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(30px); /* On part d'un peu plus bas pour plus de dynamisme */
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Animation de sortie pour l'Onboarding (quand il disparaît pour laisser place au légal) */
.animate-out-down {
    animation: modalHide 0.4s ease-in forwards;
}

@keyframes modalHide {
    to {
        opacity: 0;
        transform: translateY(100%); /* Il glisse vers le bas */
    }
}

/* Petite astuce pour le contenu du onboarding (le texte/icônes) */
#modal-onboarding .w-full {
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.custom-scrollbar {
    -webkit-overflow-scrolling: touch; /* Scroll "élastique" sur iOS */
}
/* Scrollbar fine */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

/* ===== HEADER ===== */

header{
background:linear-gradient(135deg,#2563eb,#1d4ed8);
color:white;
padding:18px;
position:sticky;
top:0;
z-index:100;
box-shadow:0 8px 20px rgba(0,0,0,0.15);
}

header div{
max-width:520px;
margin:auto;
display:flex;
justify-content:space-between;
align-items:center;
}

header h1{
font-size:20px;
font-weight:700;
letter-spacing:.3px;
}

#stats-mensuel{
background:rgba(255,255,255,0.2);
padding:4px 8px;
border-radius:6px;
font-size:11px;
}
/* =====ORDONNANCES ===== */
 /* L'état fermé : on force 150px et on cache le reste */
.img-ordonnance-preview {
    height: 150px;  
    width: 100%;
    object-fit: cover;
    object-position: top;
    transition: all 0.4s ease-in-out;
    cursor: zoom-in;
}

/* L'état ouvert : on libère la hauteur */
.img-ordonnance-preview.ouvert {
    height: auto;
    max-height: 100%;  
    object-fit: contain;
    cursor: zoom-out;
}
.form-ordo-edit {
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease-in-out;
    opacity: 0;
}

.img-ordonnance-preview.ouvert + .form-ordo-edit {
    max-height: 1000px; /* Assez grand pour tout le contenu */
    opacity: 1;
    padding-top: 1.25rem;
}
/* On force le select à être plus compact et sans flèche moche pour gagner de la place */
select.appearance-none {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    padding: 2px 4px !important; /* Réduit le padding interne */
    text-align-last: center; /* Centre le texte */
    width: auto;
    min-width: 35px;
}

/* On s'assure que le container de récurrence laisse assez de place */
.flex-1.justify-end {
    min-width: 180px; /* Donne une base de largeur pour les deux select */
}
/*   			TOURNEE  		*/
.marker-number {
    background-color: #2563eb; /* Bleu */
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-weight: 900;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.marker-number-done {
    background-color: #9ca3af; /* Gris pour les patients faits */
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-weight: 900;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tournee-map {
    height: 100% !important;
    width: 100% !important;
    min-height: 200px; /* Sécurité */
    background: #e5e7eb; /* Gris clair en attendant le chargement */
}
.leaflet-container {
	height: 100%;
    width: 100%;
}
.leaflet-pane { z-index: 1 !important; }
.leaflet-top, .leaflet-bottom { z-index: 2 !important; }
/* Style des tuiles de la tournée en cours */
.patient-go-card {
    transition: all 0.3s ease;
}

.patient-go-card.visited {
    opacity: 0.5;
    filter: grayscale(1);
    transform: scale(0.95);
}

/* Badge de distance */
.dist-badge {
    background: #f0fdf4;
    color: #16a34a;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 800;
}

/* 1. Empêche la page entière de glisser horizontalement */
html, body {
    overflow-x: hidden;
}

/* 2. Style spécifique pour le conteneur de navigation */
.no-scrollbar {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
}

/* 3. Cache la barre de défilement pour garder l'aspect App */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 4. On s'assure que les boutons ne s'écrasent pas */
.flex-none {
    flex-shrink: 0;
}

/* ===== LAYOUT ===== */

main{
max-width:520px;
margin:auto;
padding:20px 16px;
}


.hidden{
display:none;
}


/* Conteneur de la barre */
.progress-container {
    width: 50px;
    background: rgba(255, 255, 255, 0.2) !important;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    display: block !important; /* Force l'arrêt du mode flex */
    margin-top: 5px;
}

/* La barre de remplissage */
#goal-bar-fill {
    height: 100%;
    width: 0%; 
    background: #4ade80;
    transition: width 0.5s ease-out;
    position: absolute; /* Fixe la barre */
    left: 0;           /* Bloquée à gauche */
    top: 0;
}

section{
margin-bottom:24px;
}

/* ===== CARD ===== */

.bg-white{
background:white;
border-radius:16px;
padding:20px;
border:1px solid #e6e8ef;
box-shadow:
0 1px 2px rgba(0,0,0,0.04),
0 10px 20px rgba(0,0,0,0.04);
}

.border-t-4{
border-top:4px solid #22c55e;
}

/* ===== TITRES ===== */

h2{
font-size:18px;
font-weight:700;
margin-bottom:14px;
}

.text-green-600{
color:#16a34a;
}

/* ===== INPUTS ===== */

input,
select{
width:100%;
padding:11px 12px;
border-radius:10px;
border:1px solid #e2e6ef;
font-size:14px;
background:white;
transition:.15s;
}

input:focus,
select:focus{
outline:none;
border-color:#2563eb;
box-shadow:0 0 0 3px rgba(37,99,235,0.12);
}

.uppercase{
text-transform:uppercase;
}

/* ===== FLEX HELPERS ===== */

.flex{
display:flex;
gap:10px;
}

.flex-1{
flex:1;
}

.items-center{
align-items:center;
}

.justify-between{
justify-content:space-between;
}

.flex-col{
flex-direction:column;
}

.gap-2{gap:8px}
.gap-4{gap:14px}

/* ===== BUTTONS ===== */

button{
border:none;
border-radius:10px;
padding:10px 14px;
font-weight:600;
font-size:14px;
cursor:pointer;
transition:.15s;
}

button:hover{
transform:translateY(-1px);
}

.bg-blue-600{
background:#2563eb;
color:white;
}

.bg-blue-600:hover{
background:#1d4ed8;
}

.bg-green-600{
background:#22c55e;
color:white;
}

.bg-green-600:hover{
background:#16a34a;
}

.bg-gray-200{
background:#e5e7eb;
}

.bg-gray-800{
background:#111827;
color:white;
}

.bg-blue-500{
background:#3b82f6;
color:white;
}

/* ===== CHECKBOX AREA ===== */

/* Conteneur bleu clair autour des options */
.checkbox-area {
    background: #eef4ff;
    padding: 14px;
    border-radius: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 colonnes égales */
    gap: 12px;
    margin: 10px 0;
}

/* Style de chaque option */
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* On force la taille du carré pour qu'il ne disparaisse pas */
.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0; /* Empêche l'écrasement */
    cursor: pointer;
}

/* L'option "Cabinet" prend toute la largeur en bas */
.full-row {
    grid-column: span 2;
    border-top: 1px solid #dbeafe;
    padding-top: 10px;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}
/* Style spécifique pour la carte ALD */
.ald-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff7ed; /* Un orange très léger pour attirer l'oeil sans agresser */
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ffedd5;
    margin: 15px 0;
    cursor: pointer;
    transition: 0.2s;
}

.ald-card:hover {
    background: #ffedd5;
}

.ald-card input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #f97316; /* Couleur orange pour l'ALD */
}

.ald-text {
    display: flex;
    flex-direction: column;
}

.ald-title {
    font-size: 14px;
    font-weight: 700;
    color: #9a3412;
}

.ald-desc {
    font-size: 11px;
    color: #c2410c;
}
/* ===== LISTES ===== */

#patient-list,
#panier-soins,
#liste-factures{
display:flex;
flex-direction:column;
gap:10px;
margin-top:10px;
}

#patient-list > div,
#liste-factures > div,
#panier-soins > div {
background:white;
padding:0.75rem;
margin-bottom: 0.5rem;
border-radius:12px;
border:1px solid #e6e8ef;
display:flex;
justify-content:space-between;
align-items:center;
box-shadow:0 3px 10px rgba(0,0,0,0.04);
}

.badge-macho {
    font-size: 8px;
    padding: 2px 4px;
    border-radius: 4px;
}
/* ===== TOTAL BOX ===== */

.bg-gray-900{
background:linear-gradient(145deg,#111827,#1f2937);
color:white;
padding:16px;
border-radius:14px;
display:flex;
justify-content:space-between;
align-items:center;
position:sticky;
bottom:90px;
box-shadow:0 10px 25px rgba(0,0,0,0.25);
}

#total-final{
font-size:26px;
font-weight:700;
}

/* ===== NAVBAR ===== */

/* Style des petits badges dans le panier */
.panier-badge {
    font-size: 9px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-right: 4px;
}

.bg-orange-100 { background: #ffedd5; color: #9a3412; } /* Dimanche */
.bg-purple-100 { background: #f3e8ff; color: #6b21a8; } /* Nuit */
.bg-blue-100 { background: #dbeafe; color: #1e40af; }   /* IFD */
.bg-gray-100 { background: #f3f4f6; color: #374151; }   /* IK / KM */

nav{
position:fixed;
bottom:0;
left:0;
right:0;
background:white;
border-top:1px solid #e6e8ef;
display:flex;
justify-content:space-around;
padding:8px 0;
z-index:100;
box-shadow:0 -5px 15px rgba(0,0,0,0.05);
}

nav button{
background:none;
display:flex;
flex-direction:column;
align-items:center;
font-size:11px;
color:#9ca3af;
gap:2px;
padding:6px;
}

nav span{
font-size:20px;
}

/* Ajoute un petit fondu blanc à droite pour suggérer le scroll */
nav::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, white, transparent);
    pointer-events: none; /* Pour pouvoir cliquer sur les boutons dessous */
    z-index: 60;
}

.active-tab{
color:#2563eb;
border-top:3px solid #2563eb;
}

/* ===== RESPONSIVE ===== */

@media (min-width:700px){

main{
max-width:650px;
}

header div{
max-width:650px;
}

}

@media (min-width:1000px){

main{
max-width:720px;
}

}