/* =========================================================================
   1. IMPORTS & FONTS
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap');

/* =========================================================================
   2. VARIABLES & COULEURS GLOBALES
   ========================================================================= */
:root {
    --elgamra-primary: #a37d4e;      /* Marron/Or du site */
    --elgamra-primary-dark: #8B6914; /* Marron foncé */
    --elgamra-border: #ddd;
    --elgamra-text: #333;
    --elgamra-text-light: #666;
    --elgamra-text-meta: #999;
    --elgamra-bg-light: #f8f8f8;
}

/* =========================================================================
   3. STYLES GOLBAUX & UIKIT OVERRIDES
   ========================================================================= */

/* Boutons Secondaires (Gradient) */
.uk-button-secondary {
    background-color: #242427;
    color: #fff;
    border: 2px solid transparent;
    background-image: linear-gradient(90deg,#aa9171 0,#727857 70%);
}

/* Titres & Sections Accueil */
.home-section {
    font-size: 1.8em;
    font-weight: 600;
}

.section-key {
    background-color: #28483A;
}

/* Dividers Personnalisés */
.divider-small-or.uk-divider-small::after,
.divider-small-or.uk-divider-small::before,
.divider-small-or {
    border-top-color: #B0926D !important;
}

/* Typographie Spécifique */
.paragraph-title {
    color: #707953;
    font-weight: 600;
    font-size: 1.5em;
}

.paragraph-semi-bold {
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
    font-size: 1.0em;
    color: #6D767E;
}

/* =========================================================================
   4. HEADER & NAVIGATION (Polylang)
   ========================================================================= */
.uk-navbar-right .uk-navbar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.uk-navbar-right .uk-navbar-nav>li {
    padding-left: 0;
}

.uk-navbar-right .uk-navbar-nav>li>a {
    height: 30px !important;
    width: 30px !important;
    min-height: unset !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    text-decoration: none;
    border-radius: 3px !important;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.uk-navbar-right .uk-navbar-nav>li:not(.current-lang-item):not(.uk-active)>a {
    background: transparent !important;
    color: #22262A !important;
    border: none !important;
}

.uk-navbar-right .uk-navbar-nav>li:not(.current-lang-item):not(.uk-active)>a:hover {
    color: #000000 !important;
    background-color: rgba(169, 141, 117, 0.1) !important;
}

.uk-navbar-right .uk-navbar-nav>li.current-lang-item>a,
.uk-navbar-right .uk-navbar-nav>li.uk-active>a {
    background-color: #a98d75 !important;
    color: #FFFFFF !important;
    border: none !important;
}

.uk-navbar-right .uk-navbar-nav>li.current-lang-item>a:hover,
.uk-navbar-right .uk-navbar-nav>li.uk-active>a:hover {
    color: #FFFFFF !important;
    opacity: 0.9;
}

/* =========================================================================
   5. FOOTER
   ========================================================================= */
.footer-menu span,
.footer-menu a {
    font-family: Roboto;
    font-weight: 400;
    font-size: 14px;
    letter-spacing: normal;
    color: #9CA3AF;
    text-transform: none;
    line-height: 0.9em;
    transition: all 0.3s ease;
}

.footer-menu a:hover {
    color: #ffffff;
}

.footer-description {
    color: #9CA3AF;
    font-size: 0.9em;
}

.footer-social .uk-icon {
    color: #707953;
    transition: all 0.3s ease;
}

.footer-social .uk-icon:hover {
    color: #ffffff;
    background: #707953;
    border-radius: 50%;
    padding: 8px;
}

/* =========================================================================
   6. PRODUITS & GRID (Style par défaut FR/EN)
   ========================================================================= */

/* Forme */
.product-panel .fs-grid-text-1 {
    font-family: Roboto;
    font-weight: 600;
    font-size: 12px;
    color: #FF7B00;
    text-align: center;
}

/* Composition */
.product-panel .fs-grid-text-2 {
    font-family: Roboto;
    font-weight: 600;
    font-size: 12px;
    color: #707953;
    text-align: center;
}

/* Bouton Voir Fiche */
.product-panel .fs-grid-text-3 {
    padding: 6px 12px;
    background: transparent;
    color: #22262A;
    border: 2px solid #22262A;
    border-radius: 8px;
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.product-panel .fs-grid-text-3:hover {
    background: #22262A;
    color: white;
    border-color: #22262A;
}

/* Layout Grid Produits */
.product-panel .fs-grid-nested-1 {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
    justify-content: center;
}

.product-panel .fs-grid-nested-1 > div {
    width: auto !important;
    flex: 0 0 auto;
}

.product-panel .fs-grid-fieldset {
    margin: 0;
    flex-shrink: 0;
    width: auto !important;
    display: flex;
    justify-content: center;
}

.product-panel .fs-grid-fieldset span {
    display: block;
    text-align: center;
}

/* Titre Produit */
.product-panel .el-title {
    font-family: 'Roboto Slab';
    font-weight: 700;
    font-size: 15px;
    color: #22262A;
    text-align: left;
    margin-bottom: 10px;
}

/* Page Produit Unique */
.product-page .fs-grid-text-1 {
    font-family: Roboto;
    font-weight: 600;
    font-size: 12px;
    color: #22262A;
    text-align: left;
}

.produit-tableau-nutritionnel {
    line-height: 24px;
}

.produit-code {
    background-color: #FF7B00;
    padding: 0px 8px;
    max-width: fit-content;
    color: #FFFFFF;
}

/* Allergènes Panel */
.produit-allergene {
    background-color: #f5f5f5 !important;
    border: none !important;
    border-radius: 8px;
    padding: 20px !important;
}

.produit-allergene .el-image {
    height: 40px !important;
    object-fit: contain;
    margin-top: -9px !important;
}

.produit-allergene .el-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: #22262A;
    margin: 0 !important;
    padding-left: 0 !important;
}

.produit-allergene .el-content {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #707070;
    margin-top: 8px !important;
    text-transform: none !important;
    text-align: left !important;
}

.produit-allergene .uk-grid {
    align-items: flex-start;
    gap: 15px;
}

.produit-allergene .uk-width-1-4\@m {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    padding-right: 0 !important;
}

.produit-allergene .uk-width-expand {
    padding-left: 0 !important;
}

/* =========================================================================
   7. CUSTOM QUOTE & DEVIS (Style personnalisé)
   ========================================================================= */
.button-custom-quote a.uk-button {
    border-radius: 3px !important;
}

.quote-form-wrapper button[type="submit"],
.quote-form-wrapper .uk-button-primary {
    background: var(--elgamra-primary) !important;
    color: white !important;
    border: none !important;
    padding: 10px 24px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-transform: none !important;
    line-height: 1.4 !important;
}

.quote-form-wrapper button[type="submit"]:hover,
.quote-form-wrapper .uk-button-primary:hover {
    background: var(--elgamra-primary-dark) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(163, 125, 78, 0.3) !important;
}

.quote-form-wrapper button[type="submit"]:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.quote-form-wrapper button[type="submit"] [uk-icon] {
    margin-right: 8px !important;
}

/* Form inputs focus */
.quote-form-wrapper .uk-input:focus,
.quote-form-wrapper .uk-textarea:focus,
.quote-form-wrapper .product-quantity:focus {
    border-color: var(--elgamra-primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(163, 125, 78, 0.1) !important;
}

/* Quote Summary (Floating) */
.quote-summary {
    position: fixed !important;
    top: 120px !important;
    right: 20px !important;
    width: 260px !important;
    z-index: 9999 !important;
    max-height: calc(100vh - 140px) !important;
    overflow-y: auto !important;
}

.quote-summary .uk-card {
    background-image: linear-gradient(90deg,#aa9171 0,#727857 90%) !important;
    color: white !important;
    border-radius: 6px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
    padding: 20px !important;
}

.quote-summary h2,
.quote-summary .uk-h4 {
    color: white !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    margin-bottom: 12px !important;
}

#selected-count {
    color: white !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    margin-bottom: 12px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid rgba(255,255,255,0.3) !important;
}

#selected-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    max-height: 300px !important;
    overflow-y: auto !important;
}

#selected-list li {
    color: white !important;
    border-bottom: 1px solid rgba(255,255,255,0.2) !important;
    padding: 8px 0 !important;
    font-size: 13px !important;
}

/* Produits Selectionnés */
.product-card.selected {
    border: 2px solid var(--elgamra-primary) !important;
    box-shadow: 0 6px 20px rgba(163, 125, 78, 0.25) !important;
}

.product-card.selected::after {
    background: var(--elgamra-primary) !important;
}

.product-checkbox:checked + .product-checkbox-label h3 {
    color: var(--elgamra-primary) !important;
}

.product-checkbox:checked {
    accent-color: var(--elgamra-primary) !important;
}

.product-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1) !important;
}

.product-quantity {
    max-width: 100px !important;
}

.uk-notification-message-success {
    background: var(--elgamra-primary) !important;
    color: white !important;
}


/* Ciblage global pour le formulaire de devis (FR, EN, AR) */
#bulk-quote-form .product-card .uk-card-title {
    font-size: 14px !important; /* Ajustez la taille selon vos besoins */
    line-height: 1.3;
    font-weight: 600; /* Optionnel : pour garder de la lisibilité si c'est petit */
}

/* Optionnel : Ajustement spécifique mobile si besoin */
@media (max-width: 640px) {
    #bulk-quote-form .product-card .uk-card-title {
        font-size: 12px !important;
    }
}

/* =========================================================================
   8. FLUENT FORMS
   ========================================================================= */
.ff-el-form-control label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.ff-el-form-control input[type="text"],
.ff-el-form-control input[type="email"],
.ff-el-form-control input[type="tel"],
.ff-el-form-control select,
.ff-el-form-control textarea {
    padding: 10px 14px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background-color: #f5f5f5;
    transition: all 0.3s;
}

.ff-el-form-control input:focus,
.ff-el-form-control select:focus,
.ff-el-form-control textarea:focus {
    border-color: #48a68b;
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(72, 166, 139, 0.1);
}

.ff-el-form-control input::placeholder,
.ff-el-form-control textarea::placeholder {
    color: #999;
    font-size: 15px;
}

.ff_btn_style {
    background-color: #48a68b !important;
    color: white !important;
    padding: 10px 30px !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    border: 3px solid #48a68b !important;
    transition: all 0.3s ease !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
}

.ff_btn_style:hover {
    background-color: transparent !important;
    color: #48a68b !important;
    border-color: #48a68b !important;
    box-shadow: none !important;
}

.ff_btn_style::before {
    content: "";
    width: 20px;
    height: 20px;
    background-image: url('/wp-content/uploads/elgamra/icons/icon-send.svg');
    background-size: contain;
    background-repeat: no-repeat;
    display: inline-block;
    transition: all 0.3s ease;
    filter: brightness(0) invert(1);
}

.ff_btn_style:hover::before {
    filter: brightness(0) saturate(100%) invert(58%) sepia(26%) saturate(844%) hue-rotate(115deg) brightness(92%) contrast(88%);
}

.ff-message-success {
    background-color: #e8f5f1;
    border-left: 4px solid #48a68b;
    padding: 15px;
    border-radius: 4px;
    color: #2c3e50;
    font-size: 14px;
    margin-top: 20px;
}

.ff-message-error,
.ff-errors-in-stack {
    background-color: #fce4e4;
    border-left: 4px solid #e74c3c;
    padding: 15px;
    border-radius: 4px;
    color: #2c3e50;
    font-size: 14px;
    margin-top: 20px;
}

.ff-el-is-error .text-danger {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
}

.ff-el-is-error input,
.ff-el-is-error select,
.ff-el-is-error textarea {
    border-color: #e74c3c;
}

.ff-el-form-control select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    padding-right: 40px;
    cursor: pointer;
}

.form-title {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 30px;
}

.ff-el-group {
    margin-bottom: 20px;
}

.ff-el-is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ff-loading-overlay {
    background-color: rgba(255, 255, 255, 0.8);
}

/* =========================================================================
   9. RESPONSIVE MEDIA QUERIES
   ========================================================================= */
@media (max-width: 1200px) {
    .quote-summary {
        width: 240px !important;
        right: 15px !important;
    }
}

@media (max-width: 960px) {
    .quote-summary {
        position: relative !important;
        top: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 400px !important;
        margin: 30px auto !important;
    }
    
    .quote-form-wrapper button[type="submit"] {
        width: 100% !important;
        padding: 14px 24px !important;
    }
}

@media (max-width: 768px) {
    .ff-el-form-control,
    .ff_btn_style {
        width: 100% !important;
        text-align: center !important;
    }
}

@media (max-width: 640px) {
    .contact-section {
        padding: 20px !important;
    }
}

/* =========================================================================
   10. CORRECTION ARABE (SAFE MODE)
   ========================================================================= */

/* 1. TYPOGRAPHIE & LIAISON DES LETTRES (Uniquement sur le texte) */
html[lang="ar"] body, 
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3, html[lang="ar"] h4, html[lang="ar"] h5, html[lang="ar"] h6,
html[lang="ar"] p, html[lang="ar"] a, html[lang="ar"] li, html[lang="ar"] span, html[lang="ar"] label,
html[lang="ar"] input, html[lang="ar"] textarea, html[lang="ar"] button, html[lang="ar"] select,
html[lang="ar"] .uk-button, 
html[lang="ar"] .uk-card-title {
    font-family: 'Tajawal', sans-serif !important;
    letter-spacing: 0 !important; /* Vital pour connecter les lettres arabes */
}

/* 2. FORMULAIRE (Alignement Droite) */
html[lang="ar"] .uk-form-label {
    text-align: right;
    display: block;
}

html[lang="ar"] .uk-input,
html[lang="ar"] .uk-textarea {
    text-align: right;
    direction: rtl;
}

/* 3. CHECKBOX PRODUIT (Inversion Case/Texte) */
html[lang="ar"] .product-checkbox-wrapper {
    display: flex;
    flex-direction: row-reverse; /* Met la case à droite */
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}


html[lang="ar"] .product-checkbox-label h3 {
    margin: 0 !important;
    font-size: 16px !important; /* Taille réduite (Standard YOOtheme est souvent 24px) */
    line-height: 1.4 !important; /* Meilleur espacement interligne */
    font-weight: 700 !important; /* On garde le gras pour la lisibilité */
}

/* 4. LISTE RÉSUMÉ PANIER */
html[lang="ar"] #selected-list {
    padding-right: 0;
    text-align: right;
}

/* 5. FIX NAVIGATION (Empêche le menu de casser) */
html[lang="ar"] .uk-navbar-nav > li > a {
    font-family: 'Tajawal', sans-serif !important;
    letter-spacing: 0 !important;
}