:root {
    --color-primary: 29, 78, 216;
    /* Light Theme */
    --color-background-light: 243, 244, 246;
    --color-card-background-light: 255, 255, 255;
    --color-text-primary-light: 17, 24, 39;
    --color-text-secondary-light: 75, 85, 99;
    --color-border-light: 229, 231, 235;

    /* Dark Theme */
    --color-background-dark: 17, 24, 39;
    --color-card-background-dark: 31, 41, 55;
    --color-text-primary-dark: 243, 244, 246;
    --color-text-secondary-dark: 156, 163, 175;
    --color-border-dark: 55, 65, 81;

    /* High Contrast Theme */
    --color-background-hc: 0, 0, 0;
    --color-card-background-hc: 0, 0, 0;
    --color-text-primary-hc: 255, 255, 255;
    --color-text-secondary-hc: 200, 200, 200;
    --color-border-hc: 255, 255, 255;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

html.light body {
    background-color: rgb(var(--color-background-light));
    color: rgb(var(--color-text-primary-light));
}

html.dark body {
    background-color: rgb(var(--color-background-dark));
    color: rgb(var(--color-text-primary-dark));
}

html.high-contrast body {
    background-color: rgb(var(--color-background-hc));
    color: rgb(var(--color-text-primary-hc));
}

.app-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: var(--app-height, 100vh);
    max-width: 56rem;
    margin: auto;
    transition: background-color 0.3s;
}

html.light .app-shell {
    background-color: var(--color-card-background-light, white);
}

html.dark .app-shell {
    background-color: var(--color-card-background-dark, #1f2937);
}

html.high-contrast .app-shell {
    background-color: rgb(var(--color-card-background-hc));
}


/* General UI elements theming */
.themed-border {
    border-color: rgb(var(--color-border-light));
}

html.dark .themed-border {
    border-color: rgb(var(--color-border-dark));
}

html.high-contrast .themed-border {
    border-color: rgb(var(--color-border-hc));
}

.themed-bg-secondary {
    background-color: rgb(var(--color-background-light));
}

html.dark .themed-bg-secondary {
    background-color: rgb(var(--color-background-dark));
}

html.high-contrast .themed-bg-secondary {
    background-color: rgb(var(--color-background-hc));
    border: 1px solid white;
}

.themed-text-primary {
    color: rgb(var(--color-text-primary-light));
}

html.dark .themed-text-primary {
    color: rgb(var(--color-text-primary-dark));
}

html.high-contrast .themed-text-primary {
    color: rgb(var(--color-text-primary-hc));
}

.themed-text-secondary {
    color: rgb(var(--color-text-secondary-light));
}

html.dark .themed-text-secondary {
    color: rgb(var(--color-text-secondary-dark));
}

html.high-contrast .themed-text-secondary {
    color: rgb(var(--color-text-secondary-hc));
}

.text-value-highlight {
    color: rgb(var(--color-primary));
}

html.dark .text-value-highlight {
    color: #60a5fa;
}

html.high-contrast .text-value-highlight {
    color: #FFFF00;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Navigation Tabs */
.sim-nav-tab {
    flex: 1;
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

html.light .sim-nav-tab {
    color: #6b7280;
}

html.dark .sim-nav-tab {
    color: #9ca3af;
}

html.high-contrast .sim-nav-tab {
    color: #CCCCCC;
}

.sim-nav-tab.active {
    border-bottom-color: rgb(var(--color-primary));
    color: rgb(var(--color-primary));
}

html.dark .sim-nav-tab.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

html.high-contrast .sim-nav-tab.active {
    color: #FFFF00;
    border-bottom-color: #FFFF00;
}

/* Styles pour le bouton bascule */
.animated-toggle-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid transparent;
    height: 3.5rem;
    /* 56px */
}

.animated-toggle-button:hover {
    transform: scale(1.03);
}

.animated-toggle-button:active {
    transform: scale(0.98);
}

/* Conteneur de texte pour l'animation */
.button-text-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    /* semibold */
    font-size: 0.875rem;
    /* text-sm */
    letter-spacing: 0.025em;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    padding: 0 0.5rem;
    /* Ajout d'un padding pour les petits écrans */
}

.button-text-container.active {
    opacity: 1;
    transform: scale(1);
}

/* Classe pour l'état "OUI" (Actif) */
.btn-oui-style {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    /* Dégradé Bleu 600 -> 500 */
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3), 0 4px 6px -4px rgba(59, 130, 246, 0.2);
    /* Ombre bleue */
}

/* Classe pour l'état "NON" (Inactif) */
.btn-non-style {
    background: #ffffff;
    /* Fond blanc */
    color: #374151;
    /* Texte gris 700 */
    border-color: #d1d5db;
    /* Bordure grise 300 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    /* Ombre grise légère */
}

html.dark .btn-non-style {
    background: #374151;
    /* Fond gris 700 */
    color: #d1d5db;
    /* Texte gris 300 */
    border-color: #4b5563;
    /* Bordure grise 600 */
    box-shadow: none;
}

html.high-contrast .btn-non-style {
    background: #000;
    color: #FFF;
    border-color: #FFF;
}

html.high-contrast .btn-oui-style {
    background: #FFFF00;
    color: #000;
    border-color: #FFFF00;
}


/* Number input with +/- buttons */
.number-input-container {
    position: relative;
}

.number-input-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-size: 1.5rem;
    line-height: 1;
    padding-bottom: 2px;
}

.number-input-btn:focus {
    outline: none;
}

html.light .number-input-btn {
    background-color: #f3f4f6;
    color: #4b5563;
}

html.dark .number-input-btn {
    background-color: #374151;
    color: #d1d5db;
}

html.high-contrast .number-input-btn {
    background-color: #333333;
    color: #FFFFFF;
    border: 1px solid white;
}


/* Result card - NOUVEAU STYLE "PAYPAL" */
.result-card-content {
    background-color: rgb(var(--color-card-background-light));
    border: 1px solid rgb(var(--color-border-light));
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

html.dark .result-card-content {
    background-color: rgb(var(--color-card-background-dark));
    border-color: rgb(var(--color-border-dark));
}

html.high-contrast .result-card-content {
    background-color: rgb(var(--color-card-background-hc));
    border-color: rgb(var(--color-border-hc));
}

.result-card-content #animated-price {
    color: rgb(var(--color-text-primary-light));
}

html.dark .result-card-content #animated-price {
    color: rgb(var(--color-text-primary-dark));
}

html.high-contrast .result-card-content #animated-price {
    color: #FFFF00;
}


/* Style des boutons de la carte de résultat */
.result-action-btn {
    color: rgb(var(--color-primary));
    font-weight: 600;
    transition: opacity 0.2s;
}

.result-action-btn:hover {
    opacity: 0.7;
}

html.dark .result-action-btn {
    color: #60a5fa;
}

html.high-contrast .result-action-btn {
    color: #FFFF00;
    text-decoration: underline;
}

/* Accessibility Menu */
#accessibility-menu {
    position: absolute;
    top: 100%;
    right: 0;
    transform-origin: top right;
    transition: transform 0.2s, opacity 0.2s;
}

#accessibility-menu.hidden {
    transform: scale(0.95);
    opacity: 0;
    pointer-events: none;
}

/* Lefty mode */
body.lefty .bottom-bar-grid {
    flex-direction: row-reverse;
}

/* Modal Styles */
.modal-backdrop {
    transition: opacity 0.3s ease-out;
}

.modal-panel {
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

#hospital-modal.hidden .modal-backdrop,
#supplement-modal.hidden .modal-backdrop,
#summary-modal.hidden .modal-backdrop,
#info-modal.hidden .modal-backdrop,
#examples-modal.hidden .modal-backdrop {
    opacity: 0;
}

#hospital-modal.hidden .modal-panel,
#supplement-modal.hidden .modal-panel,
#summary-modal.hidden .modal-panel,
#info-modal.hidden .modal-panel,
#examples-modal.hidden .modal-panel {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
}

/* Style pour le textarea et inputs de la 3e modale */
.summary-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(var(--color-border-light));
    background-color: rgb(var(--color-card-background-light));
    color: rgb(var(--color-text-primary-light));
}

html.dark .summary-input {
    border-color: rgb(var(--color-border-dark));
    background-color: rgb(var(--color-background-dark));
    color: rgb(var(--color-text-primary-dark));
}

html.high-contrast .summary-input {
    border-color: rgb(var(--color-border-hc));
    background-color: rgb(var(--color-background-hc));
    color: rgb(var(--color-text-primary-hc));
}

#summary-textarea {
    font-family: monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    /* Ajout d'interligne */
    min-height: 150px;
    /* Augmentation de la hauteur */
}

#copy-to-clipboard-btn {
    background-color: rgb(var(--color-primary));
    color: white;
    transition: all 0.2s;
}

#copy-to-clipboard-btn.copied {
    background-color: #22c55e;
    /* green-500 */
}

/* Style pour l'icône d'aide */
.legend-icon {
    opacity: 0.5;
    margin-left: 0.25rem;
}

.form-legend {
    height: 40px;
}

html.dark .legend-icon {
    opacity: 0.4;
}

/* Animation et badge pour le supplément courte distance */
@keyframes pulseGlowBadge {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
        opacity: 1;
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 8px 2px rgba(16, 185, 129, 0.55);
        opacity: 0.9;
    }
}

.short-distance-badge {
    animation: pulseGlowBadge 2s ease-in-out infinite;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.1;
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #6ee7b7;
    transition: all 0.3s;
}

html.dark .short-distance-badge {
    background-color: rgba(6, 78, 59, 0.55);
    color: #6ee7b7;
    border-color: #047857;
}

html.high-contrast .short-distance-badge {
    background-color: #000;
    color: #FFFF00;
    border: 1px solid #FFFF00;
    animation: none;
}

