/* Conteneur global */
.preview-tool-container {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    font-family: sans-serif;
}

/* Badge petit */
.preview-tool-badge {
    background: #ff9800;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    vertical-align: middle;
    gap: 6px;
    margin-top: 60px;
    margin-right: 10px;
}

.preview-tool-badge span {
    display: inline-block;
    vertical-align: middle;
}

/* Panneau latéral grand */
/* Header du panneau latéral */
.preview-tool-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    cursor: pointer;
    line-height: 0.5;
}

.shortcut-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
}

/* Icône de fermeture du panneau */
.preview-tool-panel-close {
    cursor: pointer;
    font-size: 16px;
    color: #ff9800;
    transition: color 0.2s;
}
.preview-tool-panel-close:hover {
    color: #e67600;
}

.preview-tool-panel {
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #333;
    width: 300px;
    max-width: 80vw;
    height: 100vh;
    box-shadow: -2px 0 8px rgba(0,0,0,0.2);
    position: fixed;
    top: 0;
    right: 0;
    padding: 16px;
    box-sizing: border-box;
}

.preview-tool-panel.collapsed {
    transform: translateY(calc(100% - 40px));
    opacity: 0.6;
    pointer-events: auto;
}

.preview-tool-panel-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    border-top: 1px solid #666;
}

.preview-tool-panel-content::-webkit-scrollbar {
    width: 6px;
}

.preview-tool-panel-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.preview-tool-panel-toggle {
    cursor: pointer;
    font-size: 16px;
    color: #ff9800;
    transition: transform 0.2s;
}

.preview-tool-panel-toggle:hover {
    color: #e67600;
}

/* Conteneur de la liste de thèmes */
.preview-tool-themes {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Chaque thème dans la liste */
.preview-tool-theme {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.preview-tool-theme:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
}

/* Nom du thème */
.preview-tool-theme-name {
    font-weight: 500;
    min-width: 80px;
}

/* Palette de couleurs */
.preview-tool-theme-palette {
    display: flex;
    gap: 4px;
}

.preview-tool-theme-color {
    width: 24px;
    height: 24px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Accordéon */
.preview-tool-accordion {
    margin-top: 12px;
}

/* Header cliquable */
.preview-tool-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 6px;
    border-bottom: 1px solid #eee;
}

.preview-tool-accordion-header:hover {
    color: #ff9800;
}

/* Icône rotation */
.preview-tool-accordion-icon {
    transition: transform 0.2s;
}

/* Quand accordéon fermé */
.preview-tool-accordion.collapsed > :not(.preview-tool-accordion-header) {
    display: none;
}

.preview-tool-subaccordion {
    border: 1px solid #eee;
    border-radius: 6px;
    margin-top: 8px;
    overflow: hidden;
}

.preview-tool-subaccordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    font-size: 14px;
    background: #fafafa;
}

.preview-tool-subaccordion-header:hover {
    background: #f0f0f0;
}

.preview-tool-subaccordion-content {
    padding: 8px;
    font-size: 13px;
}

.preview-tool-subaccordion.collapsed .preview-tool-subaccordion-content {
    display: none;
}

.preview-tool-section-title {
    margin: 10px 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.preview-tool-section-separator {
    height: 1px;
    margin: 5px 0;
    background: linear-gradient(
        to right,
        transparent,
        rgba(0,0,0,0.3),
        transparent
    );
}

.preview-tool-setting {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.preview-tool-content-settings label, .preview-tool-setting label {
    font-size: 12px;
    color: #444;
}

.preview-tool-theme.active {
    border: 2px solid #ff9800;
    background: #fff3e0;
}

.preview-tool-theme.active .preview-tool-theme-name {
    font-weight: 600;
}

.preview-tool-actions {
    display: flex;
    gap: 14px;
    margin-bottom: 14px;
}

.preview-tool-action {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: color 0.2s;
}

.preview-tool-action i {
    font-size: 14px;
}

.preview-tool-action:hover {
    color: #ff9800;
}

.preview-tool-action.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.preview-tool-action.disabled:hover {
    color: #666;
}

/* Notification de confirmation */
.preview-tool-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #4caf50;
    color: #fff;
    padding: 14px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10000;
}

.preview-tool-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
}

.preview-tool-no-themes {
    padding: 12px;
    color: #999;
    font-style: italic;
    text-align: center;
}

/* Conteneur global */
.preview-tool-container {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    font-family: sans-serif;
}

/* Badge petit */
.preview-tool-badge {
    background: #ff9800;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 6px;

    /* centrage vertical */
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    right: 10px;
}

.preview-tool-content-settings {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
}

.preview-tool-input-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.preview-tool-input-wrapper input {
    width: 100%;
    box-sizing: border-box;
}

.preview-tool-content-settings input,
.preview-tool-content-settings textarea {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.preview-tool-content-settings textarea {
    resize: none;
    min-height: 70px;
}

.preview-tool-char-counter {
    display: flex;
    justify-content: flex-end;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.preview-tool-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-tool-color-preview {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}

.preview-tool-color-popover {
    background: #1e1e1e;
    padding: 10px;
    border-radius: 10px;
    z-index: 9999;
}

.preview-tool-setting {
    position: relative;
}

.preview-tool-reset-text {
    position: absolute;
    right: 0;
    top: 0;
    cursor: pointer;
    opacity: 0.5;
    transition: 0.2s;
    font-size: 13px;
}

.preview-tool-reset-text.disabled {
    opacity: 0.3;
}

.preview-tool-reset-text {
    transition: opacity 0.15s ease;
}

.preview-tool-reset-setting {
    position: absolute;
    right: 0;
    top: 0;
    cursor: pointer;
    opacity: 0.5;
    transition: 0.2s;
    font-size: 13px;
}

.preview-tool-reset-setting.disabled {
    opacity: 0.3;
}

.preview-tool-reset-setting {
    transition: opacity 0.15s ease;
}

.preview-tool-image-popover {
    background: #1f2937;
    border-radius: 10px;
    padding: 8px;
    width: auto;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    z-index: 9999;
}

.preview-tool-image-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 3px;
    cursor: pointer;
    border-radius: 6px;
}

.preview-tool-image-item:hover {
    background: rgba(255,255,255,0.08);
}

.preview-tool-image-item span {
    font-size: 13px;
    color: white;
}

.preview-logo-wrapper {
    width: 100%;
    height: auto;
    position: relative;
    display: inline-block;

    /* damier transparent */
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;

    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #1f2937;
}

.preview-logo {
    display: block;
    max-width: 100%;
    height: auto;
}

.preview-tool-image-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.preview-tool-image-thumb-wrapper {
    border-radius: 6px;
    overflow: hidden;
    position: relative;

    /* damier */
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);

    background-size: 6px 6px;
    background-position: 0 0, 0 3px, 3px -3px, -3px 0px;
    width: 200px;
}

.preview-tool-image-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.preview-tool-image-thumb-wrapper.active {
    background: rgba(255, 152, 0, 0.2);
    outline: 2px solid #ff9800;
}

.preview-tool-image-thumb-wrapper.active .preview-tool-image-thumb-wrapper {
    transform: scale(1.05);
}

/* Responsive mobile : plein écran */
@media (max-width: 768px) {

    .preview-tool-panel {
        width: 100vw;
        max-width: 100vw;
        height: 40vh;        /* hauteur réduite pour voir la galerie */
        bottom: 0;           /* positionné en bas */
        top: auto;           /* annule le top */
        border-top-left-radius: 12px;   /* optionnel pour un style plus joli */
        border-top-right-radius: 12px;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
    }

    /* Collapsed : juste le header visible */
    .preview-tool-panel.collapsed {
        transform: translateY(calc(100% - 50px)); /* laisse juste la partie header visible */
        opacity: 0.6;
        pointer-events: auto;
    }

    /* Toggle bouton éventuellement repositionné si besoin */
    .preview-tool-panel-toggle {
        font-size: 18px;
    }
}