:root{
    /* FONT SIZES */
    --font-size-xsmall-dangerous: 0.625rem;     /* 10px */
    --font-size-xsmall: 0.75rem;                /* 12px */
    --font-size-small: 0.875rem;                /* 14px */
    --font-size-normal: 1rem;                   /* 16px */
    --font-size-large: 1.125rem;                /* 18px */
    --font-size-xlarge: 1.5rem;                 /* 24px */
    --font-size-jumbo: 2.25rem;                 /* 36px */

    --font-size-xsmall-px: 12px;
    --font-size-small-px: 14px;
    --font-size-medium-px: 16px;
    --font-size-normal-px: 18px;
    --font-size-large-px: 22px;
    --font-size-xlarge-px: 28px;
    --font-size-xxlarge-px: 36px;
    --font-size-jumbo-px: 48px;
    --font-size-xjumbo-px: 72px;

    /* LINE HEIGHTS */
    --line-height-small: 1.1rem;
    --line-height-normal: 1.4rem;
    --line-height-large: 1.6rem;
    --line-height-xlarge: 1.8rem;
    --line-height-jumbo: 2.5rem;

    /* FONT WEIGHTS */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extra-bold: 800;

    /* BORDER RADII */
    --border-radius-sharp: 0;
    --border-radius-default: 0.375rem;          
    --border-radius-medium-px: 12px;
    --border-radius-rounded: 18px;
    --border-radius-pill: 9999px;
    --border-radius-circle: 50%;
    --border-radius-circle-small: 32px;

}

[data-theme="mydeen"] {
  /* === Couleurs primaires : Vert doux === */
  --color-primary-faded: #f0f5f2;     /* vert très pâle */
  --color-primary-faint: #c8d9d0;     /* vert clair désaturé */
  --color-primary-medium: #698f75;    /* couleur principale */
  --color-primary-deep: #4a6a58;      /* vert profond/gris */

  /* === Couleurs secondaires : Gris neutres === */
  --color-secondary-faded: #f9faf9;
  --color-secondary-faint: #e3e7e4;
  --color-secondary-medium: #c1c9c4;
  --color-secondary-deep: #8e9993;

  /* === Succès, erreur, avertissement === */
  --color-success-faded: #caebd8;
  --color-success-faint: #81b893;
  --color-success-medium: #99c0a4;
  --color-success-deep: #62776c;

  --color-error-faded: #fcecec;
  --color-error-faint: #f5a5a5;
  --color-error-medium: #e14c4c;
  --color-error-deep: #9f1e1e;

  --color-warning-faded: #fffbea;
  --color-warning-faint: #ffecab;
  --color-warning-medium: #e2b600;
  --color-warning-deep: #8a6d00;

  /* === Scrollbar : Vert/Gris doux === */
  --scrollbar-background: #f2f5f3;
  --scrollbar-thumb: #a4c2b1;
  --scrollbar-thumb-hover: #89ac98;
  --scrollbar-thumb-active: #5e7f6d;

  /* === Texte === */
  --color-text-default: #1e1e1e;
  --color-text-faded: #5f5f5f;
  --color-text-inverse: #ffffff;
  --color-text-link: #86648f;
  --color-success-faint-link: #993b99;
  --color-text-warning: #8a6d00;
  --color-text-error: #9f1e1e;
  --color-text-black: #000000;
  --color-text-white: #ffffff;
  --color-text-gray: #7c7c7c;

  /* === Fonds === */
  --color-background-default: #f2fff2;
  --color-background-elevated: #e5f5ec;
  --color-background-elevated-new: #e5f5ec;
  --color-background-alternative-faded: #e9f1eb;
  --color-background-alternative-faint: #cbe0d3;
  --color-background-alternative-medium: #b1cebe;
  --color-background-alternative-deep: #91ad9f;
  --color-background-inverse: #1e1e1e;
  --color-background-backdrop: rgba(0, 0, 0, 0.4);
  --color-background-lighten: rgba(255, 255, 255, 0.85);

  /* === Bordures & ombres === */
  --color-borders-hairline: #d8e1dc;
  --color-highlight: var(--color-primary-medium);
  --shadow-small: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-normal: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-large: 0 6px 12px rgba(0, 0, 0, 0.12);
  --shadow-xlarge: 0 8px 20px rgba(0, 0, 0, 0.14);
  --shadow-jumbo: 0 12px 32px rgba(0, 0, 0, 0.16);
  --shadow-hover: 0 16px 32px rgba(0, 0, 0, 0.18);
  --shadow-sticky: 0 8px 16px -8px rgba(0, 0, 0, 0.08);
  --shadow-strong: 0 0 8px rgba(0, 0, 0, 0.25);

  /* === Divers === */
  --background-image: #dce7e0;
  --color-svg-background: invert(0);
}

[data-theme=midnight-blue] {
    --color-primary-faded: #232f3e;
    --color-primary-faint: #2e3d4f;
    --color-primary-medium: #3d5268;
    --color-primary-deep: #1d2733;

    --color-secondary-faded: #2a353f;
    --color-secondary-faint: #3b4b5a;
    --color-secondary-medium: #4f6173;
    --color-secondary-deep: #1c252f;

    --color-success-faded:  #8ec59f;  /* crème vanille très doux */
    --color-success-faint:  #79a386;  /* jaune pastel chaud */
    --color-success-medium: #698f75;  /* doré doux, style miel clair */
    --color-success-deep:   #587461;
    
    --color-error-faded: #3a2a2a;
    --color-error-faint: #734747;
    --color-error-medium: #d65757;
    --color-error-deep: #912f2f;

    --scrollbar-background: #1f1f1f;        /* Fond discret, légèrement plus clair que le fond global */
    --scrollbar-thumb: #3a3a3a;             /* Gris neutre, visible mais sobre */
    --scrollbar-thumb-hover: #555555;       /* Un peu plus clair au survol */
    --scrollbar-thumb-active: #777777;      

    --color-text-default-new: #dbe0e6;
    --color-text-default: #e8ecf1;
    --color-text-faded: #97a1ae;
    --color-text-faded-new: #a0aab8;
    --color-text-inverse: #111821;
    --color-text-link: #6f977c;
    --color-success-faint-link: #29b37f;
    --color-text-warning: #f4c542;
    --color-text-error: #f16a6a;
    --color-text-black: #000;
    --color-text-white: #fff;
    --color-text-gray: #8e98a3;

    --color-background-default: #1c1f25;
    --color-background-elevated: #242931;
    --color-background-elevated-new: #232931;
    --color-background-alternative-faded: #222831;
    --color-background-alternative-faint: #2c333e;
    --color-background-alternative-medium: #303949;
    --color-background-alternative-deep: #13171d;
    --color-background-inverse: #f3f5f7;
    --color-background-backdrop: rgba(0, 0, 0, .65);
    --color-background-lighten: rgba(255, 255, 255, .025);

    --color-borders-hairline: #343c48;
    --color-highlight: #6c7685;

    --shadow-small: 0px 2px 4px rgba(0, 0, 0, 0.25);
    --shadow-normal: 0px 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0px 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-large: 0px 6px 18px rgba(0, 0, 0, 0.5);

    --background-image: #0c0c0c;
    --color-svg-background: invert(1);
}

@font-face {
    font-family: 'Tajawal';
    src: url("../fonts/Tajawal-Medium.ttf") format("truetype");
    font-display: swap;
}

@font-face {
    font-family: 'Cinzel';
    src: url("../fonts/Cinzel-Black.ttf");
    font-display: swap;
}

@font-face {
    font-family: 'Uthmani';
    src: url('../fonts/uthmani_hafs.ttf') format('truetype');
    font-display: swap
}

@font-face {
    font-family: 'Amir';
    src: url('../fonts/Amiri-Regular.ttf');
    font-display: swap
}

::-webkit-scrollbar {
    width: 0.8rem;
    background: none;
    z-index: 1000;  /* Augmentez le z-index de la scrollbar pour qu'il soit plus élevé */
}

/* Fond de la scrollbar */
::-webkit-scrollbar-track {
    background: none;
    z-index: 1000;
}

/* Poignée de la scrollbar */
::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
    z-index: 1000;
}

::-webkit-scrollbar-thumb:hover{
    cursor: pointer;
    background-color: var(--scrollbar-thumb-hover);
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--color-background-elevated-new); /* Couleur d'exemple */
    height: 2.4rem; /* Ajuste la hauteur selon tes besoins */
    margin-bottom: 0;
    z-index: 10000; /* Assure-toi que la top-bar soit au-dessus de tout le contenu */
    display: flex;
    justify-content: center; /* Cela centre les éléments horizontalement */
    align-items: center; /* Cela centre les éléments verticalement */
    transition: transform 0.5s ease, opacity 0.5s ease;
    border-bottom: 3px solid var(--color-background-alternative-medium);
}

.top-bar.hidden {
    transform: translateY(-100%);
    opacity: 0;
}

#homeButton {
    display: block ;
    border: none;
    background: transparent;
    position: absolute;  /* Fixe le bouton en haut à gauche */
    left: 1rem;
    top: 0.2rem;
    cursor: pointer;
    align-items: center;
    width: 24px;
    height: 24px;
    padding: 5px;
    justify-content: center;
    filter: var(--color-svg-background);
}

.tawhid {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    font-weight: bold;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: var(--color-text-default);
    font-family: 'Uthmani', serif;
    pointer-events: none;
}

.settings-container {
    position: absolute;
    display: flex;
    justify-content: center;
    flex-direction: row;
    align-items: center;
    position: absolute;
    top: 0.01rem;
    right: 2%;
    height: 100%;
}

.globe {
    display: inline-block;
    border-radius: 50%;
    margin: 0 0.2vh;
    padding: 0.2rem;
    font-weight: bold;
    height: 24px;
    width: 24px;
    font-size: 1.2rem;
    filter:var(--color-svg-background);
    cursor: pointer;
    align-items: center;
}

.globe:hover, .settings-fenetre img:hover,.settings-icon:hover, .close-settings:hover,#homeButton:hover {
    transform: scale(1.1);
    cursor: pointer;
}

.settings-icon {
    display: inline-block;
    border-radius: 50%;
    margin: 0 0.2vh;
    padding: 0.2rem;
    font-weight: bold;
    height: 24px;
    width: 24px;
    filter:var(--color-svg-background);
    cursor: pointer;
    align-items: center;
}

.langue{
    display: none;
    flex-direction: column;
    position: absolute;
    width: 200px;
    right: 4%;
    top: 5vh;
    background-color: var(--color-background-elevated-new);
    border-radius: 5px;
    z-index: 999; 
    transition: all 0.3s ease;
    box-shadow: var(--shadow-jumbo);
}

.langue-options{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    background-color: var(--color-background-elevated-new);
    border-radius: 5px;
}

.langue-option{
    display: flex;
    width: 100%;
    padding: 0.5vh 0;
    color: var(--color-text-default);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.nom-langue{
    margin: 0;
    font-size: var(--font-size-normal-px);
    padding: 0 2vh;
    font-family: 'Amir', serif;
}

.langue-option:hover {
    background-color: var(--color-background-alternative-faint);
}

.langue-option.active {
    font-weight: bold;
    color: var(--color-success-deep);
}


.settings-menu {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    width: 96%; /* Masqué par défaut */
    position: absolute;
    right: 0;
    top: 0;
    background-color: var(--color-background-elevated-new);
    border-radius: 5px;
    padding: 10px;
    padding-top: 0;
    box-shadow: var(--shadow-jumbo);
    z-index: 10000; /* Assure-toi que le menu soit au-dessus de tout le contenu */
    animation: slideInRight 1s ease forwards;
}



/* Définition de l'animation */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.settings-fenetre{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    height: 2.4rem;
    margin: 0;
}

.settings-fenetre p{
    font-size: 1.2rem;
    color: var(--color-text-default);
    margin: 0;
    padding: 0;
    font-weight: 400;
    text-align: center;
    font-family: 'Tajawal', sans-serif;
}

.settings-fenetre img{
    padding: 1vh;
    height: 24px;
    width: 24px;
    font-weight: bold;
    filter:var(--color-svg-background); 
}

.settings-fenetre::after{
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    top: 2.4rem;
    background-color: var(--color-background-alternative-deep);
    border-radius: 5px;
}

.theme {
    margin: 3vh 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.theme .theme-title{
    font-size: 1.2rem;
    width: 100%;
    color: var(--color-text-default);
    font-size: large;
    font-weight: bold;
    margin: 0;
    margin-bottom: 1vh;
    padding: 0;
    text-align: left ;
    font-family: 'Tajawal', sans-serif;
}

.theme .theme-options{
    background-color: var(--color-background-alternative-medium);
    display: flex;
    flex-direction: row;
    padding: 0.5vh 0;
    border-radius: 50rem;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.theme img{
    filter:var(--color-svg-background); 
    height: 24px;
    width: 24px;
    padding: 0 4vh;
    margin: 0 1vh;
}

.theme img:not(:first-child)::after{
    border-left: 0.2rem solid var(--color-background-elevated);
}

.theme img:hover{
    cursor: pointer;
}

.theme img.active{
    background: var(--color-success-medium);
    border-radius: 50rem;
}


#contentContainer {
    position: relative;
    margin-top: 2.4rem; 
    padding: 0 !important; 
    min-height: 100%;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;  /* Active la barre de défilement native */
    overflow-x: hidden;
}

body ::selection {
    background: var(--color-success-deep);
}

body {
    min-height: 100vh;
    padding: 0 !important;
    overscroll-behavior-y: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Tajawal', sans-serif;
    margin: 0;
    padding: 0;
    color: var(--color-text-default);
    background-color: var(--color-background-elevated-new);
    transition: background 0.3s, color 0.3s;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

body {
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    overflow-x: hidden;
    min-height: 100vh;
}

header {
    display: flex;
    flex-direction: column;
    position: relative;
    align-items: center;
    justify-content: center; /* Centrage vertical du contenu */
    width: 100%;
    height: 13rem;
    padding: 1rem 0;
    background: var(--background-image) ; /* Défini dans :root ou inline */
    background-size: cover;          /* Couvre tout le header */
    background-position: center;     /* Centre l’image */
    background-repeat: no-repeat;    /* Évite la répétition */
    color: var(--color-text-default);
    text-align: center;
}


header h1 {
    position: relative;
    font-family: 'Cinzel', serif;
    font-size: 3.5rem;
    margin: 0;
    padding: 0 2rem;
    text-align: center;
    font-weight: bold;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    transition: color 0.3s ease, transform 0.3s ease;
}


header h3{
    font-size: var(--font-size-medium-px);
}

header::after {
    content: '';
    position: absolute;
    left: 10%;
    width: 80%;
    height: 0.5vh;
    bottom: -20px;
    background-color: var(--color-background-alternative-deep);
    margin-bottom: 20px;
    border-radius: 5px;
}

/* Media queries pour responsive */

@media (max-width: 900px) {
    header {
        height: 10rem;
    }
    header h1 {
        font-size: 2.8rem;
        padding: 0 1rem;
    }
}

@media (max-width: 600px) {
    header {
        height: 8rem;
    }
    header h1 {
        font-size: 2rem;
        padding: 0 0.5rem;
    }
}

@media (max-width: 400px) {
    header {
        height: 6rem;
    }
    header h1 {
        font-size: 1.5rem;
        padding: 0 0.5rem;
    }
}

a:hover {
    color: var(--color-success-faint-link);
    text-decoration: underline;
}

#alphabet-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 2rem;
}

.letter-container{
    display: flex;
    flex-wrap: wrap;
    direction: rtl;
    justify-content: center;
    width: 97%;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.letter-box {
    background-color: var(--color-background-default);
    border: 1px solid var(--color-borders-hairline);
    padding: 0.8125rem;
    margin: 0.5125rem;
    width: 404px;
    height: 48px;
    border-radius: 4px;
    gap: 0.5rem;
    display: flex;
    align-items: center; /* centré verticalement */
    justify-content: space-between;
    font-weight: bold;
    cursor: default;
    direction: ltr;
    transition: transform 0.1s ease;
}

.Len{
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.letter-box:hover {
    border: 1px solid var(--color-success-medium);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.letter-box:hover .name{
    color: var(--color-success-medium);
}

.letter {
    font-size: 2.5rem;
    font-family: 'Amir';
    color: var(--color-text-default);
    align-content: center;
}

.name {
    font-size: 1rem;
    color: var(--color-text-faded);
}

.audioPart {
    display: flex; 
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.megaphone{
    height: 24px;
    width: 24px;
    filter: var(--color-svg-background);
}

#voyelles{
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    border-top: 2px solid var(--color-borders-hairline);
}

#voyelles p, .arL {
  display: inline;
}


.arL {
  display: inline-block; /* ou block si tu préfères */
  padding-left: 0.3em;
  padding-right: 0.3em;
  direction: rtl;
  font-family: "Amiri", serif;
  font-size: 2em;
}


#place-letter {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    color: var(--color-text-default);
    border-top: 2px solid var(--color-borders-hairline);
}


.lang-ar #letterTitle{
    font-size: var(--font-size-jumbo-px);
}

.lang-ar #SousTitre{
    font-size: var(--font-size-large-px);
}

#letterTitle,
#SousTitre {
    text-align: center;
    margin: 0.5rem 0;
}

#place-letter table {
    margin: 0 auto;
    border-collapse: collapse;
    width: 80%;
    font-family: 'Amir';
    font-size: var(--font-size-large-px);
    table-layout: fixed;
    word-wrap: break-word;
}

#place-letter th,
#place-letter td {
    border: 1px solid var(--color-borders-hairline);
    padding: 12px;
    text-align: center;
}

#place-letter th {
    background-color: var(--color-background-default);
}

#place-letter .letter {
    font-weight: bold;
    color: var(--color-success-medium);
    font-size: var(--font-size-jumbo);
}

/* ----------- Responsive Design ----------- */
@media screen and (max-width: 768px) {
    #place-letter {
        padding: 1rem;
    }

    #place-letter table {
        width: 100%;
        font-size: 18px;
    }

    #place-letter th,
    #place-letter td {
        padding: 8px;
        font-size: 16px;
    }

    #place-letter .letter {
        font-size: 1.8rem; /* ajusté pour petits écrans */
    }
}

@media screen and (max-width: 480px) {
    #place-letter table {
        font-size: 16px;
    }

    #place-letter th,
    #place-letter td {
        font-size: 14px;
        padding: 6px;
    }

    #place-letter .letter {
        font-size: 1.5rem;
    }
}


.footer {
    display: block;
    background-color: var(--color-background-default);
    padding: 1rem ;
    font-size: var(--font-size-small);
    margin: 0 auto;
    border-top: 2px solid var(--color-borders-hairline);
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 0 auto;
}

.footer-section {
  flex: 1 1 200px;
  min-width: 180px;
}

.footer-section h1 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  color: var(--color-primary, #006666);
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section li {
  outline: inherit;
  margin: 0.5rem 0;
}

.footer-section a {
  text-decoration: none;
  color: var(--color-text-link);
  transition: color 0.3s;
}

.nom-site{
    font-size: var(--font-size-small);
}

#SocialTitle {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  color: var(--color-primary, #006666);
}

#LinksContainer{
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3vh;
}

#socialMedia a {
  display: inline-block;
  overflow: hidden;
}

#socialMedia a:hover {
  transform: scale(1.1);
}

#socialMedia a img {
  width: 24px;
  height: 24px;
  filter : var(--color-svg-background);
}

a:hover{
    color: var(--color-success-faint-link);
    text-decoration: underline;
}

/* === REQUÊTE MÉDIA POUR L'ÉCRAN D'ORDINATEUR === */
@media (min-width: 1024px) {
    /* Exclure l'iPad Pro (1024x1366) */
    @media not all and (device-width: 1024px) and (device-height: 1366px) {
        .letter-container{
        width: 80%;
    }
    }
}

@media (min-width: 1700px) {
    .settings-menu {
            width: 20%; /* Change la largeur de .settings-menu à 20% pour les écrans larges */
        }
}