/* Importation des polices Google */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&family=Montserrat:wght@300;400;700&family=Open+Sans:wght@300;400;700&family=Lato:wght@300;400;700&family=Poppins:wght@300;400;700&family=Raleway:wght@300;400;700&family=Oswald:wght@300;400;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&family=Merriweather:wght@300;400;700&family=Dancing+Script&family=Pacifico&family=Caveat&family=Indie+Flower&family=Bangers&family=Alfa+Slab+One&family=Lobster&family=Permanent+Marker&family=Bebas+Neue&display=swap');

/* Global styles */
:root {
    --primary-color: #3498db;
    --primary-color-dark: #2980b9;
    --secondary-color: #2ecc71;
    --accent-color: #e74c3c;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --background-color: #ecf0f1;
    --panel-bg: #ffffff;
    --border-color: #ddd;
    --hover-color: #f5f5f5;
    --active-color: #e5e5e5;
    --border-radius: 6px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
    --input-height: 40px;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    overflow: visible !important;
}

/* Accessibility - Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    padding: 8px;
    background-color: var(--primary-color);
    color: white;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
}

/* High contrast focus for keyboard users */
.js-focus-visible :focus:not(.focus-visible) {
    outline: none;
}

.js-focus-visible .focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

header {
    background: linear-gradient(to right, var(--primary-color), var(--primary-color-dark));
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 60px; /* Espace pour éviter l'empiètement sur le badge de version */
}

.header-logo {
    width: 45px;
    height: 45px;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.1) rotate(5deg);
}

.title-container {
    display: flex;
    flex-direction: column;
}

header h1 {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 700;
    text-shadow: 1px 2px 3px rgba(0, 0, 0, 0.3);
    background: linear-gradient(to right, #ffffff, #f0f0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
    font-family: 'Montserrat', sans-serif;
    line-height: 1.2;
}

.title-tagline {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

header .version-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--accent-color);
    color: white;
    padding: 3px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

header .generate-pdf-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

header .generate-pdf-button:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

header .generate-pdf-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

header .help-button {
    background-color: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

header .help-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(15deg);
}

main {
    max-width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Nouvelle mise en page à deux colonnes */
.app-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 25px;
    height: calc(100vh - 160px);
    overflow: hidden;
    overflow: visible !important;
}

/* Panneau latéral pour les contrôles */
.sidebar-panel {
    background-color: var(--panel-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow-y: auto;
    overflow-x: hidden; /* Empêcher le défilement horizontal */
    height: 100%;
    padding: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--hover-color);
    max-width: 100%; /* S'assurer que le panneau ne dépasse pas sa largeur */
}

.sidebar-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--primary-color);
    display: flex;
    align-items: flex-start; /* Aligner les icônes en haut pour le retour à la ligne */
    flex-wrap: wrap;
    word-break: break-word; /* Permettre aux mots longs de se couper */
    hyphens: auto; /* Activer la césure */
    line-height: 1.3;
}

.sidebar-panel h3 i {
    margin-right: 8px;
    min-width: 16px; /* Largeur minimale pour l'icône */
    text-align: center;
}

.sidebar-panel h4 {
    font-size: 1rem;
    margin-top: 12px;
    margin-bottom: 8px;
    color: var(--primary-color);
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.3;
}

.sidebar-panel h4 i {
    margin-right: 8px;
    min-width: 16px;
    text-align: center;
}

.sidebar-panel label {
    font-size: 0.9rem;
    margin-bottom: 6px;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.3;
}

.sidebar-panel .help-text {
    font-size: 0.85rem;
}

/* Tabs dans le panneau latéral */
.tabs {
    display: flex;
    flex-wrap: wrap; /* Permettre aux onglets de passer à la ligne */
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1px;
}

.tab {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transition: all var(--transition-speed);
    font-weight: 500;
    position: relative;
    margin-right: 2px;
    margin-bottom: 2px; /* Ajouter une marge en bas pour l'espacement quand les onglets passent à la ligne */
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    white-space: nowrap; /* Éviter que le texte des onglets ne se coupe */
}

.tab i {
    margin-right: 5px;
}

/* Zone de prévisualisation agrandie */
.preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--panel-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    overflow: hidden;
}

.preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    padding: 20px;
    background-color: #f0f2f5;
    border-radius: var(--border-radius);
    overflow: auto;
    overflow: visible !important;
}

.preview-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100%;
    padding: 20px;
    transition: transform 0.3s ease;
}

.label-preview {
    position: relative;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    overflow: hidden; /* Masque l'image de fond qui dépasse */
}

.label-preview[data-size="small"] {
    width: 240px;  /* 60mm × 4 */
    height: 240px; /* 60mm × 4 */
    min-width: 240px;
    min-height: 240px;
}

.label-preview[data-size="medium"] {
    width: 280px;  /* 70mm × 4 */
    height: 320px; /* 80mm × 4 */
    min-width: 280px;
    min-height: 320px;
}

.label-preview[data-size="large"] {
    width: 720px;  /* 180mm × 4 */
    height: 320px; /* 80mm × 4 */
    min-width: 720px;
    min-height: 320px;
}

.label-dimensions {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 3px;
    z-index: 100;
    pointer-events: none; /* Pour que les clics passent à travers */
    opacity: 0.8;
}

/* Styles pour les éléments sélectionnables */
.selectable-element {
    cursor: pointer;
    border: 1px dashed transparent;
    transition: border-color 0.2s ease;
}

.selectable-element:hover {
    border-color: rgba(0, 120, 215, 0.5);
}

.selectable-element.selected {
    border: 2px solid #0078d7;
    box-shadow: 0 0 5px rgba(0, 120, 215, 0.5);
}

/* Nouveau style pour le conteneur de texte */
.text-container {
    display: inline-block;
    padding: 2px;
    box-sizing: border-box;
}

.is-dragging {
    opacity: 0.8;
    z-index: 1000 !important;
}

.is-resizing {
    z-index: 1000 !important;
}

.resizable-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: transparent;
    border: none;
    bottom: -5px;
    right: -5px;
    cursor: nwse-resize;
    display: none;
}

.selectable-element.selected .resizable-handle {
    display: block;
}

/* Onglets */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transition: all var(--transition-speed);
    font-weight: 500;
    position: relative;
    margin-right: 4px;
}

.tab:hover {
    background-color: var(--hover-color);
}

.tab.active {
    background-color: var(--primary-color);
    color: white;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
}

/* Styles pour les boutons d'action */
.action-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.action-button {
    padding: 8px 16px;
    margin-right: 10px;
    margin-bottom: 10px;
}

.action-button.secondary {
    background-color: #95a5a6;
    color: white;
}

.action-button.secondary:hover {
    background-color: #7f8c8d;
}

.action-button.danger {
    background-color: var(--accent-color);
    color: white;
}

.action-button.danger:hover {
    background-color: #c0392b;
}

/* Styles pour les contrôles de style */
.style-controls {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.style-control {
    margin-bottom: 15px;
}

.style-control label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-color);
}

.range-with-value {
    display: flex;
    align-items: center;
}

.range-with-value input {
    flex-grow: 1;
    margin-right: 10px;
}

.range-with-value span {
    min-width: 40px;
    text-align: right;
    font-weight: 500;
}

/* Styles pour les éléments personnalisés */
.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

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

.custom-elements-list {
    margin-top: 15px;
}

.custom-element-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background-color: var(--bg-light);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.custom-element-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
}

.no-elements-message {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 10px;
}

/* Styles pour les boutons d'action */
.action-button {
    padding: 8px 12px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.1s;
}

.action-button.primary {
    background-color: var(--primary-color);
    color: white;
}

.action-button.secondary {
    background-color: var(--secondary-color);
    color: white;
}

.action-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-button:active {
    transform: translateY(1px);
}

/* Formulaires et contrôles */
.form-group {
    margin-bottom: 20px;
    max-width: 100%; /* S'assurer que les groupes de formulaire ne dépassent pas */
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-color);
    word-break: break-word;
    hyphens: auto;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: border var(--transition-speed);
    height: var(--input-height);
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

input[type="range"] {
    width: 100%;
    margin: 8px 0;
}

input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
}

input[type="color"]:hover {
    transform: scale(1.1);
}

/* Style pour les contrôles de style unifiés */
.style-controls {
    background-color: #f9f9f9;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.style-control-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.style-control-item {
    display: flex;
    flex-direction: column;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: 20px;
    font-size: 14px;
}

/* Responsive design */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 320px 1fr; /* Réduire davantage la largeur du menu */
    }
    
    .sidebar-panel {
        padding: 12px 10px; /* Réduire les marges horizontales */
    }
    
    .sidebar-panel h3 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .sidebar-panel h4 {
        font-size: 0.95rem;
        margin-top: 10px;
        margin-bottom: 6px;
    }
    
    .sidebar-panel label {
        font-size: 0.85rem;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .tab {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    input[type="text"],
    input[type="number"],
    textarea,
    select {
        padding: 8px 10px;
        font-size: 0.9rem;
        height: 34px;
    }
}

@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    
    .sidebar-panel, .preview-section {
        height: auto;
        max-height: none;
        overflow: visible;
    }
    
    .sidebar-panel {
        padding: 12px;
    }
}

@media (max-width: 768px) {
    .sidebar-panel {
        padding: 10px 8px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .form-group.half {
        width: 100%;
    }
    
    .style-control-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

@media (max-width: 600px) {
    main {
        padding: 0.5rem;
    }
    
    .sidebar-panel {
        padding: 8px 6px;
    }
    
    .style-control-group {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    .tab {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
    
    .sidebar-panel h3 {
        font-size: 0.95rem;
    }
    
    .sidebar-panel h4 {
        font-size: 0.9rem;
    }
    
    .sidebar-panel label {
        font-size: 0.8rem;
    }
    
    .help-text {
        font-size: 0.75rem;
    }
}

/* Loader */
.loader {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 1000;
}

.loader::after {
    content: "";
    width: 50px;
    height: 50px;
    border: 6px solid var(--border-color);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    cursor: help;
}

.tooltip-text {
    visibility: hidden;
    width: 200px;
    max-width: 90vw; /* Limiter la largeur sur les petits écrans */
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    font-weight: normal;
    pointer-events: none;
    word-break: break-word;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--primary-color) transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Bouton Générer PDF */
.generate-pdf-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 10px;
}

.generate-pdf-button.always-visible {
    margin-left: auto;
    margin-top: 0;
    margin-right: 10px;
}

.generate-pdf-button:hover {
    background-color: #c0392b;
}

/* Styles pour l'onglet Éléments */
.elements-list {
    margin-bottom: 20px;
}

.element-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: var(--hover-color);
    margin-bottom: 8px;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed);
}

.element-item:hover {
    background-color: var(--active-color);
}

.element-name {
    font-weight: 500;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--success-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--success-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Styles pour les éléments personnalisés */
.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

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

.custom-elements-list {
    margin-top: 15px;
}

.custom-element-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background-color: var(--bg-light);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.custom-element-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
}

.no-elements-message {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 10px;
}

/* Styles pour les boutons d'action */
.action-button {
    padding: 8px 12px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.1s;
}

.action-button.primary {
    background-color: var(--primary-color);
    color: white;
}

.action-button.secondary {
    background-color: var(--secondary-color);
    color: white;
}

.action-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-button:active {
    transform: translateY(1px);
}

/* Ajout d'info-bulles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Amélioration des messages d'aide */
.help-text {
    font-size: 13px;
    color: #7f8c8d;
    margin-top: 5px;
    display: block;
}

/* Amélioration du sélecteur de couleur */
.color-picker-container {
    position: relative;
    display: inline-block;
}

.color-picker-container input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
}

/* Amélioration des accordéons */
.accordion {
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.accordion-header {
    padding: 12px 15px;
    background-color: var(--hover-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.accordion-header:hover {
    background-color: var(--active-color);
}

.accordion-content {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background-color: white;
}

/* Améliorations pour les sections de paramètres */
.settings-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-section h3 {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    color: var(--primary-color);
}

.settings-section h3 i {
    margin-right: 8px;
    color: var(--secondary-color);
}

/* Améliorations pour les formulaires */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

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

.mt-4 {
    margin-top: 20px;
}

/* Styles pour l'input de fichier personnalisé */
.file-input-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-input-container input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.file-input-button {
    display: inline-block;
    padding: 10px 15px;
    background-color: var(--secondary-color);
    color: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-speed);
    text-align: center;
}

.file-input-button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.file-name {
    margin-top: 5px;
    font-size: 14px;
    color: #666;
}

/* Amélioration du sélecteur de couleur */
.color-picker-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-value {
    font-family: monospace;
    font-size: 14px;
    color: #666;
}

/* Styles pour les onglets */
.tab-content {
    display: block;
    padding: 20px 0;
}

/* Styles pour les messages d'aide */
.no-selection-message {
    background-color: #f8f9fa;
    border-left: 4px solid var(--secondary-color);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    color: #495057;
}

/* Styles pour les textarea */
textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: border var(--transition-speed);
    width: 100%;
}

textarea:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

/* Améliorations pour les sections d'éléments */
.elements-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.elements-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.elements-section h3 {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    color: var(--primary-color);
}

.elements-section h3 i {
    margin-right: 8px;
    color: var(--secondary-color);
}

/* Styles pour les éléments personnalisés */
.custom-elements-list {
    margin-top: 15px;
}

.element-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
}

.element-preview {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.element-actions {
    display: flex;
    gap: 8px;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
    color: var(--primary-color);
}

.icon-button:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
}

.icon-button.delete {
    color: var(--accent-color);
}

.icon-button.delete:hover {
    background-color: rgba(231, 76, 60, 0.1);
}

/* Amélioration des boutons d'action */
.action-button.primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.action-button.primary:hover {
    background-color: #1a2530;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.action-button.primary:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.action-button.primary i {
    font-size: 14px;
}

/* Amélioration des éléments de liste */
.elements-list {
    margin-bottom: 20px;
}

.element-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: var(--hover-color);
    margin-bottom: 8px;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed);
}

.element-item:hover {
    background-color: var(--active-color);
}

.element-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.element-name i {
    color: var(--secondary-color);
    width: 20px;
    text-align: center;
}

/* Responsive design pour les petits écrans */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .app-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .sidebar-panel, .preview-section {
        height: auto;
        max-height: 500px;
    }
}

/* Styles pour le conteneur de l'étiquette */
.label-container {
    width: 100%;
    height: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
}

/* Sections de l'étiquette */
.label-section {
    width: 100%;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.top-section {
    margin-bottom: 20px;
}

.middle-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 20px 0;
}

.bottom-section {
    margin-top: 20px;
}

/* Styles pour l'en-tête de prévisualisation avec contrôles de zoom */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zoom-controls .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zoom-controls .btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
}

.zoom-level {
    font-size: 14px;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
}

/* Styles pour le tutoriel */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tutorial-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.tutorial-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary-color);
    cursor: pointer;
    z-index: 10;
}

.tutorial-content {
    padding: 30px;
}

.tutorial-content h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.tutorial-step-content {
    margin-bottom: 30px;
    line-height: 1.6;
}

.tutorial-image {
    max-width: 100%;
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.tutorial-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.tutorial-nav-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tutorial-nav-btn:hover {
    background-color: #2980b9;
}

.tutorial-nav-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.tutorial-progress {
    display: flex;
    gap: 8px;
}

.tutorial-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ddd;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tutorial-dot.active {
    background-color: var(--secondary-color);
}

/* Style pour le bouton d'aide */
.help-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    margin-left: 10px;
}

.help-button:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

.help-button:active {
    transform: scale(0.95);
}

/* Empêcher le défilement lorsque le tutoriel est ouvert */
body.tutorial-open {
    overflow: hidden;
}

/* Modifier les styles pour permettre aux éléments textuels de déborder mais pas à l'image de fond */
.background-container {
    overflow: hidden !important;
}

.preview-container {
    overflow: visible !important;
}

.text-elements-container {
    overflow: visible !important;
}

.draggable:not(.background-image) {
    overflow: visible !important;
    z-index: 100 !important;
}

.label-preview {
    position: relative;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    overflow: hidden !important; /* Masque l'image de fond qui dépasse */
}

.draggable:not(.background-image) {
    z-index: 100 !important; /* S'assurer que les éléments textuels sont au-dessus */
}

.label-content-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none; /* Permet de cliquer à travers ce conteneur */
    z-index: 50;
}

.label-content-wrapper * {
    pointer-events: auto;
}

/* S'assurer que les éléments textuels sont au-dessus */
.draggable:not(.background-image) {
    z-index: 100 !important;
}

/* Styles de base pour la prévisualisation d'étiquette */
.label-preview {
    position: relative;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    overflow: hidden !important; /* Masque l'image de fond qui dépasse */
}

.label-preview[data-size="small"] {
    width: 240px;  /* 60mm × 4 */
    height: 240px; /* 60mm × 4 */
    min-width: 240px;
    min-height: 240px;
}

.label-preview[data-size="medium"] {
    width: 280px;  /* 70mm × 4 */
    height: 320px; /* 80mm × 4 */
    min-width: 280px;
    min-height: 320px;
}

.label-preview[data-size="large"] {
    width: 720px;  /* 180mm × 4 */
    height: 320px; /* 80mm × 4 */
    min-width: 720px;
    min-height: 320px;
}

/* Styles pour les conteneurs */
.preview-container {
    position: relative;
    overflow: visible !important; /* Permet aux éléments de déborder du conteneur */
}

/* Styles pour les éléments textuels */
.text-elements-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible !important; /* Permet aux éléments textuels de déborder */
    z-index: 50;
    pointer-events: none; /* Permet de cliquer à travers ce conteneur */
}

.text-elements-container * {
    pointer-events: auto; /* Rétablit les événements de pointeur pour les éléments à l'intérieur */
}

/* S'assurer que les éléments textuels sont au-dessus */
.draggable:not(.background-image) {
    z-index: 100 !important;
}

/* Styles pour l'image de fond */
.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Ne pas ajouter overflow: hidden ici car cela empêcherait le redimensionnement */
}

/* Masquer l'image de fond qui dépasse */
.label-preview {
    position: relative;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    overflow: hidden !important; /* Masque l'image de fond qui dépasse */
}
