using System;
using UnityEngine;
using TMPro;

[System.Serializable]
public class GeneralConfig
{
    [Header("Informations générales")]
    public string projectName;
    public string version;
    public string defaultMapId;
    public string mapsRegistryUrl;
    public string slug; // Slug du projet pour l'API
    public string defaultFontName = "Lato SDF"; // Police par défaut pour tous les textes
    
    [Header("Chemins des Assets")]
    public AssetsPathsConfig assetsPaths;
    
    [Header("Configuration Scène Intro")]
    public IntroSceneConfig introScene;
    
    [Header("Valeurs par Défaut")]
    public DefaultAssets defaultAssets;
    public ColorPalette colorPalette;
    public DefaultPopupConfig defaultPopupConfig;
    public DefaultHeaderConfig defaultHeaderConfig;
    public DefaultDialogueConfig defaultDialogueConfig; // Ajouté
    public DefaultFeedbackMessages defaultFeedbackMessages;
    public DefaultUIConfig defaultUIConfig;
    public DefaultResolution defaultResolution;
    public DefaultCrosshairConfig defaultCrosshairConfig;
    public DefaultGunConfig defaultGunConfig;
    public DefaultZoneDecorator defaultZoneDecorator;
    public AnimationTimings animations;
    public BottomTextPanelConfig bottomTextPanel;
    
    [Header("Configuration Debug")]
    public GeneralDebugConfig debug;
    
    [Header("Configuration UI")]
    public GeneralUIConfig ui;

    [Header("Configuration Scène Main")]
    public MainSceneEffectsConfig mainScene;
    
    [Header("Configuration Gameplay")]
    public GeneralGameplayConfig gameplay;
    
    [Header("Paramètres futurs")]
    public GeneralFutureSettingsConfig futureSettings;
    
    [Header("Configuration du panneau des paramètres")]
    public SettingsPanelConfig settingsPanelConfig;
    
    [Header("Configuration des jeux shooting")]
    public ShootingGameConfig shootingGame;
    
    [Header("Configuration des jeux trous")]
    public TrousGameApiConfig trousGame;
    
    [Header("Configuration UI des jeux trous")]
    public TrousGameUIConfig trousGameUI;
    
    [Header("URLs des APIs")]
    public ApiUrlsConfig apiUrls;
    
    [Header("URLs de configuration par défaut")]
    public DefaultConfigUrls defaultConfigUrls;
    
    [Header("Configuration des niveaux")]
    public LevelsConfigUrls levelsConfig;
    
    [Header("Configuration du panneau de connexion")]
    public ConnexionPanelConfig connexionPanel;
    
    [Header("Styles de boutons réutilisables")]
    public ButtonStylesDictionary buttonStyles;
    
    [Header("Styles de panneaux réutilisables")]
    public PanelStylesDictionary panelStyles;
    
    [Header("Configuration du panneau de prévisualisation de quête")]
    public QuestPreviewPanelConfig questPreviewPanel;
    
    [Header("Configuration de l'onglet Quêtes dans les paramètres")]
    public QuetesTabConfig quetesTabConfig;
    
    [Header("Configuration de l'onglet PARAMETRES")]
    public ParametresTabConfig parametresTabConfig;
    
    [Header("Configuration de l'onglet CLASSEMENT")]
    public ClassementTabConfig classementTabConfig;
    
    [Header("Configuration de l'onglet SCORES")]
    public ScoresTabConfig scoresTabConfig;
    
    [Header("Configuration des badges")]
    public BadgesConfig badges;
    
    // Référence directe aux cartes pour le nouveau système de positionnement absolu
    public QuestPreviewCardStyleConfig durationDifficultyCard { get { return questPreviewPanel?.durationDifficultyCard; } }
    public QuestPreviewCardStyleConfig formationsCard { get { return questPreviewPanel?.formationsCard; } }
}

[System.Serializable]
public class MainSceneEffectsConfig
{
    public MapPinPingEffectConfig mapPinPingEffect;
}

/// <summary>
/// Configuration de l'effet "ping" (anneau) autour des épinglettes de quêtes sur la scène Main.
/// </summary>
[System.Serializable]
public class MapPinPingEffectConfig
{
    public bool enabled = true;

    // Timing
    public float intervalSeconds = 0.5f;
    public float pingDurationSeconds = 0.35f;
    public Vector2 randomStartDelaySeconds = new Vector2(0f, 0.25f);

    // Look
    public float startScale = 1.0f;
    public float endScale = 1.25f;
    public float maxAlpha = 0.10f;
    public string color = "#FFFFFF";

    // Sprite runtime
    public int textureSize = 128;
    public float ringThicknessPx = 6f;
    public float softEdgePx = 3f;
}

[System.Serializable]
public class ShootingGameConfig
{
    public int minCorrectPercentage;
    public bool usePercentage;
    public string description;
}

[System.Serializable]
public class TrousGameApiConfig
{
    public int count;
    public string description;
}

[System.Serializable]
public class AssetsPathsConfig
{
    public string popupVideoPath;
    public string decoratorImagePath;
    public string videoPath;
    public string backgroundImagePath;
    public string backgroundVideoPath;
    public string uiPath;
    public string crosshairPath;
    public string gameAssetsPath;
    public string dialoguePath;
    public string questionsPath;
    public string mapsPath;
}

[System.Serializable]
public class GeneralDebugConfig
{
    public bool showDebugZones;
    public bool enableDebugLogs;
}

[System.Serializable]
public class GeneralUIConfig
{
    public float loadingDelay;
    public int crosshairSortingOrder;
    public int gunSortingOrder;
}

[System.Serializable]
public class GeneralGameplayConfig
{
    public bool enableDirectClick;
    public bool enableCrosshair;
}

[System.Serializable]
public class GeneralFutureSettingsConfig
{
    public string comment;
}

// ==========================================
// CLASSES POUR LES VALEURS PAR DÉFAUT
// ==========================================

[System.Serializable]
public class DefaultAssets
{
    public string ledOff;
    public string ledGreen;
    public string ledRed;
    public string impactEffect;
    public string defaultCrosshair;
    public string zoneDecorator;
    public string focusIndicator;
}

[System.Serializable]
public class ColorPalette
{
    public string primary;
    public string secondary;
    public string success;
    public string error;
    public string background;
    public string backgroundDark;
    public string text;
    public string textDark;
    public string transparent;
    public string semiTransparent;
    public string overlay;
}

[System.Serializable]
public class DefaultPopupConfig
{
    public int width;
    public int height;
    public string backgroundColor;
    public string borderColor;
    public int borderWidth;
    public string textPosition;
    public float textPaddingTop;
    public float textPaddingBottom;
    public float textPaddingLeft;
    public float textPaddingRight;
    public float textHeight;
    public float textFontSize;
    public string textColor;
    public string textBackgroundColor;
    public float textPaddingHorizontal;
    public float showDelay;
    public float fadeSpeed;
    public string buttonText;
    public float buttonBottomMargin;
    public string buttonStyle; // Style de bouton depuis buttonStyles (ex: "validationPurple")
}

[System.Serializable]
public class DefaultHeaderElement
{
    public string imageUrl;
    public Vector2 position;
    public Vector2 size;
    public bool clickable;
    public string targetAction;
}

[System.Serializable]
public class JaugePhasesConfig
{
    public string phase1;
    public string phase2;
    public string phase3;
}

[System.Serializable]
public class DefaultHeaderConfig
{
    public bool show;
    public float height;
    public string backgroundColor;
    public JaugePhasesConfig jaugePhases;
    public DefaultHeaderElement leftElement;
    public DefaultHeaderElement rightElement;
}

[System.Serializable]
public class DefaultDialogueConfig
{
    // Paramètres de texte
    public float dialogueTextSize;
    public string dialogueTextColor;
    public float speakerTextSize;
    public string speakerTextColor;
    public bool speakerTextBold;
    public float speakerMarginBottom;
    public string dialogueTextAlignment;
    public float backgroundDimming;
    
    // Mode cadre centré (nouveau layout)
    public bool useFrameMode;
    public float frameWidth;
    public float frameHeight;
    public float frameRadius;
    public float frameBottomMargin;
    public string frameBackgroundColor;
    public float framePaddingLeft;
    public float framePaddingRight;
    public float framePaddingTop;
    public float framePaddingBottom;
    
    // Padding intérieur du conteneur titre+sous-titre
    public float textContentPaddingLeft;
    public float textContentPaddingRight;
    public float textContentPaddingTop;
    public float textContentPaddingBottom;
    
    // Indicateur de continuation
    public bool showContinueIndicator;
    public string continueIndicatorColor;
    public float continueIndicatorSize;
    public float continueIndicatorBottomMargin;
    
    // Mode bandeau legacy
    public float bottomBarHeightRatio;
    public string bottomBarColor;
    public float paddingLeft;
    public float paddingRight;
    
    // Instructions
    public string instructionsText;
    
    // Position de l'image d'illustration
    public IllustrationPositionConfig illustrationPosition;
    // Nouvelle méthode de positionnement (relatif au panneau)
    public IllustrationOffsetFromPanelConfig illustrationOffsetFromPanel;

    // Apparence de l'illustration (avatar rond)
    // Diamètre unique (prioritaire si > 0)
    public float illustrationDiameter = 160f;
    // Ancien format (x/y) conservé pour rétro-compatibilité
    public IllustrationSizeConfig illustrationSize;
    public IllustrationBorderConfig illustrationBorder;
    public string illustrationBackgroundColor;
    public IllustrationGradientConfig illustrationBackgroundGradient;
}

[System.Serializable]
public class IllustrationPositionConfig
{
    public float x = 1465f;
    public float y = 670f;
}

[System.Serializable]
public class IllustrationOffsetFromPanelConfig
{
    public string _comment;
    public float offsetRight = 30f; // Distance depuis le bord droit du panneau
    public string _commentOffsetRight;
    public float offsetTop = -80f; // Distance depuis le haut du panneau (négatif = vers le bas)
    public string _commentOffsetTop;
}

[System.Serializable]
public class IllustrationSizeConfig
{
    // Taille en pixels (coordonnées référencées 1920x1080)
    public float x = 160f;
    public float y = 160f;
}

[System.Serializable]
public class IllustrationBorderConfig
{
    // Épaisseur en pixels
    public float width = 4f;
    // Couleur hex (ex: "#F4ECE5")
    public string color = "#F4ECE5";
}

[System.Serializable]
public class IllustrationGradientConfig
{
    // Dégradé vertical (haut -> bas)
    public string startColor = "#888ADE";
    public string endColor = "#3C415B";
}

[System.Serializable]
public class FeedbackPictoConfig
{
    public string goodAnswerUrl;
    public string badAnswerUrl;
    public Vector2 size;
    public Vector2 position;
    public bool show;
}

[System.Serializable]
public class FeedbackPanelShadowConfig
{
    public bool enabled;
    public string color;
    public float offsetX;
    public float offsetY;
    public float blur;
}

[System.Serializable]
public class FeedbackPanelStyleConfig
{
    public string backgroundColor;
    public float cornerRadius;
    public FeedbackPanelShadowConfig shadow;
}

[System.Serializable]
public class DefaultFeedbackMessages
{
    public float feedbackDisplayDelay = 0.5f; // Délai en secondes avant d'afficher le feedback
    public string correctAnswerMessage;
    public string incorrectAnswerMessage;
    public bool showResultMessage;
    public bool resultMessageInBold;
    public string resultMessageColor;
    public string incorrectMessageColor;
    public float resultMessageSize;
    public string resultMessageFont; // Police pour les messages (ex: "Anton SDF")
    public float resultMessagePositionY; // Position verticale du titre (depuis le haut du panel, en pixels)
    public float explanationTextPositionY; // Position verticale du texte d'explication (offset depuis le titre, en pixels)
    public string separator;
    public bool showSeparatorLine;
    public bool changeBackgroundColor;
    public bool useBackgroundImage;
    public string successBackgroundImageUrl;
    public string failureBackgroundImageUrl;
    public float backgroundImageAlpha;
    public bool stretchToFitPanel;
    public bool useCustomPanelSize;
    public Vector2 panelSize;
    public FeedbackPanelStyleConfig panelStyle; // Style visuel du panneau (fusionné depuis panelStyles)
    public FeedbackPictoConfig picto; // Configuration du picto de bonne/mauvaise réponse
    public string explanationTextColor;
    public float explanationTextSize;
    public string explanationTextFont; // Police pour le texte d'explication
    public bool explanationTextBold;
    public bool centerTextInPanel;
    public float explanationTextPaddingLeft;
    public float explanationTextPaddingRight;
    public string feedbackInstructionsText;
    public float feedbackInstructionsTextSize;
    public string feedbackInstructionsTextColor;

    // Libellés et style des boutons de feedback (shooting)
    public string feedbackNextButtonText;
    public string feedbackLastButtonText;
    public string feedbackButtonBackgroundColor;
    public string feedbackButtonStyle; // Nom du style de bouton à utiliser (ex: "validationPurple")
}

[System.Serializable]
public class BottomTextPanelConfig
{
    public string[] texts; // Liste des phrases à afficher aléatoirement
    public float width = 0.6f; // Largeur en pourcentage de l'écran (0.6 = 60%)
    public float alpha = 0.95f; // Opacité du panneau (0 = transparent, 1 = opaque)
    public string backgroundColor = "#f5ece5";
    public string textColor = "#7c6b63";
    public float fontSize = 32f;
    public float anchorMinY = 0.05f; // Position verticale minimale (0.05 = 5% depuis le bas)
    public float anchorMaxY = 0.15f; // Position verticale maximale (0.15 = 15% depuis le bas)
}

[System.Serializable]
public class DefaultUIBands
{
    public bool showBands;
    public float bandHeight;
    public string bandColor;
    public float bandAlpha;
    public int sortingOrder;
    public float cornerRadius = 20f;         // Coins arrondis du bandeau supérieur
    public float gameAreaCornerRadius = 20f; // Coins arrondis du cadre central (zone de jeu)
    public BandShadowConfig shadow;
}

[System.Serializable]
public class BandShadowConfig
{
    public bool enabled = false;
    public string color = "#00000040";
    public float offsetX = 0;
    public float offsetY = 8;
    public float blur = 16;
}


[System.Serializable]
public class ColorRGBA
{
    public float r;
    public float g;
    public float b;
    public float a = 1.0f;

    public Color ToColor()
    {
        return new Color(r, g, b, a);
    }
}

[System.Serializable]
public class DefaultLEDConfig
{
    public float ledSize;
    public float ledSpacing;
    public float marginLeft;
    public float verticalOffset;
    public bool useCustomSprites;
    public ColorRGBA defaultOffColor;
    public ColorRGBA defaultGreenColor;
    public ColorRGBA defaultRedColor;
    public bool enableLEDAnimation;
    public float animationSpeed;
    public string animationType;
}

public class DefaultQuestionDisplay
{
    public float fontSize;
    public string fontColor;
    public bool fontBold;
    public string alignment;
    public float marginTop;
    public float marginLeft;
    public float marginRight;
    public int sortingOrder;
    public bool useCustomPosition;
    public bool adaptToScreenSize;
    public float minFontSize;
    public float maxFontSize;
    public WordAnimationConfig wordAnimation;
}

[System.Serializable]
public class DefaultUIConfig
{
    public float hoverTextSize;
    public string hoverTextColor;
    public bool hoverTextBold;
    public DefaultHoverPanelSize hoverPanelSize;
    public string hoverBackgroundColor;
    public float hoverBackgroundAlpha;
    public bool useCustomPosition;
    public Vector2 customPosition;
    public bool useCenteredHoverPanel;
    // Paramètres spécifiques au panneau centré (shooting)
    public float centeredHoverPaddingX;
    public float centeredHoverPaddingY;
    public float centeredHoverAlpha;
    public DefaultUIBands bands;
    public DefaultLEDConfig ledConfig;
    public DefaultQuestionDisplay questionDisplay;
}

[System.Serializable]
public class DefaultHoverPanelSize
{
    public float width;
    public float height;
}

[System.Serializable]
public class DefaultResolution
{
    public int width;
    public int height;
}

[System.Serializable]
public class DefaultCrosshairConfig
{
    public float defaultSize;
    public float minSize;
    public float maxSize;
    public bool allowPlayerResize;
    public bool alwaysShowCrosshair;
    public float onTargetSizeMultiplier;
    public float offTargetSizeMultiplier;
    public float onTargetAlpha;
    public float offTargetAlpha;
    public float sizeTransitionSpeed;
    public float alphaTransitionSpeed;
    public bool smoothTransitions;
}

[System.Serializable]
public class DefaultGunBoundary
{
    public bool enableBoundaryConstraints;
    public bool useAutomaticMargins;
    public float marginLeft;
    public float marginRight;
    public float marginTop;
    public float marginBottom;
}

[System.Serializable]
public class DefaultGunConfig
{
    public Vector2 offsetFromCursor;
    public float size;
    public Vector2 gunSize;
    public bool flipHorizontally;
    public bool enableRotation;
    public float rotationOffset;
    public bool alwaysVisible;
    public float fadeSpeed;
    public bool hideDuringFeedback;
    public DefaultGunBoundary boundary;
}

[System.Serializable]
public class DefaultZoneDecorator
{
    public string imageUrl;
    public Vector2 size;
    public int sortingOrder;
}

[System.Serializable]
public class AnimationTimings
{
    public float fadeInDuration;
    public float fadeOutDuration;
    public float transitionDuration;
    public float quickTransition;
    public float loadingDelay;
}

[System.Serializable]
public class SettingsPanelConfig
{
    public Vector2 panelSize;
    public float cornerRadius;
    public string backgroundColor;
    public string darkBackgroundColor;
    
    public SettingsPanelHeaderConfig header;
    public SettingsPanelShadowConfig shadow;
    public SettingsPanelBorderConfig border;
    public SettingsPanelCloseButtonConfig closeButton;
    public SettingsPanelTabsConfig tabs;
    public SettingsPanelContentConfig content;
}

[System.Serializable]
public class SettingsPanelHeaderConfig
{
    public bool enabled = true;
    public float height;
    public string backgroundColor;
    public float cornerRadius;
}

[System.Serializable]
public class SettingsPanelShadowConfig
{
    public bool enabled;
    public string color;
    public float offsetX;
    public float offsetY;
    public float blur;
}

[System.Serializable]
public class SettingsPanelBorderConfig
{
    public bool enabled;
    public float width;
    public string color;
}

[System.Serializable]
public class SettingsPanelCloseButtonConfig
{
    public string imageUrl;
    public float size;
    public float marginRight;
}

[System.Serializable]
public class SettingsPanelTabsConfig
{
    public float spacing;
    public float marginLeft;
    public float marginRight;
    
    public SettingsPanelTabStateConfig normal;
    public SettingsPanelTabStateConfig selected;
    public SettingsPanelTabStateConfig hover;
}

[System.Serializable]
public class SettingsPanelTabStateConfig
{
    public string backgroundColor;
    public string textColor;
    public float fontSize;
    public string fontName;
    public string fontWeight;
    public float cornerRadius;
    public float paddingHorizontal;
    public float paddingVertical;
}

[System.Serializable]
public class SettingsPanelContentConfig
{
    public float padding;
    public string backgroundColor;
}

[System.Serializable]
public class ApiUrlsConfig
{
    public string baseUrl;
    public string questionsApi;
    public string gameAnswersApi; // Endpoint pour envoyer les réponses du joueur: /api/ujsa/games/{gameId}/answers
    public string gameAnswersResetApi; // Endpoint pour reset les réponses avant un jeu: /api/ujsa/games/{gameId}/answers/reset
    public string authPreconnect;
    public string authLogin;
    public string authVerifyToken;
    public string registrationUrl;
    public string forgotPasswordUrl;
}

[System.Serializable]
public class DefaultConfigUrls
{
    public string shootingGameConfig;
    public string calculatorGameConfig;
    public string levelsConfigUrl;
}

[System.Serializable]
public class LevelsConfigUrls
{
    public string urlRootJson;
    public string urlRootThumbnails;
}

[System.Serializable]
public class ConnexionPanelConfig
{
    public string panelStyle = "defaultPanel";
    public float width = 750;
    public float height = 450;
    public string title = "CONNEXION";
    public string titleColor = "#64477f";
    public float titleFontSize = 28;
    public string titleFontWeight = "bold";
    public string titleFontName = "Anton-Regular SDF";
    public float buttonsBottomMargin = 20;
    public float buttonsTopMargin = 320;
    public EmailInputConfig emailInput;
    public string seroniconnectText;
    public string connexionText;
    public string connexionTextColor = "#5a3d73";
    public float connexionTextFontSize = 30;
    public string connexionTextFontName = "Lato-Regular SDF";
    public float connexionTextTopMargin = 120;
    public ConnexionPanelButtons buttons;
    public PasswordStepConfig passwordStep;
}

[System.Serializable]
public class EmailInputConfig
{
    public float width = 600;
    public float height = 60;
    public string backgroundColor = "#FFFFFF";
    public float borderWidth = 1;
    public string borderColor = "#CCCCCC";
    public float borderRadius = 12;
    public string textColor = "#333333";
    public string placeholderColor = "#999999";
    public float fontSize = 24;
}

[System.Serializable]
public class PasswordStepConfig
{
    public string title = "MOT DE PASSE";
    public string message = "Nous avons retrouvé votre compte !";
    public string messageColor = "#49286a";
    public float messageFontSize = 26;
    public float messageTopMargin = 180;
    public float buttonsTopMargin = 320;
    public PasswordInputConfig passwordInput;
    public PasswordStepButtons buttons;
}

[System.Serializable]
public class PasswordInputConfig
{
    public float width = 500;
    public float height = 60;
    public string backgroundColor = "#FFFFFF";
    public float borderWidth = 1;
    public string borderColor = "#CCCCCC";
    public float borderRadius = 12;
    public string textColor = "#333333";
    public string placeholderColor = "#999999";
    public string placeholderText = "Entrez votre mot de passe";
    public float fontSize = 24;
    public bool showToggleButton = true;
    public string toggleButtonColor = "#64477f";
}

[System.Serializable]
public class PasswordStepButtons
{
    public ButtonReference submitButton;
    public ButtonReference forgotPasswordButton;
}

[System.Serializable]
public class ConnexionPanelButtons
{
    public ButtonReference continueButton;
    public ButtonReference seroniConnectButton;
}

[System.Serializable]
public class ButtonReference
{
    public string style;
    public string label;
    // Optionnel: permettre de surcharger certaines propriétés
    public float width = -1;
    public float height = -1;
}

// ==========================================
// CLASSES POUR LES STYLES DE BOUTONS
// ==========================================

[System.Serializable]
public class ButtonStylesDictionary
{
    public ButtonStyleConfig validationDefault;
    public ButtonStyleConfig exportBadgeButton;
    public ButtonStyleConfig cancelButtonDefault;
    public ButtonStyleConfig validationPurple;
    public ButtonStyleConfig validationBeige;
    public ButtonStyleConfig validationGold;
    public ButtonStyleConfig validationWarm;
    public ButtonStyleConfig primaryAction;
    public ButtonStyleConfig secondaryAction;
    
    /// <summary>
    /// Récupère un style de bouton par son nom
    /// </summary>
    public ButtonStyleConfig GetStyle(string styleName)
    {
        switch (styleName)
        {
            case "validationDefault": return validationDefault;
            case "exportBadgeButton": return exportBadgeButton;
            case "cancelButtonDefault": return cancelButtonDefault;
            case "validationPurple": return validationPurple;
            case "validationBeige": return validationBeige;
            case "validationGold": return validationGold;
            case "validationWarm": return validationWarm;
            case "primaryAction": return primaryAction;
            case "secondaryAction": return secondaryAction;
            default: return null;
        }
    }
}

[System.Serializable]
public class ButtonStyleConfig
{
    public float width = 400;
    public float height = 80;
    public float borderRadius = 40;
    public float borderWidth = 4;
    public string borderColor = "#f5ece5";
    public ButtonGradientConfig gradient;
    public ButtonShadowConfig shadow;
    public ButtonTextConfig text;
    public ButtonStateConfig hover;
    public ButtonStateConfig pressed;
}

[System.Serializable]
public class ButtonGradientConfig
{
    public bool enabled = true;
    public string startColor = "#b87aff";
    public string endColor = "#7b4fbf";
    public float angle = 90;
}

[System.Serializable]
public class ButtonShadowConfig
{
    public bool enabled = true;
    public string color = "#00000040";
    public float offsetX = 0;
    public float offsetY = 6;
    public float blur = 12;
}

[System.Serializable]
public class ButtonTextConfig
{
    public string color = "#FFFFFF";
    public float fontSize = 28;
    public string fontWeight = "bold";
    public string fontFamily = "Anton-Regular SDF";
    
    /// <summary>
    /// Convertit fontWeight en FontStyles pour TextMeshPro
    /// </summary>
    public FontStyles GetFontStyle()
    {
        if (string.IsNullOrEmpty(fontWeight))
            return FontStyles.Normal;
            
        switch (fontWeight.ToLower())
        {
            case "bold":
                return FontStyles.Bold;
            case "italic":
                return FontStyles.Italic;
            case "bold italic":
            case "bolditalic":
                return FontStyles.Bold | FontStyles.Italic;
            case "normal":
            default:
                return FontStyles.Normal;
        }
    }
}

[System.Serializable]
public class ButtonStateConfig
{
    public float brightnessMultiplier = 1.0f;
    public float scaleMultiplier = 1.0f;
}

// ==========================================
// CLASSES POUR LES STYLES DE PANNEAUX
// ==========================================

[System.Serializable]
public class PanelStylesDictionary
{
    public PanelStyleConfig defaultPanel;
    public PanelStyleConfig modalDark;
    public PanelStyleConfig cardBeige;
    public PanelStyleConfig alertPanel;
    public PanelStyleConfig informationPanel;
    // feedbackPanel a été fusionné dans defaultFeedbackMessages.panelStyle
    
    /// <summary>
    /// Récupère un style de panneau par son nom
    /// </summary>
    public PanelStyleConfig GetStyle(string styleName)
    {
        switch (styleName)
        {
            case "defaultPanel": return defaultPanel;
            case "modalDark": return modalDark;
            case "cardBeige": return cardBeige;
            case "alertPanel": return alertPanel;
            case "informationPanel": return informationPanel;
            // feedbackPanel n'est plus ici, il est dans defaultFeedbackMessages.panelStyle
            default: return null;
        }
    }
}

[System.Serializable]
public class PanelStyleConfig
{
    public string backgroundColor = "#f5ece5";
    public float cornerRadius = 30;
    public float width = 0; // 0 = non défini, utiliser la valeur par défaut
    public float height = 0; // 0 = non défini, utiliser la valeur par défaut
    public PanelOverlayConfig overlay;
    public PanelHeaderConfig header;
    public PanelShadowConfig shadow;
    public PanelBorderConfig border;
    public PanelContentConfig content;
    public AlertPanelButtonsConfig buttons;
}

[System.Serializable]
public class PanelOverlayConfig
{
    public bool enabled = true;
    public string color = "#000000";
    public float opacity = 0.5f;
}

[System.Serializable]
public class PanelHeaderConfig
{
    public bool enabled = true;
    public float height = 60;
    public string backgroundColor = "#dbc3b7";
    public float cornerRadius = 30;
    public string titleText = "";
    public float titleFontSize = 32;
    public string titleFontName = "Anton-Regular SDF";
    public string titleColor = "#64477f";
    public CloseButtonConfig closeButton;
}

[System.Serializable]
public class CloseButtonConfig
{
    public string imageUrl = "UI_fermer.png";
    public float size = 70;
    public float marginRight = 30;
}

[System.Serializable]
public class PanelContentConfig
{
    public float fontSize = 22;
    public string fontName = "Lato-Regular SDF";
    public string textColor = "#64477f";
}

[System.Serializable]
public class AlertPanelButtonsConfig
{
    public string confirmButtonStyle = "validationDefault";
    public string cancelButtonStyle = "secondaryAction";
}

[System.Serializable]
public class PanelShadowConfig
{
    public bool enabled = true;
    public string color = "#00000040";
    public float offsetX = 0;
    public float offsetY = 8;
    public float blur = 16;
}

[System.Serializable]
public class PanelBorderConfig
{
    public bool enabled = false;
    public float width = 0;
    public string color = "#00000000";
}

// ============================================
// Configuration du panneau de prévisualisation de quête
// ============================================

[System.Serializable]
public class QuestPreviewPanelConfig
{
    public Vector2 panelSize;
    public float cornerRadius = 25;
    public string backgroundColor = "#f5ece5";
    public string darkBackgroundColor = "#000000F2";
    
    public QuestPreviewHeaderConfig header;
    public QuestPreviewShadowConfig shadow;
    public QuestPreviewDescriptionConfig description;
    public QuestPreviewVideoConfig videoPlayer;
    public QuestPreviewCardStyleConfig durationDifficultyCard;
    public QuestPreviewCardStyleConfig formationsCard;
    public QuestPreviewInfoCardsConfig infoCards; // Garde les configs de texte, labels, etc.
    public QuestPreviewHelpLinkConfig helpLink;
    public QuestPreviewButtonsConfig buttons;
    public QuestPreviewSampleQuestsConfig sampleQuests;
}

[System.Serializable]
public class QuestPreviewHeaderConfig
{
    public float height = 80;
    public string backgroundColor = "#dbc3b7";
    public float cornerRadius = 25;
    public float iconSize = 60;
    public float iconMarginLeft = 20;
    public QuestPreviewTitleConfig title;
    public QuestPreviewCloseButtonConfig closeButton;
}

[System.Serializable]
public class QuestPreviewTitleConfig
{
    public float fontSize = 54;
    public string fontName = "Anton-Regular SDF";
    public string fontWeight = "normal";
    public string textColor = "#78675f";
    public float marginLeft = 15;
}

[System.Serializable]
public class QuestPreviewCloseButtonConfig
{
    public string imageUrl = "UI_fermer.png";
    public float size = 50;
    public float marginRight = 20;
}

[System.Serializable]
public class QuestPreviewShadowConfig
{
    public bool enabled = true;
    public string color = "#dbc3b780";
    public float offsetX = 0;
    public float offsetY = 8;
    public float blur = 16;
}

[System.Serializable]
public class QuestPreviewDescriptionConfig
{
    public float fontSize = 18;
    public string fontName = "Lato-Regular SDF";
    public string textColor = "#5a4a42";
    public float positionY = 150; // Position Y depuis le haut du panel
    public float marginHorizontal = 40;
    public float height = 60;
}

[System.Serializable]
public class QuestPreviewContentConfig
{
    public float marginTop = 20;
    public float marginHorizontal = 40;
    public float marginBottom = 20;
    public float spacing = 30;
}

[System.Serializable]
public class QuestPreviewVideoConfig
{
    public float cornerRadius = 15;
    public float x = 850; // Position X depuis le coin supérieur gauche du panel
    public float y = 280; // Position Y depuis le coin supérieur gauche du panel
    public float width = 765;
    public float height = 430;
}

[System.Serializable]
public class QuestPreviewInfoCardsConfig
{
    public float cornerRadius = 12;
    public string backgroundColor = "#ffffff";
    public string shadowColor = "#00000015";
    public float shadowOffsetY = 4;
    public float padding = 15;
    public float spacing = 15;
    
    // Configuration des cartes individuelles
    public QuestPreviewCardStyleConfig durationDifficultyCard;
    public QuestPreviewCardStyleConfig formationsCard;
    
    public QuestPreviewCardTextConfig cardTitle;
    public QuestPreviewCardTextConfig cardText;
    public QuestPreviewDurationConfig duration;
    public QuestPreviewDifficultyConfig difficulty;
    public QuestPreviewFormationsConfig formations;
}

[System.Serializable]
public class QuestPreviewCardStyleConfig
{
    public float x = 0; // Position X depuis le coin supérieur gauche du panel
    public float y = 0; // Position Y depuis le coin supérieur gauche du panel
    public float width = 400;
    public float height = 150;
    public string backgroundColor = "#ffffff";
    public float cornerRadius = 12;
    public string shadowColor = "#00000020";
    public float shadowOffsetY = 4;
    public float padding = 20;
}

[System.Serializable]
public class QuestPreviewCardTextConfig
{
    public float fontSize = 16;
    public string fontName = "Anton-Regular SDF";
    public string textColor = "#64477f";
}

[System.Serializable]
public class QuestPreviewDurationConfig
{
    public string label = "DURÉE";
    public string defaultValue = "2 H 00";
    public float x = 30;
    public float y = 20;
    public float labelMarginBottom = 5;
}

[System.Serializable]
public class QuestPreviewDifficultyConfig
{
    public string label = "NIVEAU DE DIFFICULTÉ";
    public string[] options = new string[] { "Débutant", "Intermédiaire", "Expert" };
    public float x = 150;
    public float y = 20;
    public float labelMarginBottom = 10;
    public float buttonFontSize = 18;
}

[System.Serializable]
public class QuestPreviewFormationsConfig
{
    public string label = "LES FORMATIONS ASSOCIÉES";
    public string bulletColor = "#a95bfb";
    public float fontSize = 22;
    public string textColor = "#5a4a42";
    public string linkColor = "#64477f";
    public bool underlineLinks = true;
    public float labelMarginBottom = 10;
    public float itemHeight = 30;
    public float itemSpacing = 5;
    public string[] items;
}

[System.Serializable]
public class QuestPreviewHelpLinkConfig
{
    public string text = "BESOIN D'AIDE ?";
    public string iconUrl = "UI_help_icon.png";
    public float iconSize = 20;
    public float fontSize = 14;
    public string fontName = "Lato-Bold SDF";
    public string textColor = "#64477f";
    public float x = 825; // Position X
    public float y = 730; // Position Y
    public float width = 200;
    public float height = 30;
}

[System.Serializable]
public class QuestPreviewButtonsConfig
{
    public float y = 795; // Position Y commune pour tous les boutons
    
    public QuestPreviewButtonConfig startQuest;
    public QuestPreviewButtonConfig skipQuest;
}

[System.Serializable]
public class QuestPreviewButtonConfig
{
    public string label;
    public string style = "validationPurple";
    public string disabledStyle = "secondaryAction";
    public float x = 0; // Position X du bouton
    public float width = 400;
    public float height = 80;
}

[System.Serializable]
public class QuestPreviewSampleQuestsConfig
{
    public QuestPreviewSampleQuest quest01;
}

[System.Serializable]
public class QuestPreviewSampleQuest
{
    public string iconUrl;
    public string title;
    public string description;
    public string duration;
    public string videoUrl;
    public string[] formations;
}

// ========== Configuration de l'onglet PARAMETRES dans les paramètres ==========

[System.Serializable]
public class ParametresTabConfig
{
    public ParametresTabLayoutConfig layout;
}

[System.Serializable]
public class ParametresTabLayoutConfig
{
    public float paddingLeft = 40;
    public float paddingRight = 40;
    public float paddingTop = 40;
    public float paddingBottom = 40;
    public float spacing = 30;
}

// ========== Configuration de l'onglet CLASSEMENT dans les paramètres ==========

[System.Serializable]
public class ClassementTabConfig
{
    public ClassementMainLayoutConfig mainLayout;
    public ClassementDetailsTabsMenuConfig detailsTabsMenu;
    public ClassementDetailsContentConfig detailsContent;
    public ClassementMonSuperBadgeSectionConfig monSuperBadgeSection;
    public ClassementRankingSectionConfig rankingSection; // Fusionné avec les nouvelles propriétés
    public ClassementTopSectionConfig topSection; // Conservé pour compatibilité
    public ClassementTabsSectionConfig tabsSection; // Conservé pour compatibilité
    public ClassementColorsConfig colors;
}

[System.Serializable]
public class ClassementDetailsTabsMenuConfig
{
    public float height = 80;
    public float paddingHorizontal = 20;
    public float paddingVertical = 15;
    public float tabSpacing = 15;
    public ClassementTabStyleConfig tabStyle;
}

[System.Serializable]
public class ClassementTabStyleConfig
{
    public float width = 180;
    public float height = 50;
    public float cornerRadius = 25;
    public float fontSize = 20;
    public string fontName = "Anton-Regular SDF";
    public string normalTextColor = "#78675f";
    public string selectedTextColor = "#ffffff";
    public string selectedBackgroundColor = "#a95bfb";
}

[System.Serializable]
public class ClassementDetailsContentConfig
{
    public float cornerRadius = 20;
    public string backgroundColor = "#e9d9cf";
    public bool shadowEnabled = true;
    public string shadowColor = "#dac1b3";
    public float shadowOffsetY = 8;
    public float padding = 20;
}

[System.Serializable]
public class ClassementMonSuperBadgeSectionConfig
{
    public float height = 280;
    public string backgroundColor = "#ede7e1";
    public PaddingConfig padding;
    public float columnSpacing = 30;
    public ClassementBadgeColumnConfig badgeColumn;
    public ClassementInfoColumnConfig infoColumn;
    public ClassementConfidentialityColumnConfig confidentialityColumn;
    public ClassementExportButtonConfig exportButton;
}

[System.Serializable]
public class ClassementBadgeColumnConfig
{
    public float width = 200;
    public float height = 220;
    public float imageWidth = 182;
    public float imageHeight = 210;
    public float scoreFontSize = 32;
    public string scoreColor = "#a95bfb";
    public BadgeScorePositionConfig scorePosition;
    public ClassementBadgeFrameConfig frame;
}

[System.Serializable]
public class ClassementBadgeFrameConfig
{
    public float width = 240;
    public float height = 220;
    public float offsetX = 0;
    public float offsetY = 0;
    public float cornerRadius = 20;
    public string backgroundColor = "#ede1d2";
}

[System.Serializable]
public class ClassementInfoColumnConfig
{
    public float width = 350;
    public float height = 220;
    public string backgroundColor = "#ede1d2";
    public float cornerRadius = 20;
    public PaddingConfig padding;
    public float lineSpacing = 12;
    public ClassementInfoTitleConfig title;
    public ClassementInfoSeparatorConfig separator;
    public ClassementInfoLineStyleConfig lineStyle;
}

[System.Serializable]
public class ClassementInfoTitleConfig
{
    public string text = "Classement";
    public float fontSize = 24;
    public string fontName = "Anton-Regular SDF";
    public string color = "#59504a";
    public float topMargin = 0;
}

[System.Serializable]
public class ClassementInfoSeparatorConfig
{
    public float width = 310;
    public float height = 2;
    public string color = "#b0a090";
}

[System.Serializable]
public class ClassementInfoLineStyleConfig
{
    public float iconSize = 20;
    public string iconBackgroundColor = "#a95bfb33";
    public float labelFontSize = 14;
    public string labelColor = "#59504a";
    public float valueFontSize = 14;
    public string valueColor = "#78675f";
    public float lineHeight = 20;
}

[System.Serializable]
public class ClassementConfidentialityColumnConfig
{
    public float width = 300;
    public float height = 220;
    public string backgroundColor = "#ede1d2";
    public float cornerRadius = 20;
    public PaddingConfig padding;
    public float spacing = 15;
    public ClassementConfidentialityTitleConfig title;
    public ClassementConfidentialityQuestionConfig question;
    public ClassementConfidentialityRadioButtonsConfig radioButtons;
}

[System.Serializable]
public class ClassementConfidentialityTitleConfig
{
    public string text = "Confidentialité";
    public float fontSize = 20;
    public string fontName = "Anton-Regular SDF";
    public string color = "#59504a";
    public float topMargin = 0;
}

[System.Serializable]
public class ClassementConfidentialityQuestionConfig
{
    public string text = "Souhaites-tu rendre ton super-badge public pour pouvoir te comparer aux autres joueurs ?";
    public float fontSize = 14;
    public string color = "#59504a";
    public float height = 60;
}

[System.Serializable]
public class ClassementConfidentialityRadioButtonsConfig
{
    public float spacing = 8;
    public float labelFontSize = 14;
    public float checkboxSize = 24;
    public ClassementRadioButtonsWeightsConfig optionWeights;
}

[System.Serializable]
public class ClassementRadioButtonsWeightsConfig
{
    public float prive = 1;
    public float entreprise = 1;
    public float publicOpt = 1;
}

[System.Serializable]
public class ClassementExportButtonConfig
{
    public float containerHeight = 120;
    public string buttonStyle = "validationDefault";
    public string buttonText = "EXPORTER MON SUPER BADGE";
}

[System.Serializable]
public class ClassementInfoBannerConfig
{
    public float height = 50;
    public string backgroundColor = "#a95bfb";
    public float cornerRadius = 10;
    public PaddingConfig padding;
    public string textColor = "#ffffff";
    public float fontSize = 16;
    public string fontName = "Lato-Bold SDF";
    public float marginBottom = 20;
    public ClassementInfoBannerTextTemplatesConfig textTemplates;
}

[System.Serializable]
public class ClassementInfoBannerTextTemplatesConfig
{
    public string global = "Classement général de tous les joueurs";
    public string company = "Classement au sein de {companyName}";
    public string top10 = "Top 10 des meilleurs joueurs";
}

[System.Serializable]
public class ClassementPlayerLineConfig
{
    public float height = 70;
    public string backgroundColor = "#f5ece5";
    public string highlightBackgroundColor = "#dbc3b7";
    public float cornerRadius = 12;
    public PaddingConfig padding;
    public float spacing = 15;
    public float marginBottom = 10;
    public ClassementPlayerLineRankConfig rank;
    public ClassementPlayerLineAvatarConfig avatar;
    public ClassementPlayerLineNameConfig name;
    public ClassementPlayerLineCompanyBadgeConfig companyBadge;
    public ClassementPlayerLineStatusDotConfig statusDot;
    public ClassementPlayerLineScoreConfig score;
}

[System.Serializable]
public class ClassementPlayerLineRankConfig
{
    public float width = 80;
    public float fontSize = 22;
    public string fontName = "Anton-Regular SDF";
    public string color = "#59504a";
}

[System.Serializable]
public class ClassementPlayerLineAvatarConfig
{
    public float size = 50;
    public float cornerRadius = 25;
    public float borderWidth = 2;
    public string borderColor = "#ffffff";
}

[System.Serializable]
public class ClassementPlayerLineNameConfig
{
    public float fontSize = 18;
    public string fontName = "Lato-Bold SDF";
    public string color = "#59504a";
}

[System.Serializable]
public class ClassementPlayerLineCompanyBadgeConfig
{
    public float height = 30;
    public float cornerRadius = 15;
    public string backgroundColor = "#e8d7cd";
    public PaddingConfig padding;
    public float fontSize = 14;
    public string fontName = "Lato-Regular SDF";
    public string color = "#59504a";
}

[System.Serializable]
public class ClassementPlayerLineStatusDotConfig
{
    public float size = 12;
    public ClassementPlayerLineStatusDotColorsConfig colors;
}

[System.Serializable]
public class ClassementPlayerLineStatusDotColorsConfig
{
    public string rank1_3 = "#FFD700";
    public string rank4_10 = "#C0C0C0";
    public string rank11_plus = "#CD7F32";
}

[System.Serializable]
public class ClassementPlayerLineScoreConfig
{
    public float fontSize = 20;
    public string fontName = "Anton-Regular SDF";
    public string color = "#a95bfb";
}

[System.Serializable]
public class ClassementMainLayoutConfig
{
    public float paddingLeft = 40;
    public float paddingRight = 40;
    public float paddingTop = 40;
    public float paddingBottom = 40;
    public float spacing = 30;
}

[System.Serializable]
public class ClassementTopSectionConfig
{
    public float height = 160;
    public PaddingConfig padding;
    public float spacing = 40;
    public string backgroundColor = "#ede7e1";
    public ClassementBadgeConfig badge;
    public ClassementConfidentialityConfig confidentiality;
}

[System.Serializable]
public class ClassementBadgeConfig
{
    public float width = 150;
    public float height = 180;
    public float cornerRadius = 20;
    public string backgroundColor = "#f5ece5";
    public float imageWidth = 110;
    public float imageHeight = 110;
    public float scoreFontSize = 24;
    public string scoreColor = "#a95bfb";
    public BadgeScorePositionConfig scorePosition;
}

[System.Serializable]
public class BadgeScorePositionConfig
{
    public string mode = "below"; // "below" ou "overlay"
    public float offsetX = 0;
    public float offsetY = 0;
}

[System.Serializable]
public class ClassementConfidentialityConfig
{
    public float width = 700;
    public float questionFontSize = 18;
    public string questionColor = "#59504a";
    public float checkboxSize = 58;
    public float spacing = 12;
    public float radioSpacing = 15;
    public float labelFontSize = 15;
}

[System.Serializable]
public class ClassementTabsSectionConfig
{
    public float height = 80;
    public float spacing = 20;
    public float tabWidth = 340;
    public float tabHeight = 70;
    public float tabCornerRadius = 35;
    public float tabFontSize = 26;
    public string activeColor = "#dbc3b7";
    public string inactiveColor = "transparent";
    public string activeTextColor = "#ffffff";
    public string inactiveTextColor = "#78675f";
}

[System.Serializable]
public class ClassementRankingSectionConfig
{
    // Anciennes propriétés (pour compatibilité avec l'ancien système horizontal)
    public float height = 240;
    public PaddingConfig padding;
    public float arrowSpacing = 10;
    public float arrowSize = 60;
    public int maxVisiblePlayers = 4;
    public float playerCardWidth = 220;
    public float playerCardHeight = 190;
    public float playerCardSpacing = 25;
    public float playerCardCornerRadius = 15;
    public ClassementPlayerBadgeConfig badge;
    
    // Nouvelles propriétés (pour le nouveau système vertical)
    public ClassementInfoBannerConfig infoBanner;
    public ClassementPlayerLineConfig playerLine;
}

[System.Serializable]
public class ClassementPlayerBadgeConfig
{
    public float width = 80;
    public float height = 80;
    public float rankFontSize = 28;
    public string rankColor = "#a95bfb";
    public float nameFontSize = 16;
    public float companyFontSize = 14;
    public string companyColor = "#7f726c";
}

[System.Serializable]
public class ClassementColorsConfig
{
    public string purple = "#a95bfb";
    public string beigeLigh = "#f5ece5";
    public string beigeDark = "#dbc3b7";
    public string textDark = "#78675f";
    public string background = "#e5ddd7";
}

// ==========================================
// CONFIGURATION ONGLET SCORES
// ==========================================

[System.Serializable]
public class ScoresTabConfig
{
    public ScoresLeftSectionConfig leftSection;
    public ScoresRightSectionConfig rightSection;
    public ScoresLayoutConfig layout;
    public ScoresColorsConfig colors;
}

[System.Serializable]
public class ScoresLeftSectionConfig
{
    public float width = 500;
    public float height = 600;
    public float cornerRadius = 20;
    public string backgroundColor;
    public PaddingConfig padding;
    public float spacing;
    public ScoresDDAConfig dda;
    public ScoresInfoTextConfig infoText;
}

[System.Serializable]
public class ScoresDDAConfig
{
    public string titleText;
    public float titleFontSize;
    public string titleColor;
    public string clockImageName;
    public float clockWidth = 80;
    public float clockHeight = 80;
    public float timeFontSize;
    public string timeTextColor;
    public string timeDefaultText;
    public TimePositionConfig timePosition;
    public float buttonWidth;
    public float buttonHeight;
    public string buttonText;
    public float buttonFontSize;
    public string buttonStyle;
    public float buttonMarginTop = 20;
}

[System.Serializable]
public class TimePositionConfig
{
    public float offsetX;
    public float offsetY;
}

[System.Serializable]
public class ScoresInfoTextConfig
{
    public float textWidth;
    public float textFontSize;
    public string textColor;
    public string linkColor;
    public string text;
    public float marginTop = 20;
}

[System.Serializable]
public class ScoresRightSectionConfig
{
    public float width = 1000;
    public float height = 800;
    public string backgroundColor;
    public PaddingConfig padding;
    public float spacing;
    public ScoresBadgesConfig badges;
    public ScoresSuperBadgeConfig superBadge;
}

[System.Serializable]
public class ScoresBadgesConfig
{
    public string titleText;
    public float titleFontSize;
    public string titleColor;
    public int maxVisibleBadges;
    public float arrowSize;
    public float arrowSpacing;
    public float containerWidth;
    public float containerHeight;
    public float cardWidth;
    public float cardHeight;
    public float cardSpacing;
    public float badgeWidth = 150;
    public float badgeHeight = 182;
    public float scoreBadgeSize;
    public string scoreBadgeColor;
    public float scoreFontSize;
    public float badgeTitleFontSize;
    public string badgeTitleColor;
    public float subtitleFontSize;
}

[System.Serializable]
public class ScoresSuperBadgeConfig
{
    public string titleText;
    public float titleFontSize;
    public string titleColor;
    public float containerWidth;
    public float containerHeight;
    public float badgeWidth = 250;
    public float badgeHeight = 250;
    public float scoreFontSize;
    public string scoreColor;
    public SuperBadgeScorePositionConfig scorePosition;
}

[System.Serializable]
public class SuperBadgeScorePositionConfig
{
    public string mode = "below"; // "below" ou "overlay"
    public float offsetX = 0;
    public float offsetY = 0;
}

[System.Serializable]
public class ScoresLayoutConfig
{
    public float mainSpacing;
    public PaddingConfig mainPadding;
}

[System.Serializable]
public class ScoresColorsConfig
{
    public string purple;
    public string beige;
    public string beigeLight;
    public string beigeDark;
    public string textDark;
    public string textLight;
    public string green;
    public string red;
    public string white;
}

[System.Serializable]
public class PaddingConfig
{
    public float left;
    public float right;
    public float top;
    public float bottom;
}

// ========== Configuration de l'onglet QUÊTES dans les paramètres ==========

[System.Serializable]
public class QuetesTabConfig
{
    public QuetesTabFontsConfig fonts;
    public QuetesTabQuestListBlockConfig questListBlock;
    public QuetesTabDetailsTabsMenuConfig detailsTabsMenu;
    public QuetesTabDetailsBlockConfig detailsBlock;
    public QuetesTabDetailsHeaderConfig detailsHeader;
    public QuetesTabDetailsContentConfig detailsContent;
    public QuetesTabCharacterMosaicConfig characterMosaic;
    public QuetesTabCharacterDetailConfig characterDetail;
}

[System.Serializable]
public class QuetesTabFontsConfig
{
    public string titleFontName = "Anton-Regular SDF";
    public string textFontName = "Lato-Regular SDF";
}

[System.Serializable]
public class QuetesTabQuestListBlockConfig
{
    public float x = 30; // Position X
    public float y = 30; // Position Y
    public float width = 620;
    public float height = 600;
    public float cornerRadius = 20;
    public string backgroundColor = "#ecdfd6";
    public bool shadowEnabled = true;
    public string shadowColor = "#dac1b3";
    public float shadowOffsetY = 8;
    public float padding = 20;
    public float itemSpacing = 15;
    public QuetesTabQuestItemStyleConfig itemStyle;
}

[System.Serializable]
public class QuetesTabQuestItemStyleConfig
{
    public float height = 120;
    public string normalBackgroundColor = "#f5ece5";
    public string hoverBackgroundColor = "#e8d4c0";
    public string selectedBackgroundColor = "#d9c0a8";
    public float cornerRadius = 12;
    public float paddingHorizontal = 15;
    public float paddingVertical = 12;
    public float titleFontSize = 22;
    public string titleColor = "#64477f";
    
    // Configuration pour les quêtes verrouillées (status == "locked")
    public QuetesTabLockedQuestConfig lockedStyle;
    public float descriptionFontSize = 18;
    public string descriptionColor = "#7c6b63";
}

[System.Serializable]
public class QuetesTabLockedQuestConfig
{
    public string backgroundColor = "#c0c0c0"; // Gris pour le fond
    public string titleColor = "#808080"; // Gris foncé pour le titre
    public string descriptionColor = "#a0a0a0"; // Gris moyen pour la description
    public string lockIconUrl = "cadenas.png"; // Nom du fichier PNG du cadenas
    public float lockIconSize = 24; // Taille du cadenas
    public float lockIconMarginLeft = 10; // Marge entre le titre et le cadenas
}

[System.Serializable]
public class QuetesTabDetailsTabsMenuConfig
{
    public float x = 680; // Position X
    public float y = 0; // Position Y
    public float width = 640;
    public float height = 80;
    public float paddingHorizontal = 20;
    public float paddingVertical = 15;
    public float tabSpacing = 15;
    public QuetesTabDetailTabStyleConfig tabStyle;
}

[System.Serializable]
public class QuetesTabDetailsBlockConfig
{
    public float x = 680; // Position X
    public float y = 30; // Position Y
    public float width = 650;
    public float height = 600;
    public float cornerRadius = 20;
    public string backgroundColor = "#ecdfd6";
    public bool shadowEnabled = true;
    public string shadowColor = "#dac1b3";
    public float shadowOffsetY = 8;
    public PlayButtonConfig playButton; // 🔧 NOUVEAU : Configuration du bouton JOUER
}

[System.Serializable]
public class PlayButtonConfig
{
    public float positionX = 180;
    public float positionY = 10;
}

[System.Serializable]
public class QuetesTabDetailsHeaderConfig
{
    public float height = 70;
    public float paddingHorizontal = 20;
    public float paddingVertical = 10;
    public float tabSpacing = 15;
    public QuetesTabDetailTabStyleConfig tabStyle;
}

[System.Serializable]
public class QuetesTabDetailTabStyleConfig
{
    public float width = 180;
    public float height = 50;
    public float cornerRadius = 25;
    public float fontSize = 20;
    public string normalTextColor = "#78675f";
    public string selectedTextColor = "#ffffff";
    public string selectedBackgroundColor = "#a95bfb";
}

[System.Serializable]
public class QuetesTabDetailsContentConfig
{
    public float padding = 20;
    public BadgeDisplayConfig badgeDisplay;
    public ResetBadgeButtonConfig resetBadgeButton;
    public FormationsDisplayConfig formationsDisplay;
}

[System.Serializable]
public class BadgeDisplayConfig
{
    public float topMargin = 10;
    public float badgeSize = 150;
    public float badgeSpacing = 30;
    public float badgeTitleSpacing = 30;
    public float badgeRatio = 1.1525f;
    public float titleHeight = 35;
    public float titleWidthMultiplier = 1.5f;
    public float titleFontSize = 20;
    public string titleColor = "#64477f";
    public string titleFontName = "Fonts/Lato-Bold SDF";
}

[System.Serializable]
public class ResetBadgeButtonConfig
{
    public float positionX = 0;
    public float positionY = 20;
}

[System.Serializable]
public class FormationsDisplayConfig
{
    public float imageWidth = 270;
    public float imageHeight = 360;
    public float spacing = 30;
    public float startX = 15;
    public float startY = -25;
    public float cornerRadius = 15;
    public float shadowOffsetX = 0;
    public float shadowOffsetY = 8;
    public string shadowColor = "#dbc3b7";
}

[System.Serializable]
public class QuetesTabCharacterMosaicConfig
{
    public float avatarSize = 120;
    public float avatarSpacing = 20;
    public float avatarCornerRadius = 20;
    public float avatarBorderWidth = 2;
    public string avatarBorderColor = "#dcd0c4";
    public string selectedBorderColor = "#a95bfb";
    public float selectedBorderWidth = 4;
    public int columns = 3;
    public float padding = 15;
    public float arrowSize = 40;
    public string arrowColor = "#a95bfb";
}

[System.Serializable]
public class QuetesTabCharacterDetailConfig
{
    public float height = 120;
    public string backgroundColor = "#ecdfd6";
    public float cornerRadius = 25;
    public float padding = 15;
    public float marginTop = 20;
    public QuetesTabCharacterNameLabelConfig nameLabel;
    public QuetesTabCharacterDescriptionConfig description;
}

[System.Serializable]
public class QuetesTabCharacterNameLabelConfig
{
    public float fontSize = 22;
    public string fontName = "Anton-Regular SDF";
    public string textColor = "#64477f";
    public string backgroundColor = "#a95bfb";
    public float paddingHorizontal = 20;
    public float paddingVertical = 8;
    public float cornerRadius = 15;
}

[System.Serializable]
public class QuetesTabCharacterDescriptionConfig
{
    public float fontSize = 16;
    public string fontName = "Lato-Regular SDF";
    public string textColor = "#5a4a42";
    public float marginTop = 10;
}

// ==========================================
// CONFIGURATION UI DES JEUX TROUS
// ==========================================

[System.Serializable]
public class TrousGameUIConfig
{
    public string _comment;
    public TrouButtonStyleConfig trouButton;
    public TrousSelectionPopupConfig selectionPopup;
    public TrousValidationButtonConfig validationButton;
}

[System.Serializable]
public class TrouButtonStyleConfig
{
    public string _comment;
    public float cornerRadius = 22f;
    public float fontSizeMultiplier = 0.85f;
    public string emptyText = "CHOISIR";
    public string emptyTextInput = "SAISIR";
    public float paddingHorizontal = 24f;
    public float paddingVertical = 8f;
    public float minWidth = 100f;
    public bool adaptWidthToOptions = true;
    
    // État vide (non rempli)
    public TrouButtonStateConfig emptyState;
    
    // État rempli
    public TrouButtonStateConfig filledState;
    
    // État validé correct
    public TrouButtonStateConfig correctState;
    
    // État validé incorrect
    public TrouButtonStateConfig incorrectState;
}

[System.Serializable]
public class TrouButtonStateConfig
{
    public string backgroundColor = "#f5ece5";
    public string textColor = "#64477f";
}

[System.Serializable]
public class TrousSelectionPopupConfig
{
    public string _comment;
    
    // Overlay
    public string overlayColor = "#00000080";
    
    // Panel principal
    public TrousPopupPanelConfig panel;
    
    // Header
    public TrousPopupHeaderConfig header;
    
    // Options (boutons de choix)
    public TrousPopupOptionConfig options;
    
    // Champ de saisie texte
    public TrousPopupTextInputConfig textInput;
}

[System.Serializable]
public class TrousPopupPanelConfig
{
    public float width = 480f;
    public float height = 420f;
    public float cornerRadius = 40f;
    public string backgroundColor = "#f5ece5";
    public float marginRight = 30f;
    public string _commentMarginRight;
    public TrousPopupShadowConfig shadow;
}

[System.Serializable]
public class TrousPopupShadowConfig
{
    public bool enabled = true;
    public string color = "#00000040";
    public float offsetX = 0f;
    public float offsetY = 8f;
}

[System.Serializable]
public class TrousPopupHeaderConfig
{
    public float height = 80f;
    public float cornerRadius = 40f;
    public string backgroundColor = "#dbc3b7";
    public string title = "Choisissez une réponse";
    public string titleTextInput = "Entrez votre réponse";
    public float titleFontSize = 28f;
    public string titleColor = "#49286a";
    public TrousPopupCloseButtonConfig closeButton;
}

[System.Serializable]
public class TrousPopupCloseButtonConfig
{
    public float size = 30f;
    public float marginRight = 15f;
    public string imageUrl = "UI_fermer.png";
    public bool useImage = true;
    // Fallback si pas d'image
    public string backgroundColor = "#FFFFFF4D";
    public string iconColor = "#49286a";
    public float iconFontSize = 24f;
}

[System.Serializable]
public class TrousPopupOptionConfig
{
    public float height = 50f;
    public float cornerRadius = 25f;
    public float spacing = 12f;
    public float fontSize = 22f;
    public float paddingHorizontal = 30f;
    public float paddingVertical = 30f;
    
    // État normal
    public string normalBackgroundColor = "#f5ece5";
    public string normalTextColor = "#64477f";
    
    // État survol
    public string hoverBackgroundColor = "#e8dcd4";
    
    // État pressé
    public string pressedBackgroundColor = "#a95bfb";
}

[System.Serializable]
public class TrousPopupTextInputConfig
{
    public float height = 60f;
    public float cornerRadius = 15f;
    public string backgroundColor = "#FFFFFF";
    public string borderColor = "#cc9442";
    public float borderWidth = 2f;
    public float fontSize = 22f;
    public string textColor = "#64477f";
    public string placeholderText = "Tapez votre réponse...";
    public string placeholderColor = "#99999999";
}

[System.Serializable]
public class TrousValidationButtonConfig
{
    public string _comment;
    public string buttonStyle = "validationDefault";
    public string text = "VALIDER";
    public float marginRight = 30f;
    public float marginBottom = 30f;
    
    // Couleurs quand inactif
    public string inactiveBackgroundColor = "#99999980";
    public string inactiveTextColor = "#CCCCCCB3";
}

[System.Serializable]
public class BadgesConfig
{
    public BadgesTitresConfig titres;
    public BadgesTextesConfig textes;
}

[System.Serializable]
public class BadgesTitresConfig
{
    public string Débutant;
    public string Intermédiaire;
    public string Expert;
    
    public string Get(string difficulty)
    {
        switch (difficulty)
        {
            case "Débutant": return Débutant ?? difficulty;
            case "Intermédiaire": return Intermédiaire ?? difficulty;
            case "Expert": return Expert ?? difficulty;
            default: return difficulty;
        }
    }
}

[System.Serializable]
public class BadgesTextesConfig
{
    public string Débutant;
    public string Intermédiaire;
    public string Expert;
    
    public string Get(string difficulty)
    {
        switch (difficulty)
        {
            case "Débutant": return Débutant ?? "";
            case "Intermédiaire": return Intermédiaire ?? "";
            case "Expert": return Expert ?? "";
            default: return "";
        }
    }
}

[System.Serializable]
public class IntroSceneConfig
{
    public string transitionVideoUrl;
    public bool transitionVideoSkipable = true;
    public bool transitionVideoAutoAdvance = true;
    public string skipButtonText = "PASSER";
}
