/* --- Charte Graphique BAMBOO (Version Logo XL) --- */
:root {
    --vert-header: #6D8B74;
    --vert-fonce: #5F7A65;
    --beige-fond-page: #F3EFE9;
    --beige-cadre-principal: #EBE7E0;
    --blanc: #FFFFFF;
    --texte-brun: #5A4A42;
    --texte-sombre: #4A4A4A;
    --orange-alerte: #E67E22;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--beige-fond-page);
    color: var(--texte-sombre);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================
   1. EN-TÊTE (HEADER) - PLUS HAUT
   ============================ */
.main-header {
    display: flex;
    height: 110px; /* J'ai augmenté la hauteur pour le gros logo */
    background-color: var(--vert-header);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* --- PARTIE GAUCHE (BLANCHE) --- */
.header-left-section {
    background-color: var(--blanc);
    display: flex;
    align-items: center;
    padding-left: 20px;
    padding-right: 50px; 
    position: relative;
    z-index: 2;
}

/* LA BARRE PENCHÉE (SKEW) */
.header-left-section::after {
    content: '';
    position: absolute;
    top: 0;
    right: -30px;
    width: 60px;
    height: 100%;
    background-color: var(--blanc);
    transform: skewX(-20deg);
    z-index: 1;
}

/* --- LOGO & TEXTE --- */
.logo-container {
    display: flex;
    align-items: center;
    gap: 20px; /* Plus d'espace entre image et texte */
    z-index: 3;
    position: relative;
}

.logo-img {
    height: 95px; /* LOGO TRÈS GRAND (Max possible dans 110px) */
    width: auto;
    object-fit: contain;
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* On s'assure que le texte est bien aligné à gauche */
    align-items: flex-start; 
}

.brand-name {
    font-size: 36px; /* BAMBOO ENCORE PLUS GROS */
    font-weight: 900;
    color: var(--texte-brun);
    line-height: 1;
    margin: 0;
    letter-spacing: 1px;
}

.brand-subtitle {
    font-size: 15px;
    color: var(--texte-brun);
    margin: 5px 0 0 0; /* Un petit espace sous BAMBOO */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px; /* Lettres espacées pour le style "Cabinet" */
}

/* --- PARTIE DROITE (NAVIGATION) --- */
.header-right-section {
    flex: 1;
    display: flex;
    align-items: center;
    padding-left: 60px;
    padding-right: 30px;
}

.nav-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-item {
    color: var(--blanc);
    text-decoration: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 17px;
    font-weight: 500;
    transition: 0.3s;
}

.nav-item:hover {
    background-color: rgba(255,255,255,0.2);
}

.nav-item.active {
    background-color: var(--beige-fond-page);
    color: var(--vert-header);
    font-weight: 800;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ============================
   2. RESTE DU CONTENU (Inchangé mais ajusté)
   ============================ */
.page-container {
    padding: 30px;
    max-width: 1400px; /* Plus large */
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.main-content-frame {
    background-color: var(--beige-cadre-principal);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    min-height: 600px;
}

/* Elements communs */
.hero-section {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    align-items: center;
}

.search-box {
    background: var(--blanc);
    border-radius: 50px;
    padding: 8px 15px;
    display: flex;
    flex: 1;
    max-width: 600px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #ccc;
}

.search-box input {
    border: none;
    outline: none;
    padding: 10px 10px;
    width: 100%;
    font-size: 16px;
    background: transparent;
}

.search-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding-right: 10px;
    color: var(--vert-header);
}

.btn-new {
    background-color: var(--vert-header);
    color: white;
    padding: 15px 35px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 50px;
}

.card {
    background: var(--blanc);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    margin-bottom: 25px;
}

.rdv-row {
    display: flex;
    align-items: center;
    background: #FAFAFA;
    padding: 20px;
    margin-bottom: 12px;
    border-left: 6px solid var(--vert-header);
    border-radius: 6px;
}

.rdv-time {
    font-size: 1.3em;
    font-weight: 900;
    color: var(--texte-sombre);
    width: 90px;
}

/* --- BOUTON ROND D'ACTION (Pour les Notes) --- */
.btn-circle-action {
    background-color: var(--vert-header); /* Couleur de base */
    color: white;
    width: 45px;  /* Un peu plus grand pour être confortable */
    height: 45px;
    border-radius: 50%; /* Cercle parfait */
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px; /* Le "+" est plus grand */
    font-weight: 400; /* Un "+" un peu plus fin, plus élégant */
    cursor: pointer;
    /* Une ombre douce pour le faire ressortir */
    box-shadow: 0 4px 10px rgba(109, 139, 116, 0.3); 
    transition: all 0.2s ease; /* Animation fluide */
}

/* Quand on passe la souris dessus */
.btn-circle-action:hover {
    background-color: var(--vert-fonce); /* Devient légèrement plus foncé */
    transform: translateY(-3px); /* Se soulève légèrement */
    box-shadow: 0 6px 15px rgba(109, 139, 116, 0.5); /* L'ombre grandit */
}

/* Quand on clique dessus */
.btn-circle-action:active {
    transform: translateY(-1px); /* S'enfonce un peu */
    box-shadow: 0 2px 5px rgba(109, 139, 116, 0.3);
}

/* --- MESSAGES FLASH (NOTIFICATIONS) --- */
.flash-messages {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    width: 80%;
    max-width: 600px;
}

.alert {
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 50px; /* Très arrondi */
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-weight: bold;
    text-align: center;
    animation: slideDown 0.5s ease-out;
}

.alert-success {
    background-color: #D4EDDA; /* Vert clair */
    color: #155724; /* Vert foncé texte */
    border: 1px solid #C3E6CB;
}

/* AJOUT : Style SPÉCIFIQUE pour les ERREURS (Bien voyant) */
.alert-error {
    background-color: #ffe6e6; /* Fond rouge pâle OPAQUE */
    color: #cc0000;           /* Texte rouge vif */
    border: 1px solid #ffcccc;
    border-left: 8px solid #cc0000; /* Grosse barre rouge à gauche */
    
    /* On force l'affichage pour qu'il "pop" au dessus du reste */
    box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important; 
    z-index: 9999;
}

/* Optionnel : Style pour les avertissements (Jaune/Orange) */
.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-left: 8px solid #ffc107;
}

/* Petite animation d'apparition */
@keyframes slideDown {
    from { top: -50px; opacity: 0; }
    to { top: 0; opacity: 1; }
}

/* --- LISTE DE RÉSULTATS (Design Carte) --- */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Espace entre les lignes */
}

.result-row {
    display: flex;
    align-items: center;
    background-color: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    border: 1px solid #eee;
    transition: all 0.2s ease;
    text-decoration: none; /* Enlève le souligné des liens */
    color: inherit;
}

.result-row:hover {
    transform: translateY(-2px); /* Se soulève un peu */
    box-shadow: 0 5px 15px rgba(109, 139, 116, 0.15);
    border-color: var(--vert-header);
    background-color: #fafafa;
}

/* La bulle avec l'icône (Chien, Chat...) */
.species-badge {
    width: 45px;
    height: 45px;
    background-color: var(--beige-fond);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-right: 20px;
    flex-shrink: 0;
}

/* Les infos (Nom + Proprio) */
.patient-info {
    flex: 1; /* Prend toute la place disponible */
    display: flex;
    flex-direction: column;
}

.patient-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--texte-brun);
}

.owner-name {
    font-size: 14px;
    color: #888;
    margin-top: 2px;
}

/* La petite flèche à droite */
.action-arrow {
    color: var(--vert-header);
    font-weight: bold;
    font-size: 20px;
    opacity: 0.5;
    transition: 0.2s;
}

.result-row:hover .action-arrow {
    opacity: 1;
    transform: translateX(5px); /* La flèche bouge vers la droite */
}

/* --- FICHE PATIENT (CARTE DE VISITE) --- */
.patient-card-header {
    background-color: #FDFBF7; /* Beige très clair */
    border-radius: 15px;
    padding: 30px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    border: 1px solid #EBE7E0;
}

.patient-photo-placeholder {
    width: 120px;
    height: 120px;
    background-color: var(--beige-fond);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
}

.patient-details {
    flex: 1;
}

.age-badge {
    display: inline-block;
    background-color: var(--vert-header);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    margin-top: 5px;
}

/* HISTORIQUE */
.history-tabs {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.tab-header {
    background-color: var(--vert-header);
    color: white;
    padding: 15px 20px;
    font-weight: bold;
    letter-spacing: 1px;
}

.history-row {
    display: flex;
    border-bottom: 1px solid #eee;
    padding: 20px;
}

.history-row:last-child { border-bottom: none; }

.history-date {
    width: 120px;
    font-weight: bold;
    color: var(--texte-brun);
    border-right: 2px solid var(--beige-fond);
    margin-right: 20px;
}

.doc-link {
    display: block;
    padding: 10px;
    background: #f9f9f9;
    margin-bottom: 5px;
    border-radius: 5px;
    text-decoration: none;
    color: var(--texte-sombre);
    border: 1px solid #eee;
}
.doc-link:hover { background: #eee; }

/* --- SYSTÈME D'ONGLETS (TABS) --- */
.tabs-container {
    margin-top: 20px;
}

.tabs-header {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}

.tab-link {
    padding: 10px 20px;
    cursor: pointer;
    font-weight: bold;
    color: #888;
    border-bottom: 4px solid transparent;
    transition: 0.2s;
}

.tab-link:hover {
    color: var(--vert-header);
    background-color: #f9f9f9;
}

.tab-link.active {
    color: var(--vert-header);
    border-bottom: 4px solid var(--vert-header);
}

.tab-content {
    display: none; /* Caché par défaut */
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block; /* Affiché si actif */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tableaux dans les onglets */
.tab-table {
    width: 100%;
    border-collapse: collapse;
}
.tab-table th { text-align: left; padding: 10px; color: #888; border-bottom: 1px solid #eee; }
.tab-table td { padding: 12px 10px; border-bottom: 1px solid #eee; }
.tab-table tr:last-child td { border-bottom: none; }

/* --- INFO PATIENT VERTICALES --- */
.patient-info-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Espace entre chaque ligne */
}

.info-line {
    font-size: 16px;
    color: #555;
    display: flex;
    align-items: center;
}

.info-label {
    font-weight: bold;
    color: var(--vert-header); /* Le titre en vert */
    width: 100px; /* Largeur fixe pour que tout soit aligné */
    display: inline-block;
}

.age-tag {
    background-color: #E8F5E9; /* Vert très clair */
    color: var(--vert-fonce);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 10px;
}

/* --- PATIENTS DÉCÉDÉS (DANS LA RECHERCHE) --- */
.deceased-row {
    background-color: #f4f4f4 !important; /* Gris clair */
    border-left: 5px solid #555 !important; /* Bordure gris foncé (écrase le vert) */
    opacity: 0.7; /* Un peu transparent */
}

.deceased-row .species-badge {
    filter: grayscale(100%); /* L'emoji devient gris */
    opacity: 0.5;
}

.deceased-row .patient-name {
    text-decoration: line-through; /* Nom barré */
    color: #777;
}

.deceased-tag {
    font-size: 0.8em; 
    color: #333; 
    font-weight: bold; 
    margin-left: 5px;
    background: #ddd;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    text-decoration: none !important; /* Pas barré pour ce tag */
    display: inline-block;
}

/* --- AMÉLIORATION FICHE PATIENT --- */

/* 1. On donne plus de place à la colonne de droite */
.dashboard-grid {
    display: grid;
    /* AVANT: 2fr 1fr  -> APRÈS: 1.5fr 1fr (soit 60% / 40% environ) */
    grid-template-columns: 1.5fr 1fr; 
    gap: 30px;
}

/* 2. On range les boutons du haut proprement */
.patient-actions {
    display: flex;
    flex-direction: column; /* Les uns sous les autres */
    gap: 10px; /* Espace régulier */
    width: 200px; /* Largeur fixe pour qu'ils soient tous pareils */
    justify-content: center;
}

.patient-actions .btn-new {
    margin-top: 0 !important; /* On enlève les marges bizarres */
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

/* 3. Style pour les options d'alertes dans l'en-tête */
.alert-toggles-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ccc;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
    color: #666;
    background: white;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid #ddd;
    transition: 0.2s;
}

.toggle-label:hover {
    background: #f9f9f9;
    border-color: #bbb;
}

.toggle-label input {
    margin-right: 8px;
    transform: scale(1.2); /* Checkbox un peu plus grosse */
    cursor: pointer;
}

/* --- BOUTONS À COCHER (CHECKBOX STYLE TAG) --- */
/* On cache la vraie checkbox moche */
.custom-checkbox input[type="checkbox"], 
.custom-checkbox input[type="radio"] {
    display: none;
}

.custom-checkbox {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 8px;
}

/* Le design du label (ce qu'on voit) */
.custom-checkbox span {
    display: inline-block;
    padding: 8px 15px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 20px;
    color: #666;
    cursor: pointer;
    font-size: 0.9em;
    transition: 0.2s;
    user-select: none; /* Empêche de sélectionner le texte */
}

/* Quand on survole */
.custom-checkbox span:hover {
    border-color: var(--vert-header);
    background-color: #f9f9f9;
}

/* Quand c'est COCHÉ */
.custom-checkbox input:checked + span {
    background-color: var(--vert-header);
    color: white;
    border-color: var(--vert-header);
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(109, 139, 116, 0.4);
}

/* Variantes de couleurs pour les alertes */
.alert-danger input:checked + span {
    background-color: #C0392B; border-color: #C0392B;
}
.alert-stress input:checked + span {
    background-color: #E67E22; border-color: #E67E22;
}
.alert-deces input:checked + span {
    background-color: #333; border-color: #333;
}

/* Petits titres dans la fiche de vie */
.life-section-title {
    font-size: 0.85em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 8px;
    margin-top: 15px;
    font-weight: bold;
    letter-spacing: 1px;
}

/* --- BOUTONS ACTIONS CATALOGUE --- */
.btn-action {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: bold;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
}

/* Le bouton Modifier en Bleu doux */
.btn-edit {
    background-color: #3498db;
    color: white;
}
.btn-edit:hover {
    background-color: #2980b9;
}

/* Le bouton Poubelle en Rouge */
.btn-delete {
    background-color: #e74c3c;
    color: white;
    margin-left: 5px;
}
.btn-delete:hover {
    background-color: #c0392b;
}

/* --- Style spécial pour l'icône Paramètres (Version SVG Blanc) --- */
.nav-item-icon {
    padding: 0; /* On retire le padding du lien pour gérer la taille via flex */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 45px;
    width: 45px;
    border-radius: 50%;
    margin-left: 10px;
    transition: all 0.3s ease;
}

/* Style spécifique du dessin SVG */
.icon-svg {
    width: 28px;  /* Taille de l'icône */
    height: 28px;
    fill: var(--blanc); /* COULEUR BLANCHE FORCÉE */
    transition: transform 0.5s ease; /* Animation fluide de rotation */
}

/* Effet au survol : fond léger + rotation */
.nav-item-icon:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.nav-item-icon:hover .icon-svg {
    transform: rotate(90deg); /* Le rouage tourne ! */
}

/* Quand l'onglet est actif */
.nav-item-icon.active {
    background-color: var(--beige-fond-page);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.nav-item-icon.active .icon-svg {
    fill: var(--vert-header); /* Devient vert quand on est dessus, comme le texte */
}