/**
 * Protéines - Calculateur journalier Multi-Famille
 * Design pastel, mobile-first
 * Version 3.0.3 - Multi-famille avec authentification
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --pastel-green: #a8d5ba;
    --pastel-green-dark: #7bc49a;
    --pastel-blue: #a8d4e6;
    --pastel-pink: #f4c2c2;
    --pastel-yellow: #f9e79f;
    --pastel-purple: #d7bde2;
    --pastel-orange: #f5cba7;
    --white: #ffffff;
    --gray-light: #f8f9fa;
    --gray: #6c757d;
    --gray-dark: #343a40;
    --danger: #e57373;
    --success: #81c784;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--pastel-green) 0%, var(--pastel-blue) 100%);
    min-height: 100vh;
    color: var(--gray-dark);
}

/* ===== CLS FIX: Animation fade-in pour masquer les changements ===== */
.app-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 15px;
    padding-bottom: 100px;
    opacity: 0;
    visibility: hidden;
}

.app-container.loaded {
    opacity: 1;
    visibility: visible;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== HEADER - OPTIMISE CLS ===== */
.app-header {
    text-align: center;
    margin-bottom: 20px;
    contain: layout;           /* CLS FIX: Containment */
    min-height: 90px;          /* CLS FIX: Hauteur minimale */
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    padding-right: 0;
}

.header-top h1 {
    flex: 1;
}

.app-header h1 {
    font-size: 1.8rem;
    color: var(--white);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3), 0 0 10px rgba(0,0,0,0.15);
    margin: 0;
}

.reload-icon {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px;
    margin-left: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;               /* CLS FIX: Dimension fixe */
    height: 36px;              /* CLS FIX: Dimension fixe */
}

.reload-icon:hover {
    color: var(--gray-dark);
}

.reload-icon:active {
    transform: rotate(-180deg);
}

.settings-icon {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px;
    margin-right: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;               /* CLS FIX: Dimension fixe */
    height: 36px;              /* CLS FIX: Dimension fixe */
}

.settings-icon svg {
    display: block;
}

.settings-icon:hover {
    color: var(--gray-dark);
    transform: rotate(45deg);
}

/* Navigation par jour */
.date-navigator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    min-height: 36px;          /* CLS FIX: Hauteur minimale */
}

.nav-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: var(--white);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;            /* CLS FIX: Empêche le rétrécissement */
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.current-date {
    font-size: 1rem;
    color: var(--white);
    min-width: 200px;
    text-align: center;
    height: 24px;
    line-height: 24px;
    overflow: hidden;
    contain: layout;           /* CLS FIX: Containment */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.25);
    font-weight: 500;
}

/* ===== SELECTEUR PERSONNE - OPTIMISE CLS ===== */
.person-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    contain: layout;           /* CLS FIX: Containment */
    min-height: 48px;          /* CLS FIX: Hauteur minimale */
}

.person-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--white);
    color: var(--gray);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: 44px;          /* CLS FIX: Hauteur minimale */
}

.person-btn.active {
    background: var(--pastel-green-dark);
    color: var(--white);
    transform: scale(1.02);
}

/* ===== CARTE PROGRESSION - OPTIMISE CLS ===== */
.progress-card {
    background: var(--white);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    contain: layout style;     /* CLS FIX: Containment */
    min-height: 180px;         /* CLS FIX: Hauteur minimale (2 barres) */
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-label {
    font-size: 0.9rem;
    color: var(--gray);
}

.progress-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-dark);
    min-width: 100px;          /* CLS FIX: Largeur minimale */
    text-align: right;         /* CLS FIX: Alignement stable */
    contain: layout;           /* CLS FIX: Containment */
}

.progress-bar {
    height: 12px;
    background: var(--gray-light);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pastel-green) 0%, var(--pastel-green-dark) 100%);
    border-radius: 10px;
    /* CLS FIX: Suppression de la transition qui cause des décalages */
    /* transition: width 0.5s ease; */
    width: 0%;
}

.progress-fill.warning {
    background: linear-gradient(90deg, var(--pastel-orange) 0%, #e67e22 100%);
}

.progress-fill.success {
    background: linear-gradient(90deg, var(--success) 0%, #4caf50 100%);
}

.progress-fill.over {
    background: linear-gradient(90deg, var(--danger) 0%, #c0392b 100%);
}

.progress-header-calories {
    margin-top: 10px;
}

.progress-status {
    font-size: 0.85rem;
    color: var(--gray);
    text-align: center;
    height: 20px;
    line-height: 20px;
    overflow: hidden;
    contain: layout;           /* CLS FIX: Containment */
    margin-top: 10px;
}

/* ===== CARTES REPAS - OPTIMISE CLS ===== */
.meals-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    contain: layout;           /* CLS FIX: Containment */
}

.meal-card {
    background: var(--white);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    contain: layout style paint; /* CLS FIX: Containment complet */
    min-height: 120px;         /* CLS FIX: Hauteur minimale */
}

.meal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-light);
    min-height: 40px;          /* CLS FIX: Hauteur minimale */
}

/* CLS FIX: Icônes emoji avec dimensions fixes */
.meal-icon {
    font-size: 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.meal-name {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
}

.meal-target {
    font-size: 0.75rem;
    color: var(--gray);
    background: var(--gray-light);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.meal-total {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--pastel-green-dark);
    min-width: 50px;           /* CLS FIX: Largeur minimale */
    text-align: right;         /* CLS FIX: Alignement stable */
}

/* Bouton copier en mémoire / coller */
.clipboard-btn {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 5px;
    opacity: 0.5;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    margin-left: 5px;
}

.clipboard-btn:hover {
    opacity: 1;
    color: var(--pastel-blue);
}

.clipboard-btn:active {
    transform: scale(0.9);
}

/* État : un repas est en mémoire et peut être collé ici */
.clipboard-btn.can-paste {
    opacity: 1;
    color: var(--pastel-green-dark);
}

.clipboard-btn.can-paste svg {
    transform: rotate(180deg);
}

/* État : confirmation de collage en attente */
.clipboard-btn.pending {
    opacity: 1;
    color: #c0392b;
    background: rgba(192, 57, 43, 0.15);
    border-radius: 5px;
    animation: pulse 0.5s ease infinite alternate;
}

.clipboard-btn .confirm-text {
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 2px;
}

@keyframes pulse {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

.copy-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-dark);
    color: var(--white);
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    z-index: 2000;
    animation: toastFade 2s ease forwards;
}

@keyframes toastFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

.meal-items {
    margin-bottom: 10px;
    contain: layout;           /* CLS FIX: Containment */
}

.meal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--gray-light);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    margin: 0 -10px;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 8px;
    min-height: 36px;          /* CLS FIX: Hauteur minimale */
}

.meal-item:hover {
    background: var(--gray-light);
}

.meal-item:last-child {
    border-bottom: none;
}

.meal-item-name {
    color: var(--gray-dark);
    flex: 1;
}

.meal-item-values {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.meal-item-calories {
    font-size: 0.8rem;
    color: var(--gray);
    min-width: 55px;
    text-align: right;
}

.meal-item-proteins {
    font-weight: 600;
    color: var(--pastel-green-dark);
    min-width: 45px;           /* CLS FIX: Largeur minimale */
    text-align: right;         /* CLS FIX: Alignement stable */
    flex-shrink: 0;            /* CLS FIX: Empêche le rétrécissement */
}

.meal-item-comment {
    display: block;
    font-size: 0.75rem;
    color: var(--gray);
    font-style: italic;
    margin-top: 2px;
}

/* Conteneur pour calories + protéines */
.meal-values-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.meal-calories {
    font-size: 0.8rem;
    color: var(--gray);
    flex-shrink: 0;
}

/* Mobile portrait : empiler calories et protéines verticalement */
@media (max-width: 400px) {
    .meal-values-container {
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
    }

    .meal-total {
        min-width: auto;
    }

    .meal-calories {
        font-size: 0.75rem;
    }
}

.add-item-btn {
    width: 100%;
    padding: 10px;
    border: 2px dashed var(--pastel-green);
    border-radius: 10px;
    background: transparent;
    color: var(--pastel-green-dark);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 42px;          /* CLS FIX: Hauteur minimale */
}

.add-item-btn:hover {
    background: var(--pastel-green);
    color: var(--white);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--gray-light);
}

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--gray-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-body h3 {
    font-size: 1rem;
    color: var(--pastel-green-dark);
    margin: 15px 0 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--pastel-green);
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid var(--gray-light);
}

.app-version {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 20px 15px;
    font-size: 0.75rem;
    color: var(--gray);
}

/* Formulaires */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--gray-light);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--pastel-green);
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.hint {
    display: block;
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 5px;
}

.protein-preview {
    background: var(--pastel-green);
    color: var(--white);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.1rem;
}

/* Boutons */
.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: var(--gray-light);
    color: var(--gray);
}

.btn-confirm {
    background: var(--pastel-green-dark);
    color: var(--white);
}

.btn-confirm:hover {
    background: #5fb383;
}

.btn-delete {
    background: var(--danger);
    color: var(--white);
}

.btn-delete:hover {
    background: #c0392b;
}

/* Mobile : réduire la taille des boutons du modal */
@media (max-width: 400px) {
    .modal-footer .btn {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}

/* Recherche aliment */
.search-wrapper {
    position: relative;
}

.search-status {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--gray);
}

.search-status.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--pastel-green);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.search-results {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 5px;
    border-radius: 10px;
    background: var(--gray-light);
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--white);
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item:active {
    background: var(--pastel-green);
    color: var(--white);
}

.search-result-item .result-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.search-result-item .result-proteins {
    font-size: 0.8rem;
    opacity: 0.8;
}

.search-result-favorite {
    background: var(--pastel-yellow);
    border-left: 3px solid #f39c12;
}

.search-result-favorite:hover,
.search-result-favorite:active {
    background: #f39c12;
}

.search-result-local {
    background: var(--pastel-blue);
    border-left: 3px solid var(--pastel-green-dark);
}

.search-result-local:hover,
.search-result-local:active {
    background: var(--pastel-green-dark);
}

.search-result-manual {
    background: var(--pastel-yellow);
    font-style: italic;
}

.protein-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.protein-info input {
    flex: 1;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
}

.protein-unit {
    font-size: 1.1rem;
    color: var(--gray);
}

.protein-source {
    display: block;
    margin-top: 5px;
    color: var(--pastel-green-dark);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 380px) {
    .app-container {
        padding: 15px 10px;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .person-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .app-container {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }
}

/* ===== MODAL PARAMETRES - ONGLETS ===== */
.modal-settings {
    max-width: 420px;
}

/* Modal de confirmation */
.modal-confirm,
.modal-alert {
    max-width: 360px;
    text-align: center;
}

.modal-confirm .modal-header,
.modal-alert .modal-header {
    background: var(--pastel-blue);
    border-bottom: none;
}

.modal-confirm .modal-header h3,
.modal-alert .modal-header h3 {
    color: var(--dark);
    font-size: 1.1rem;
}

.modal-confirm.modal-danger .modal-header {
    background: #ffe5e5;
}

.modal-confirm.modal-danger .modal-header h3 {
    color: #dc3545;
}

.modal-confirm .modal-body,
.modal-alert .modal-body {
    padding: 25px 20px;
}

.modal-confirm .modal-body p,
.modal-alert .modal-body p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--dark);
}

.modal-confirm .modal-footer,
.modal-alert .modal-footer {
    justify-content: center;
    gap: 15px;
    padding: 15px 20px 20px;
}

.modal-alert .modal-footer {
    justify-content: center;
}

.settings-tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-light);
    background: var(--gray-light);
}

.settings-tab {
    flex: 1;
    padding: 12px 15px;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.settings-tab:hover {
    color: var(--gray-dark);
}

.settings-tab.active {
    color: var(--pastel-green-dark);
    background: var(--white);
}

.settings-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--pastel-green-dark);
}

.settings-content {
    display: none;
}

.settings-content.active {
    display: block;
}

/* Formulaire aliments personnalisés */
.custom-food-form {
    padding-bottom: 15px;
    border-bottom: 1px solid var(--gray-light);
    margin-bottom: 15px;
}

.custom-food-form h3 {
    margin-top: 0 !important;
}

#addCustomFood {
    width: 100%;
    margin-top: 5px;
}

/* Liste aliments personnalisés */
.custom-food-list h3 {
    margin-top: 0 !important;
}

.custom-food-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--pastel-purple);
    border-radius: 10px;
    margin-bottom: 8px;
    gap: 10px;
}

.custom-food-item:last-child {
    margin-bottom: 0;
}

.custom-food-info {
    flex: 1;
}

.custom-food-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-dark);
}

.custom-food-details {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 2px;
}

.custom-food-delete {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-food-delete:hover {
    background: rgba(229, 115, 115, 0.2);
}

.empty-list-message {
    text-align: center;
    color: var(--gray);
    font-size: 0.9rem;
    padding: 20px;
    font-style: italic;
}

.empty-list-message.hidden {
    display: none;
}

/* Style spécial pour aliments personnalisés dans la recherche */
.search-result-custom {
    background: var(--pastel-purple);
    border-left: 3px solid #9b59b6;
}

.search-result-custom:hover,
.search-result-custom:active {
    background: #9b59b6;
}

/* ===== TABLEAU FAVORIS ===== */
.favorites-info {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 15px;
    text-align: center;
}

.favorites-table-container {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid var(--gray-light);
}

.favorites-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.favorites-table thead {
    position: sticky;
    top: 0;
    background: var(--pastel-green-dark);
    color: white;
}

.favorites-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
}

.favorites-table th:nth-child(2),
.favorites-table th:nth-child(3) {
    text-align: right;
    width: 60px;
}


.favorites-table td {
    padding: 8px;
    border-bottom: 1px solid var(--gray-light);
}

.favorites-table td:nth-child(2),
.favorites-table td:nth-child(3) {
    text-align: right;
    white-space: nowrap;
}

.favorites-table tbody tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

.favorites-table tbody tr:hover {
    background: var(--pastel-green);
}

.favorites-table tbody tr:active {
    background: var(--pastel-green-dark);
}

#emptyFavorites {
    text-align: center;
    color: var(--gray);
    padding: 20px;
    font-style: italic;
}

/* ===== MODAL EDITION FAVORI ===== */
.modal-edit-favorite {
    max-width: 400px;
}

.modal-edit-favorite .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--gray-dark);
}

.modal-edit-favorite .form-group input[type="text"],
.modal-edit-favorite .form-group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    font-size: 1rem;
}

.modal-edit-favorite .protein-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-edit-favorite .protein-info input {
    flex: 1;
}

.modal-edit-favorite .protein-unit {
    color: var(--gray);
    font-size: 0.9rem;
    min-width: 30px;
}

.favorite-stats {
    text-align: center;
    padding: 10px 0;
    color: var(--gray);
    border-top: 1px solid var(--gray-light);
    margin-top: 10px;
}

#emptyFavorites.hidden {
    display: none;
}

/* ===== PROFILS DYNAMIQUES ===== */
.profile-section {
    background: var(--gray-light);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

/* Header du profil avec nom et bouton supprimer */
.profile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--pastel-green);
}

.profile-header .person-name {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--pastel-green-dark);
    border: none;
    background: transparent;
    padding: 4px 0;
    border-bottom: 1px dashed transparent;
}

.profile-header .person-name:focus {
    outline: none;
    border-bottom-color: var(--pastel-green-dark);
}

.btn-delete-person {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 5px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-delete-person:hover {
    opacity: 1;
}

.profile-section .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.profile-section .form-group {
    margin-bottom: 8px;
}

.profile-section .form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 4px;
}

.profile-section .form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.profile-section .form-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 4px;
}

/* Bouton Déconnexion */
.btn-logout {
    background: var(--white);
    color: var(--danger);
    border: 2px solid var(--danger);
}

.btn-logout:hover {
    background: var(--danger);
    color: var(--white);
}

#tab-profils .modal-footer {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--gray-light);
    margin-top: 10px;
}

#tab-profils .modal-footer .btn-logout {
    flex: 0 0 auto;
}

#tab-profils .modal-footer .btn-confirm {
    flex: 1;
}

/* Bouton ajouter une personne */
.btn-add-person {
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    border: 2px dashed var(--pastel-green);
    border-radius: 12px;
    background: transparent;
    color: var(--pastel-green-dark);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-add-person:hover {
    background: rgba(168, 213, 186, 0.2);
    border-color: var(--pastel-green-dark);
}

/* Info nombre de personnes */
.persons-count-info {
    text-align: center;
    color: var(--gray);
    font-size: 0.85rem;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--gray-light);
}

/* Bouton supprimer le compte */
.btn-delete-account {
    width: 100%;
    padding: 12px;
    margin-top: 30px;
    border: 1px solid #dc3545;
    border-radius: 8px;
    background: transparent;
    color: #dc3545;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-delete-account:hover {
    background: #dc3545;
    color: white;
}

/* Message quand pas de personne configurée */
.no-persons-message {
    text-align: center;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    color: var(--gray-dark);
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Lien Administration dans le header */
.admin-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #555;
    text-decoration: none;
    padding: 8px;
    position: relative;
}

.admin-link svg {
    display: block;
}

/* Badge notification admin */
.admin-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
