* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; padding: 20px; }
.container { max-width: 600px; margin: 0 auto; background: white; border-radius: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); overflow: hidden; }
.header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px 20px; text-align: center; }
.header h1 { font-size: 28px; margin-bottom: 10px; }
.subtitle { font-size: 14px; opacity: 0.9; }

/* Position */
.location-search-area { padding: 15px 20px; background: #f8f9fa; border-bottom: 1px solid #eee; }
.btn-location { width: 100%; padding: 12px; margin-bottom: 8px; background: #667eea; color: white; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 14px; transition: all 0.3s; }
.btn-secondary { background: #fff; color: #667eea; border: 1px solid #667eea; }
.btn-location:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3); }
.manual-input-wrapper { display: flex; gap: 5px; margin-top: 10px; }
#manual-coords { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.btn-apply { padding: 8px 15px; background: #28a745; color: white; border: none; border-radius: 6px; cursor: pointer; }
.location-status { margin-top: 8px; font-size: 12px; color: #666; text-align: center; font-style: italic; }
.location-status.searching { color: #667eea; animation: pulse 1.5s infinite; }
.location-status.success { color: #28a745; }
.location-status.error { color: #dc3545; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Assurances avec Autocomplétion */
.assurance-search-area { padding: 15px 20px; background: #fff; border-bottom: 1px solid #eee; }
.section-label { display: block; font-weight: 600; margin-bottom: 8px; color: #333; font-size: 14px; }
.autocomplete-wrapper { position: relative; }
#assurance-input, #medicament-input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; margin-bottom: 8px; }
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}
.suggestions-dropdown.active { display: block; }
.suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}
.suggestion-item:hover { background: #f8f9fa; }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-name { font-weight: 600; color: #333; }
.suggestion-count { font-size: 11px; color: #999; background: #f0f0f0; padding: 2px 6px; border-radius: 10px; }

#assurance-chips-container, #medicament-chips-container { display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; }
.assurance-chip { background: #eef2ff; color: #667eea; padding: 5px 10px; border-radius: 15px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.assurance-chip-close { background: none; border: none; color: #667eea; cursor: pointer; font-weight: bold; font-size: 14px; }

/* Médicaments */
.medicament-search-area { padding: 15px 20px; background: #fff; border-bottom: 1px solid #eee; }
.medicament-chip { background: #fef3c7; color: #92400e; padding: 5px 10px; border-radius: 15px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.medicament-chip-close { background: none; border: none; color: #92400e; cursor: pointer; font-weight: bold; font-size: 14px; }

/* Filtres */
.filter-area { padding: 10px 20px; display: flex; align-items: center; gap: 10px; font-size: 14px; color: #555; }
.status { padding: 15px; text-align: center; font-size: 16px; color: #555; }
.progress-container { height: 4px; background: #e9ecef; overflow: hidden; display: none; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #667eea 0%, #764ba2 100%); width: 0%; transition: width 0.3s ease; }
.results { padding: 20px; max-height: 500px; overflow-y: auto; }

/* Suggestions de Recherche Partielle */
.partial-suggestions {
    padding: 15px 20px;
    background: #fff3cd;
    border-bottom: 2px solid #ffc107;
}
.partial-suggestions h4 {
    font-size: 14px;
    color: #856404;
    margin-bottom: 10px;
}
.partial-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 6px;
    background: #fff;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.partial-btn:hover {
    background: #ffc107;
    color: white;
    transform: translateX(5px);
}
.partial-btn .count {
    float: right;
    background: #ffc107;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}
.partial-btn:hover .count {
    background: white;
    color: #856404;
}

/* Cartes */
.pharmacy-card { background: #f8f9fa; border-radius: 12px; padding: 15px; margin-bottom: 12px; border-left: 4px solid #667eea; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.pharmacy-name { font-weight: bold; font-size: 16px; color: #333; flex: 1; }
.badge-duty { background: #dcfce7; color: #166534; font-size: 10px; font-weight: bold; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; margin-left: 8px; }
.pharmacy-info { font-size: 14px; color: #666; margin-bottom: 8px; }
.distance { color: #667eea; font-weight: 600; }

/* Tags d'Assurance - MODIFIÉ pour afficher seulement les matchées */
.assurances-container, .medicaments-container { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; font-size: 11px; align-items: center; }
.assurance-tag { 
    background: #eef2ff; 
    color: #667eea; 
    padding: 3px 8px; 
    border-radius: 4px; 
    border: 1px solid #c7d2fe; 
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.assurance-tag.matched {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}
.assurance-tag.matched::before {
    content: "✓";
    font-weight: bold;
}
.assurance-tag.unmatched {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}
.assurance-tag.unmatched::before {
    content: "✗";
}
.more-assurances {
    background: #f3f4f6;
    color: #6b7280;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px dashed #d1d5db;
    font-size: 10px;
    font-style: italic;
}

.medicament-tag { background: #fef3c7; color: #92400e; padding: 2px 6px; border-radius: 4px; border: 1px solid #fcd34d; }
.medicament-tag.more { background: #fff; border-style: dashed; }

.card-actions { margin-top: 12px; border-top: 1px solid #eee; padding-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.btn-nav, .btn-copy { 
    display: inline-block; 
    text-decoration: none; 
    background: #fff; 
    border: 1px solid #667eea; 
    color: #667eea; 
    padding: 6px 12px; 
    border-radius: 6px; 
    font-size: 13px; 
    font-weight: 600; 
    cursor: pointer;
    transition: all 0.2s;
}
.btn-nav:hover, .btn-copy:hover { background: #667eea; color: white; }
.btn-copy.copied { background: #28a745; color: white; border-color: #28a745; }

/* Boutons d'action (Recherche + Reset) */
.actions-container {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
}
.search-btn { 
    flex: 2;
    padding: 18px; 
    font-size: 18px; 
    font-weight: 600; 
    color: white; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    border: none; 
    border-radius: 12px; 
    cursor: pointer; 
    transition: opacity 0.2s;
}
.search-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-reset {
    flex: 1;
    padding: 18px;
    font-size: 18px;
    font-weight: 600;
    color: white;
    background: #6c757d;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-reset:hover { background: #5a6268; }

.install-btn { width: calc(100% - 40px); margin: 0 20px 20px; padding: 15px; font-size: 16px; font-weight: 600; color: white; background: #28a745; border: none; border-radius: 12px; cursor: pointer; display: none; }
.no-results { text-align: center; padding: 40px 20px; color: #999; }

/* Message quand aucune assurance n'est connue */
.no-assurance {
    color: #9ca3af;
    font-style: italic;
    font-size: 11px;
}

/* Badge pour le compteur "+X autres" des assurances */
.assurance-tag.more {
    background: #fff;
    border-style: dashed;
    color: #6b7280;
}
