/* Thème global et variables */
:root {
    --izyvet-color: #2a9193;
    --izyvet-hover-color: #216e6b;
    --izyvet-chatbtn-color: #33a8a4;
    --izyvet-light: #a8d5cc;
    --izyvet-dark: #1f6a6b;
    --gradient-bg: linear-gradient(135deg, #77b4b191 0%, #446d6a54 100%);
    --text-light: #f8f9fa;
    --text-dark: #343a40;
    --background-light: #ffffff;
    --background-dark: #f5f7fb;
    --danger-color: #e53e3e;
    --danger-hover: #c53030;
}

.text-izyvet { 
    color: #2a9193; 
    font-weight: 500;
}
.text-izyvet:hover {
    text-decoration: underline;
}

/* Styles de base */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: var(--background-dark);
    color: var(--text-dark);
}

#map {
    height: 100vh;
    width: 100vw;
    opacity: 0;
    transition: opacity 1s ease-in;
    z-index: 1;
}

#geolocation-status.disappear {
    /* Règle plus spécifique pour la disparition progressive */
    opacity: 0;
    transition: opacity 3s ease-in 1s;
    /* Transition de 3s après un délai de 1s */
}

.map-visible {
    opacity: 1 !important;
}

/* Header & Footer */
.map-header,
.map-footer {
    position: fixed;
    max-height: 40px;
    left: 0;
    width: 100%;
    background: var(--gradient-bg);
    backdrop-filter: blur(8px);
    color: var(--text-light);
    padding: 0.75rem 1.5rem;
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
}

.map-header {
    top: 0;
}

.map-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-footer {
    bottom: 0;
    justify-content: center;
    font-size: 0.875rem;
}

.leaflet-container {
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
    /* Gradient background for map */
}

/* Enhanced popup with less transparency */
.custom-popup .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    color: var(--text-dark);
    border-radius: 12px;
    border: 1px solid rgba(42, 145, 147, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: pulseGlow 1.5s infinite ease-in-out;
}

.custom-popup .leaflet-popup-content {
    margin: 15px 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    animation: fadeIn 0.3s ease-in;
    text-align: center;
}

.custom-popup .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.9);
}

/* Enhanced side panel with slide animation */
.side-panel {
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(12px);
}

.side-panel-hidden {
    transform: translateX(-100%);
}

.side-panel-enter {
    animation: fadeIn 0.6s ease-out;
}

/* Header panel class (refactored from inline Tailwind) */
.header-panel {
    position: absolute;
    top: 1rem;
    right: 0.5rem;
    width: 100%;
    max-width: 200px;
    padding: 0px;
    z-index: 999; /* Sous le header/footer */
    text-align: center;
    /* top: 5rem; Sous le header */
    animation: fadeIn 0.5s ease-in-out;
}

@media (min-width: 768px) {
    .header-panel {
        width: auto;
        /* md:w-auto */
    }
}

/* Logo styling */
.logo {
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    padding: 10px;
}

/* List items with hover animations */
.clinic-item {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    padding: 1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border: 1px solid rgba(42, 145, 147, 0.2);
    animation: fadeIn 0.5s ease-in-out;
}

.clinic-item:hover {
    box-shadow: 0 8px 25px rgba(42, 145, 147, 0.3);
    background: var(--izyvet-color);
    color: var(--text-light);
}

/* Button enhancements */
.chat-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: block;
    margin: 10px auto 0;
    margin-top: 0.75rem;
    padding: 0.6rem 1.2rem;
    background: var(--izyvet-chatbtn-color);
    border-radius: 0.5rem;
    color: white;
    font-weight: bold;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.chat-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.chat-btn:hover::after {
    width: 300px;
    height: 300px;
}

.chat-btn:hover {
    background: linear-gradient(to right, var(--izyvet-hover-color), var(--izyvet-dark));
}

/* Toggle button with rotation */
.toggle-panel-btn {
    transition: all 0.3s ease;
    background: var(--izyvet-color);
    backdrop-filter: blur(8px);
    border: 2px solid var(--izyvet-light);
    border-left: none;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    padding: 0.75rem;
    border-top-right-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
    z-index: 1001;
}

.toggle-panel-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 5px 15px rgba(42, 145, 147, 0.4);
    background: var(--izyvet-hover-color);
}

/* Geolocation status animation */
#geolocation-status {
    transition: all 0.3s ease;
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.8);
    color: var(--text-dark);
    padding: 5px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading spinner for initial load */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;    
    border-top-color: #3b82f6;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loader overlay */
#loader {
    position: fixed;
    inset: 0;
    background: var(--background-light);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    transition: opacity 1s ease-out;
}

#loader.fade-out {
    opacity: 0;
}

.loader-logo {
    width: auto;
    height: auto;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    50% {
        opacity: 0.5;
    }
}

/* Header flex container */
.header-flex {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

/* Side panel */
.side-panel {
    position: absolute;
    top: 40px;
    bottom: 40px;
    left: 0;
    height: auto;
    width: 20rem;
    background: rgba(255, 255, 255, 0.6);
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(42, 145, 147, 0.2);
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(12px);
}

/* Panel header */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

/* Clinics title */
.clinics-title {
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-dark);
}

/* Clinics scroll container */
.clinics-scroll {
    overflow-y: auto;
    flex-grow: 1;
    overflow-x: hidden;
}

/* Clinics list */
.clinics-list>*+* {
    margin-top: 0.75rem;
}

/* Panel footer */
.panel-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(42, 145, 147, 0.2);
}

/* Powered text */
.powered {
    font-size: 0.75rem;
    color: var(--izyvet-dark);
    text-align: center;
}

/* Clinic name */
.clinic-name {
    font-weight: bold;
    color: var(--izyvet-dark);
    display: flex;
    align-items: center;
}
.clinic-item:hover .clinic-name {
    font-weight: bold;
    color: #93c5fd;
    display: flex;
    align-items: center;
}

/* Clinic distance */
.clinic-distance {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}
.clinic-item:hover .clinic-distance {
    color: var(--izyvet-light);
}

/* Toggle icon */
.toggle-icon {
    color: var(--text-light);
    font-size: 1.25rem;
}

/* Chat header icon img */
.chat-header-icon img {
    height: 40px;
    width: 40px;
    border-radius: 50%;
}

/* Chat Modal Styles */
.chat-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-modal.active {
    display: flex;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-container.blurred {
    filter: blur(5px);
}

.chat-header {
    background: var(--izyvet-chatbtn-color);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-header-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.chat-header-info h1 {
    font-size: 20px;
    margin-bottom: 5px;
}

.chat-header-info p {
    font-size: 14px;
    opacity: 0.9;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--background-dark);
}

.message {
    display: flex;
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 18px;
    position: relative;
    color: #333;
}

.message.user .message-content {
    color: white;
}

.message.bot .message-content {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.user .message-content {
    background: var(--izyvet-chatbtn-color);
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 5px;
}

.message.bot .message-time {
    color: #666;
}

.message.user .message-time {
    color: #ffffff;
}

/* Updated Typing Indicator Styles */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #ccc;
    border-radius: 50%;
    animation: bounce 1.4s infinite both;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
    color: #000;
    background: #f0f2f5;
}

.chat-input:focus {
    border-color: var(--izyvet-color);
}

.send-button {
    min-width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    background: var(--izyvet-chatbtn-color);
    font-size: 24px;
    /* transform: rotate(-90deg); */
}

.send-button:hover {
    transform: scale(1.05);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 14px;
}

.session-info {
    font-size: 12px;
    color: #666;
    padding: 10px 20px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
}

.close-chat-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: auto;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 0; /* Ajout : supprime tout padding par défaut du bouton */
    margin: 0; /* Ajout : supprime toute marge */
    box-sizing: border-box; /* Ajout : assure que width/height incluent border/padding */
    /* Ensure vertical centering for text content */
    transition: background 0.3s;
}

/* Optionnel : pour un centrage encore plus précis, cible le contenu textuel */
.close-chat-btn::before {
    content: '×'; /* Remplace &times; par un pseudo-élément pour un meilleur contrôle */
    font-size: 24px;
    line-height: 1;
    transform: translateY(-2px);
}

.close-chat-btn:hover {
    background: rgba(255, 57, 57, 0.3);
}

/* Disclaimer Popup Styles */
.disclaimer-popup {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.disclaimer-box {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    max-width: 500px;
    text-align: center;
    color: #333;
    max-height: 80%;
    overflow-y: auto;
}

.disclaimer-box h2 {
    margin-bottom: 1rem;
    color: var(--izyvet-color);
}

.disclaimer-box p {
    margin-bottom: 1rem;
}

.disclaimer-box label {
    display: block;
    margin-bottom: 0.5rem;
    text-align: left;
    cursor: pointer;
}

.disclaimer-buttons {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

#disclaimer-ok,
#disclaimer-cancel {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
}

#disclaimer-ok {
    background: var(--izyvet-color);
    color: white;
}

#disclaimer-ok:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#disclaimer-cancel {
    background: #f3f4f6;
    color: #374151;
}

/* Confirmation Popup for closing chat */
.confirm-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2100;
    /* Above chat modal */
}

.confirm-box {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    max-width: 400px;
    text-align: center;
    color: #333;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease-in-out;
}

.confirm-box h2 {
    margin-bottom: 1rem;
    color: var(--danger-color);
    /* Red for warning */
}

.confirm-box p {
    margin-bottom: 1.5rem;
}

.confirm-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.confirm-buttons button {
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
    padding: 0.75rem 1.5rem;
}

#confirm-close-yes {
    background-color: var(--danger-color);
    /* Red */
    color: white;
}

#confirm-close-yes:hover {
    background-color: var(--danger-hover);
    /* Darker Red */
    transform: translateY(-2px);
}

#confirm-close-no {
    background-color: #f3f4f6;
    color: #374151;
}

#confirm-close-no:hover {
    background-color: #e5e7eb;
}

/* Custom text colors for popups */
.text-blue-300 {
    color: #93c5fd;
}

.text-gray-300 {
    color: #d1d5db;
}

/* Survey Popup Styles (nouveau) */
.survey-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3001; /* Au-dessus du loader */
    padding: 20px;
}

.survey-box {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    max-width: 500px;
    text-align: center;
    color: #333;
    max-height: 85%;
    overflow-y: auto;
    animation: fadeIn 0.5s ease-in-out 1s;
}

.survey-box h1 {
    margin-bottom: 1rem;
    color: var(--izyvet-color);
}

.survey-box p {
    margin-bottom: 1.5rem;
    color: #666;
}

.skip-button {
    width: 100%;
    padding: 0.75rem;
    background: #6b7280; /* Gris neutre */
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.skip-button:hover {
    background: #4b5563;
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: var(--izyvet-color);
    outline: none;
}

#survey-submit {
    width: 100%;
    padding: 1rem;
    background: var(--izyvet-chatbtn-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
    margin-top: 1rem;
}

#survey-submit:hover {
    transform: scale(1.02);
}

#survey-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#survey-error {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 14px;
}