/* Base styles */
:root {
    --touch-target-size: 44px;
}

body {
    background-color: #1E1E1E;
    color: #FFFFFF;
    padding-top: 60px; /* Ajustez selon la hauteur de la barre de navigation */
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    -webkit-tap-highlight-color: rgba(76, 175, 80, 0.2);
}

/* Layout and spacing */
.container {
    max-width: 100%;
    padding: 0.5rem;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .container {
        max-width: 95%;
        padding: 1rem;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Card styling */
.card {
    background-color: #2D2D2D;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (min-width: 768px) {
    .card {
        margin-bottom: 1.5rem;
    }
}

.card {
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), 
                              rgba(76, 175, 80, 0.1) 0%,
                              transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.card:hover::before {
    opacity: 1;
}

.card-body {
    padding: 1rem;
}

@media (min-width: 768px) {
    .card-body {
        padding: 1.5rem;
    }
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-switch-checkbox {
    display: none;
}

.toggle-switch-label {
    display: inline-block;
    width: 50px;
    height: 26px;
    background-color: #ccc;
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-switch-switch {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch-checkbox:checked + .toggle-switch-label {
    background-color: #4CAF50;
}

.toggle-switch-checkbox:checked + .toggle-switch-label .toggle-switch-switch {
    left: calc(100% - 24px);
}

.toggle-switch-text {
    color: #FFFFFF;
    font-size: 0.9rem;
}

/* Form controls */
.form-control {
    background-color: #2D2D2D;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    padding: 0.75rem;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: var(--touch-target-size);
    font-size: 16px;
}

.form-control:focus {
    background-color: #2D2D2D;
    border-color: #4CAF50;
    box-shadow: 0 0 0 0.25rem rgba(76, 175, 80, 0.25);
    color: #FFFFFF;
}

/* Button groups and buttons */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .btn-group {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

.btn {
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: var(--touch-target-size);
    width: 100%;
    font-size: 16px;
    touch-action: manipulation;
}

@media (min-width: 768px) {
    .btn {
        width: auto;
    }
}

.btn-outline-secondary {
    color: #FFFFFF;
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #4CAF50;
    color: #4CAF50;
}

.btn-outline-secondary.active {
    background-color: #4CAF50;
    border-color: #4CAF50;
    color: #FFFFFF;
}

.btn-success {
    background-color: #4CAF50;
    border: none;
    color: #FFFFFF;
}

.btn-success:hover {
    background-color: #45a049;
    transform: translateY(-1px);
}

/* Tabs styling */
.nav-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

@media (min-width: 768px) {
    .nav-tabs {
        margin-bottom: 1.5rem;
        flex-wrap: wrap;
        overflow-x: visible;
    }
}

.nav-tabs .nav-link {
    color: #FFFFFF;
    border: none;
    padding: 1rem 1.5rem;
    transition: color 0.2s ease;
    min-height: var(--touch-target-size);
    white-space: nowrap;
}

.nav-tabs .nav-link:hover {
    border: none;
    color: #4CAF50;
}

.nav-tabs .nav-link.active {
    background-color: transparent;
    border: none;
    border-bottom: 2px solid #4CAF50;
    color: #4CAF50;
}

/* Section headings */
h5 {
    color: #FFFFFF;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Text utilities */
.text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Tag Container and Tags */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    min-height: 45px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    width: 100%;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #FFFFFF;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
    flex: 0 1 auto;
    min-width: fit-content;
    max-width: 100%;
    margin: 0.25rem;
}

.tag .tag-usage-count {
    font-size: 0.7rem;
    background-color: rgba(76, 175, 80, 0.2);
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.tag.frequently-used {
    background-color: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.4);
}

.tag.moderately-used {
    background-color: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.2);
}

.tag:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.tag.active {
    background-color: #4CAF50;
    border-color: #4CAF50;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.2);
}

.tag.frequently-used:hover {
    background-color: rgba(76, 175, 80, 0.25);
}

.tag.moderately-used:hover {
    background-color: rgba(76, 175, 80, 0.2);
}

.tag.frequently-used.active,
.tag.moderately-used.active {
    background-color: #4CAF50;
    border-color: #4CAF50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

@keyframes tagPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.tag.tag-appear {
    animation: tagAppear 0.3s ease-out, tagPulse 0.5s ease-in-out;
}

.tag i.tag-remove {
    font-size: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    cursor: pointer;
    padding: 2px;
}

.tag:hover i.tag-remove {
    opacity: 1;
}

.tag i.tag-remove:hover {
    color: #ff4444;
    transform: scale(1.1);
}

/* Add tag button styles */
.add-tag-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    flex: 0 0 32px;
    flex-shrink: 0;
    border-radius: 4px;
    background-color: rgba(76, 175, 80, 0.2); /* Added background color */
    border: none; /* Removed border */
    cursor: pointer; /* Added cursor style */
}

.add-tag-btn i {
    margin: 0;
    font-size: 1.2rem;
    color: white; /* Added icon color */
}


/* Add tag input styles */
.tag-input-container {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag-input-container.active {
    display: flex;
}

.tag-input {
    flex: 1;
    padding: 0.5rem;
    border-radius: 4px;
    background-color: #2D2D2D;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    font-size: 0.9rem;
}

.tag-input:focus {
    border-color: #4CAF50;
    outline: none;
}

.tag-input-buttons {
    display: flex;
    gap: 0.5rem;
}

.tag-input-buttons .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Animation pour l'ajout/suppression de tags */
@keyframes tagAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tag {
    animation: tagAppear 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animation pour la suppression des tags */
@keyframes tagRemove {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

.tag.removing {
    animation: tagRemove 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accordion styling */
.accordion-item {
    background-color: #2D2D2D;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.accordion-button {
    background-color: #2D2D2D;
    color: #FFFFFF;
    padding: 1rem;
    min-height: var(--touch-target-size);
}

@media (min-width: 768px) {
    .accordion-button {
        padding: 1rem 1.5rem;
    }
}

.accordion-button:not(.collapsed) {
    background-color: #2D2D2D;
    color: #4CAF50;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.1);
}

.accordion-button::after {
    filter: invert(1);
}

.accordion-body {
    padding: 1rem;
}

@media (min-width: 768px) {
    .accordion-body {
        padding: 1.5rem;
    }
}

/* History section styling */
#historyAccordion .accordion-item {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

#historyAccordion .accordion-button {
    padding: 0.75rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    color: #4CAF50;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

#historyAccordion .accordion-button:not(.collapsed) {
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#historyAccordion .accordion-button::after {
    transition: transform 0.3s ease;
    filter: invert(1);
}

#historyAccordion .accordion-collapse {
    border: none;
    transition: all 0.3s ease;
}

#historyAccordion .accordion-body {
    background-color: rgba(255, 255, 255, 0.02);
    padding: 1rem;
}

/* Appliquer le même style de hover que les sections options */
#historyAccordion .accordion-button:hover {
    background-color: rgba(255, 255, 255, 0.07);
}

#historyAccordion .accordion-button:not(.collapsed)::after {
    filter: invert(1) sepia(1) saturate(5) hue-rotate(70deg);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.animate-fade-in {
    animation: fadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-slide-in {
    animation: slideIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-value {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
    display: inline-block;
}

.stats-value.updating {
    animation: pulse 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #4CAF50;
}

/* Loading spinner */
.loading-spinner {
    position: relative;
    width: 24px;
    height: 24px;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Floating alert styling */
.floating-alert {
    position: fixed;
    bottom: 10px; /* Positionne l'alerte en bas */
    right: 10px; /* Positionne l'alerte à droite */
    z-index: 9999;
    max-width: 300px;
    opacity: 0.9;
    transition: opacity 0.3s ease-in-out;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    background-color: #4CAF50; /* Couleur de fond par défaut */
    color: #FFFFFF;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
    word-wrap: break-word;
}


.floating-alert:hover {
    opacity: 1;
}

/* Checkbox alignment fixes */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    margin-top: 0;
}

.form-check-label {
    margin-bottom: 0;
}

/* Custom button link for syntax rules */
.btn-link.syntax-toggle {
    padding: 0;
    margin-left: 0.25rem;
    display: inline-flex;
    align-items: center;
}

/* Navigation styles */
.navbar-container {
    background-color: #2D2D2D;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1000;
}

.navbar {
    background-color: #2D2D2D !important; /* Assure un fond opaque */
    padding: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Optionnel */
}

.navbar .container-fluid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    body {
        padding-top: 70px; /* Ajustez selon vos besoins */
    }
    .navbar .container-fluid {
        padding: 0.5rem;
    }
}


.navbar-brand {
    color: #FFFFFF;
    font-weight: 500;
    padding: 0.5rem 1rem;
    margin-right: 2rem;
    transition: color 0.3s ease;
}

.navbar-brand:hover {
    color: #4CAF50;
}

.navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0.75rem;
    color: #FFFFFF;
    transition: all 0.3s ease;
}

.navbar-toggler:focus {
    box-shadow: none;
    border-color: #4CAF50;
    transform: scale(1.05);
}


.navbar-collapse {
    display: none;
}

.navbar-collapse.collapsing {
    display: none;
}

.navbar-collapse.show {
    display: block;
}

.navbar-nav {
    gap: 0.5rem;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.nav-link {
    color: #FFFFFF;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: #4CAF50;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #4CAF50;
    transform: translateY(-1px);
}

.nav-link:hover::after {
    width: 80%;
}

.nav-link.active {
    background-color: #4CAF50;
    color: #FFFFFF;
    transform: translateY(0);
}

.nav-link.active::after {
    width: 0;
}

.nav-link i {
    font-size: 1rem;
    min-width: 1.2rem;
    transition: transform 0.3s ease;
}

.nav-link:hover i {
    transform: scale(1.1);
}

/* Content wrapper adjustments */
.content-wrapper {
    padding-top: 1rem;
    transition: padding-top 0.3s ease;
}

/* Mobile styles */
@media (max-width: 768px) {
    .navbar-collapse {
        background-color: #2D2D2D;
        padding: 0.75rem;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        transform-origin: top;
        transform: scaleY(0);
        transition: transform 0.1s ease-out;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
    }

    .navbar-collapse.collapsing {
        transform: scaleY(0);
    }

    .navbar-collapse.show {
        transform: scaleY(1);
    }

    .navbar-nav {
        gap: 0.15rem;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        opacity: 1;
        transition: transform 0.2s ease-out;
    }
}
/* Reformulation page specific styles */
.options-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .options-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

.options-section {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
}

.options-section h6 {
    margin-bottom: 1rem;
    color: #4CAF50;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.compact-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
}

.compact-btn-group .btn {
    flex: 1 0 calc(33.333% - 0.5rem);
    min-width: 140px;
    max-width: 200px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .compact-btn-group .btn {
        flex: 1 0 calc(50% - 0.25rem);
        min-width: 120px;
    }
}

/* Ajustements spécifiques pour les groupes de boutons */
#toneGroup.compact-btn-group .btn {
    flex: 1 0 calc(33.333% - 0.5rem);
}

#formatGroup.compact-btn-group .btn {
    flex: 1 0 calc(50% - 0.5rem);
}

#lengthGroup.compact-btn-group .btn {
    flex: 1 0 calc(33.333% - 0.5rem);
}

@media (max-width: 768px) {
    #lengthGroup.compact-btn-group .btn {
        flex: 1 0 100%;
        min-width: 100%;
        padding: 0.5rem;
        margin: 0.25rem 0;
    }
    
    #lengthGroup.compact-btn-group {
        width: 100%;
        display: flex;
        flex-direction: column;
    }
}

/* bouton coller depuis le presse papier "reformulé" */
.textarea-container {
    position: relative;
    width: 100%;
}

textarea.form-control {
    padding-right: 50px; /* Laisse de la place pour le bouton à droite */
}

.paste-button {
    position: absolute;
    top: 3px;
    right: 3px;
    z-index: 10;
    padding: 5px 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    border-radius: 8px;
    font-size: 14px;
    width: auto; /* S'assure que le bouton ne s'étire pas */
    white-space: nowrap; /* Empêche le texte de se déborder */
    transition: background-color 0.2s ease, transform 0.2s ease;
    min-width: 40px; /* Taille minimale pour éviter qu'il soit trop petit */
}

.paste-button:hover {
    background-color: #4CAF50;
    color: #FFFFFF;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .paste-button {
        right: 4px; /* Ajuste la position du bouton pour les écrans mobiles */
        top: 4px; /* Légèrement plus bas pour l'alignement */
        padding: 4px 8px; /* Réduit le padding pour un style compact */
        min-width: auto; /* Désactive la largeur minimale pour économiser de l'espace */
    }
}

.copy-button {
    position: absolute;
    top: 3px;
    right: 3px;
    z-index: 10;
    padding: 5px 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    border-radius: 8px;
    font-size: 14px;
    width: auto; /* S'assure que le bouton ne s'étire pas */
    white-space: nowrap; /* Empêche le texte de se déborder */
    transition: background-color 0.2s ease, transform 0.2s ease;
    min-width: 40px; /* Taille minimale pour éviter qu'il soit trop petit */
}

.copy-button:hover {
    background-color: #4CAF50;
    color: #FFFFFF;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .copy-button {
        right: 4px; /* Ajuste la position du bouton pour les écrans mobiles */
        top: 4px; /* Légèrement plus bas pour l'alignement */
        padding: 4px 8px; /* Réduit le padding pour un style compact */
        min-width: auto; /* Désactive la largeur minimale pour économiser de l'espace */
    }
}

/* Prevent horizontal scrolling */
.container,
.row,
.card,
.card-body,
.tab-content,
.tab-pane,
.options-grid,
.options-section,
.tag-container,
.accordion,
.accordion-body,
textarea,
.form-control {
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
    -webkit-overflow-scrolling: touch;
}

/* Ensure text areas and inputs handle long content properly */
textarea,
input[type="text"],
.form-control {
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Ensure buttons and tags wrap properly */
.btn-group,
.tag-container {
    flex-wrap: wrap;
}

/* Adjust tab navigation for touch devices */
.nav-tabs {
    flex-wrap: wrap !important;
    overflow-x: hidden !important;
}

/* Ensure proper touch handling for all interactive elements */
button,
.btn,
.nav-link,
.tag,
.accordion-button {
    touch-action: manipulation;
}

/* Ensure proper width constraints */
@media (max-width: 768px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .row {
        margin-left: -5px;
        margin-right: -5px;
    }
    
    .col-md-6 {
        padding-left: 5px;
        padding-right: 5px;
    }
}

/* Email tone tags collapsible styling */
.collapsible-tag-section {
    transition: all 0.3s ease;
    overflow: hidden;
    height: auto;
}

.collapsible-tag-section.collapsed {
    max-height: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
}

.collapsible-tag-section.expanded {
    max-height: none; /* Remplace la hauteur fixe par 'none' */
    height: auto;
    opacity: 1;
}

@media (max-width: 768px) {
    .collapsible-tag-section.expanded {
        height: auto !important; /* Force l'auto-hauteur sur mobile */
        max-height: none !important;
        overflow: visible;
    }

    #optionsSection {
        height: auto !important;
        max-height: none !important;
        overflow: visible;
        width: 100%;
        padding: 1rem;
        margin: 0;
        box-sizing: border-box;
    }
}

/* Email tone header button styling */
.tag-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 0;
}

.tag-section-header:hover h6 {
    color: #5bc460;
}

.tag-section-header .toggle-icon {
    transition: transform 0.3s ease;
}

.tag-section-header .toggle-icon.collapsed {
    transform: rotate(-90deg);
}

/* Email tone header button styling */
.tag-section-header .paste-button {
    position: relative;
    top: auto;
    right: auto;
    padding: 4px 8px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tag-section-header .paste-button i {
    margin: 0;
    font-size: 1.2rem;
}

/* Style ajusté pour le bouton d'ajout de tags dans le conteneur de tags */
.tag-container.position-relative .paste-button {
    position: absolute;
    top: 3px;
    right: 3px;
    z-index: 10;
    background-color: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.3);
}

.tag-container.position-relative .paste-button:hover {
    background-color: rgba(76, 175, 80, 0.3);
}

/* Ajustement de l'espacement pour éviter que le dernier tag ne soit caché par le bouton */
.tag-container.position-relative {
    padding-right: 45px;
}

/* Email tone section styling */
.tag-section-header {
    padding: 0.75rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px 8px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    border-radius: 8px;
    transition: border-radius 0.3s ease, background-color 0.3s ease;
}

/* Quand la section est dépliée */
.tag-section-header:has(+ .collapsible-tag-section.expanded) {
    border-radius: 8px 8px 0 0;
}

/* Quand la section est repliée */
.tag-section-header:has(+ .collapsible-tag-section.collapsed) {
    border-radius: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.collapsible-tag-section {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 8px 8px;
    padding: 1rem;
    transition: all 0.3s ease, border-radius 0.3s ease;
}

.collapsible-tag-section.expanded {
    border-radius: 0 0 8px 8px;
}

/* Support pour les navigateurs qui ne supportent pas :has */
@supports not (selector(:has(*))) {
    .tag-section-header {
        border-radius: 8px 8px 0 0;
    }
    
    .tag-section-header.all-corners {
        border-radius: 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

.add-tag-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.add-tag-btn:hover {
    background-color: rgba(76, 175, 80, 0.2);
    border-color: #4CAF50;
    transform: translateY(-1px);
}

.toggle-icon {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.toggle-icon:hover {
    color: #4CAF50;
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

/* Updated tag styling */
.tag {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.tag i:not(.tag-remove) {
    color: #4CAF50;
    font-size: 0.9rem;
}

.tag.active {
    background-color: rgba(76, 175, 80, 0.15);
    border-color: #4CAF50;
}

/* Ajustements pour la section Options */
#optionsHeader {
    margin-bottom: 0;
    cursor: pointer;
}

#optionsSection {
    padding: 1rem;
    margin-top: 0;
}

#optionsSection .form-check {
    margin-left: 0.5rem;
}

#optionsSection hr {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 1rem 0.5rem;
}

/* Button group */
.button-group {
    display: flex;
    gap: 3px;  /* Réduit l'espacement de 0.5rem à 3px */
}

.button-group .copy-button {
    position: static;
}

@media (max-width: 768px) {
    .options-grid {
        display: block; /* Change grid to block display */
    }

    .options-section {
        width: 100%;
        margin-bottom: 1rem;
    }

    #optionsSection {
        width: 100%;
        padding: 1rem;
        margin: 0;
        box-sizing: border-box;
    }

    /* Ensure the tag containers take full width */
    .tag-container {
        width: 100%;
        box-sizing: border-box;
        min-height: auto;
    }

    /* Adjust tag layout */
    .tag {
        margin: 0.25rem;
        flex: 0 1 auto;
        width: auto;
    }
}

@media (max-width: 768px) {
    .options-section {
        width: 100%;
    }
    
    .tag-container {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }

    .tag {
        flex: 0 1 auto;
        width: auto;
        min-width: fit-content;
    }
}

/* Language buttons styling */
.language-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.language-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    border-width: 1px;
    white-space: nowrap;
}

.language-btn:hover {
    transform: translateY(-1px);
    background-color: rgba(76, 175, 80, 0.1);
}

.language-btn.active {
    background-color: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

@media (max-width: 768px) {
    .language-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .language-btn {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

