/* DZMARKET HOMEPAGE MODERN LAYER BEGIN */
/* Couche visuelle réservée à index.php : aucune logique PHP modifiée */

:root {
    --dzm-home-green: #2f7d5a;
    --dzm-home-green-dark: #194b35;
    --dzm-home-soft: #edf6f0;
    --dzm-home-border: #e1eae4;
    --dzm-home-shadow: 0 8px 24px rgba(26, 59, 40, 0.07);
}

body:not(.dark-theme) {
    background: #f6f9f7;
    color: #24362b;
}

/* En-tête et logo */
.header {
    background: rgba(255, 255, 255, 0.97) !important;
    border-bottom: 1px solid var(--dzm-home-border) !important;
    box-shadow: 0 5px 24px rgba(24, 55, 37, 0.055);
    backdrop-filter: blur(12px);
}

.header-container {
    max-width: 1320px;
    min-height: 78px;
    padding: 12px 24px;
    gap: 16px;
}

.logo {
    font-size: 29px;
    font-weight: 800;
    letter-spacing: -0.8px;
    white-space: nowrap;
}

.logo span {
    color: var(--dzm-home-green);
}

.header-search input {
    box-sizing: border-box;
    min-height: 44px;
    border-radius: 13px;
    border: 1px solid #dce6df;
    background: #f8faf9;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.header-search input:focus {
    border-color: #75a88a;
    box-shadow: 0 0 0 4px rgba(47, 125, 90, 0.10);
    outline: none;
}

/* Boutons utilisateur */
.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.header-actions .btn-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 39px;
    padding: 0 12px;
    border: 1px solid #e0e8e2;
    border-radius: 12px;
    background: #ffffff;
    color: #34473a;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s ease,
                color 0.18s ease,
                border-color 0.18s ease,
                transform 0.18s ease;
}

.header-actions span.btn-login:first-child {
    background: #edf6f0;
    border-color: #d7e9dc;
    color: #27583b;
    font-weight: 750;
}

.header-actions .btn-login:hover {
    background: #edf6f0;
    border-color: #bdd9c5;
    color: #245b3a;
    transform: translateY(-1px);
}

.header-actions .btn-post {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 17px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #39785a, #2f7d5a);
    box-shadow: 0 5px 12px rgba(47, 125, 90, 0.19);
    color: #ffffff;
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.header-actions .btn-post:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 17px rgba(47, 125, 90, 0.25);
}

/* Navigation */
.nav {
    background: #ffffff;
    border-bottom: 1px solid #e8eee9;
}

.nav .nav-container {
    max-width: 1320px;
    padding: 9px 24px;
    gap: 7px;
}

.nav .nav-container a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #425449;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
}

.nav .nav-container a:hover {
    background: #edf6f0;
    color: #246341;
}

/* Bannière d'accueil */
.hero {
    position: relative;
    overflow: hidden;
    padding: 68px 24px;
    background:
        radial-gradient(
            circle at 86% 18%,
            rgba(255, 255, 255, 0.13),
            transparent 28%
        ),
        linear-gradient(
            118deg,
            #194b35 0%,
            #2f7d5a 58%,
            #39785a 100%
        ) !important;
    color: #ffffff;
}

.hero::before {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    right: -115px;
    bottom: -190px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 50%;
    pointer-events: none;
}

.hero-container {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.hero h1 {
    max-width: 900px;
    margin: 0 auto 13px;
    color: #ffffff;
    font-size: clamp(30px, 4vw, 43px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1px;
}

.hero p {
    margin: 0 auto 29px;
    color: rgba(255, 255, 255, 0.90);
    font-size: clamp(15px, 2vw, 18px);
    line-height: 1.6;
}

/* Barre de recherche principale */
.search-box {
    display: grid;
    grid-template-columns: minmax(200px, 2fr) minmax(140px, 1fr)
                           minmax(140px, 1fr) auto;
    align-items: center;
    gap: 10px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.60);
    border-radius: 19px;
    background: #ffffff;
    box-shadow: 0 15px 38px rgba(12, 40, 24, 0.22);
    text-align: left;
}

.search-box input,
.search-box select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 49px;
    padding: 0 13px;
    border: 1px solid #e0e8e2;
    border-radius: 12px;
    background: #f9fbf9;
    color: #26372c;
    font: inherit;
    font-size: 14px;
}

.search-box input:focus,
.search-box select:focus {
    border-color: #75a88a;
    outline: none;
    box-shadow: 0 0 0 3px rgba(47, 125, 90, 0.11);
}

.search-box .search-btn {
    min-height: 49px;
    padding: 0 23px;
    border: 0;
    border-radius: 12px;
    background: #2f7d5a;
    box-shadow: 0 4px 10px rgba(47, 125, 90, 0.16);
    color: #ffffff;
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.search-box .search-btn:hover {
    background: #246747;
    transform: translateY(-1px);
}

/* Contenu, titres et catégories */
.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 45px 24px 58px;
}

.container .section-title {
    margin: 0 0 21px;
    color: #243b2d;
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.55px;
}

.container > .categories + .section-title {
    margin-top: 45px;
}

.categories {
    gap: 16px;
    margin-bottom: 44px;
}

.categories .category {
    box-sizing: border-box;
    padding: 20px 13px;
    border: 1px solid #e2eae4;
    border-radius: 17px;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(31, 62, 43, 0.045);
    text-decoration: none;
    transition: transform 0.2s ease,
                box-shadow 0.2s ease,
                border-color 0.2s ease;
}

.categories .category:hover {
    transform: translateY(-4px);
    border-color: #c5dfcd;
    box-shadow: 0 12px 25px rgba(31, 62, 43, 0.09);
}

.category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    margin: 0 auto 13px;
    border-radius: 18px;
    background: #edf6f0;
    font-size: 27px;
}

.category-name {
    color: #304638;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.4;
}

/* Cartes des annonces */
.ads {
    gap: 20px;
}

.ads .ad-card {
    overflow: hidden;
    border: 1px solid #e2eae4;
    border-radius: 17px;
    background: #ffffff;
    box-shadow: 0 5px 18px rgba(30, 61, 42, 0.055);
    text-decoration: none;
    transition: transform 0.2s ease,
                box-shadow 0.2s ease,
                border-color 0.2s ease;
}

.ads .ad-card:hover {
    transform: translateY(-4px);
    border-color: #c8dfcf;
    box-shadow: 0 13px 27px rgba(30, 61, 42, 0.11);
}

.ads .ad-image {
    overflow: hidden;
    background: #f0f4f1;
}

.ads .ad-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.ads .ad-card:hover .ad-image img {
    transform: scale(1.035);
}

.ads .ad-content {
    padding: 15px 16px 18px;
}

.ads .ad-title {
    display: -webkit-box;
    overflow: hidden;
    min-height: 42px;
    color: #273b2e;
    font-size: 15px;
    font-weight: 750;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ads .ad-price {
    margin-top: 10px;
    color: #2f7d5a;
    font-size: 20px;
    font-weight: 850;
}

.ads .ad-location {
    margin-top: 10px;
    color: #6b7c70;
    font-size: 12px;
    line-height: 1.5;
}

.ads .ad-category {
    display: inline-flex;
    align-items: center;
    margin-top: 11px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #edf6f0;
    color: #2b6b48;
    font-size: 11px;
    font-weight: 750;
}

/* Pied de page */
.footer {
    border-top: 1px solid #e0e9e2;
    background: #edf4ef;
    color: #506456;
    padding: 36px 24px;
}

.footer h3 {
    color: #27583b;
    font-size: 22px;
    font-weight: 850;
}

/* Mode sombre */
.dark-theme .header,
.dark-theme .nav {
    background: #1d2922 !important;
    border-color: #34453a !important;
}

.dark-theme .header-actions .btn-login {
    background: #26372c;
    border-color: #3b5042;
    color: #e4eee7;
}

.dark-theme .header-actions span.btn-login:first-child {
    background: #304b39;
    border-color: #42684d;
    color: #e6f5e9;
}

.dark-theme .nav .nav-container a {
    color: #dce8df;
}

.dark-theme .nav .nav-container a:hover {
    background: #304b39;
    color: #ffffff;
}

.dark-theme .container .section-title {
    color: #e5eee7;
}

.dark-theme .categories .category,
.dark-theme .ads .ad-card {
    background: #202d25;
    border-color: #37483c;
}

.dark-theme .category-name,
.dark-theme .ads .ad-title {
    color: #e3ece5;
}

.dark-theme .ads .ad-location {
    color: #b7c6ba;
}

.dark-theme .ads .ad-category {
    background: #304b39;
    color: #d5efdc;
}

.dark-theme .category-icon {
    background: #304b39;
}

.dark-theme .footer {
    background: #1d2922;
    border-color: #34453a;
    color: #c0cec3;
}

.dark-theme .footer h3 {
    color: #d4ecdb;
}

/* Tablettes */
@media (max-width: 1000px) {
    .header-container {
        flex-wrap: wrap;
    }

    .header-search {
        order: 3;
        flex: 1 1 100%;
    }

    .header-actions {
        flex-wrap: wrap;
        max-width: 100%;
    }

    .search-box {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .search-box input,
    .search-box .search-btn {
        grid-column: 1 / -1;
    }

    .categories {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ads {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Mobiles */
@media (max-width: 700px) {
    .header-container {
        padding: 12px 15px;
        gap: 10px;
    }

    .logo {
        font-size: 24px;
    }

    .header-actions {
        width: 100%;
        margin-left: 0;
        justify-content: flex-start;
        gap: 6px;
    }

    .header-actions .btn-login,
    .header-actions .btn-post {
        min-height: 36px;
        padding: 0 9px;
        font-size: 12px;
    }

    .hero {
        padding: 42px 15px;
    }

    .hero h1 {
        font-size: 29px;
    }

    .hero p {
        font-size: 15px;
    }

    .search-box {
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
        padding: 10px;
        border-radius: 15px;
    }

    .search-box input,
    .search-box select,
    .search-box .search-btn {
        grid-column: 1;
        width: 100%;
    }

    .container {
        padding: 32px 15px 42px;
    }

    .categories {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px;
    }

    .categories .category {
        padding: 16px 9px;
        border-radius: 14px;
    }

    .ads {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .ads .ad-image {
        height: 155px;
    }

    .ads .ad-content {
        padding: 12px;
    }

    .ads .ad-price {
        font-size: 17px;
    }

    .ads .ad-title {
        font-size: 13px;
    }

    .footer {
        padding: 30px 16px;
    }
}

@media (max-width: 390px) {
    .ads .ad-image {
        height: 130px;
    }

    .ads .ad-content {
        padding: 10px;
    }
}

/* DZMARKET HOMEPAGE MODERN LAYER END */
/* DZMARKET FINITION ANNONCES V2 */
/* Cartes lisibles ; compteur de vues toujours en bas a droite et orange. */
.ad-card {
    position: relative;
    box-sizing: border-box;
}
.ad-card .ad-content {
    min-width: 0;
}
/* Cibler le badge de vues sans déplacer les autres icones de la carte. */
.ad-card .ad-views,
.ad-card .ad-view-count,
.ad-card .ad-views-count,
.ad-card .views-count,
.ad-card .view-count,
.ad-card .views-badge,
.ad-card .view-badge,
.ad-card .ad-view-badge,
.ad-card .ad-views-badge,
.ad-card .view-count-badge,
.ad-card .views-counter,
.ad-card .view-counter,
.ad-card .annonce-views,
.ad-card .ad-eye-count,
.ad-card [data-view-count],
.ad-card [data-views],
.ad-card [data-vues] {
    position: absolute !important;
    right: 10px !important;
    bottom: 10px !important;
    top: auto !important;
    left: auto !important;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    max-width: calc(100% - 20px);
    padding: 6px 10px;
    border: 1px solid rgba(249, 115, 22, .48);
    border-radius: 999px;
    background: rgba(255, 247, 237, .98);
    color: #c2410c !important;
    box-shadow: 0 4px 14px rgba(194, 65, 12, .16);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}
.ad-card .ad-views svg,
.ad-card .ad-view-count svg,
.ad-card .ad-views-count svg,
.ad-card .views-count svg,
.ad-card .view-count svg,
.ad-card .views-badge svg,
.ad-card .view-badge svg,
.ad-card .ad-view-badge svg,
.ad-card .ad-views-badge svg,
.ad-card .view-count-badge svg,
.ad-card .views-counter svg,
.ad-card .view-counter svg,
.ad-card .annonce-views svg,
.ad-card .ad-eye-count svg,
.ad-card [data-view-count] svg,
.ad-card [data-views] svg,
.ad-card [data-vues] svg {
    color: #f97316 !important;
    fill: currentColor;
}
/* Titre de section avec une finition soignee, sans changer le theme principal. */
.section-title[data-i18n="recent_ads"],
h2.section-title {
    position: relative;
    color: #183b2d;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: clamp(1.25rem, 2.2vw, 1.8rem);
    font-weight: 850;
    letter-spacing: -.035em;
    line-height: 1.25;
    text-wrap: balance;
}
.section-title[data-i18n="recent_ads"] {
    margin-top: 30px;
    margin-bottom: 20px;
    padding: 16px 20px 16px 22px;
    border: 1px solid rgba(47, 125, 90, .14);
    border-left: 5px solid #2f7d5a;
    border-radius: 14px;
    background: linear-gradient(110deg, #f1f8f3 0%, #ffffff 72%);
    box-shadow: 0 7px 22px rgba(28, 72, 49, .06);
}
.section-title[data-i18n="recent_ads"]::after {
    content: "Les dernières annonces publiées sur MarketDG";
    display: block;
    margin-top: 5px;
    color: #64766b;
    font-size: clamp(.78rem, 1.15vw, .92rem);
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.5;
}

html[lang="en"] .section-title[data-i18n="recent_ads"]::after {
    content: "The latest listings posted on MarketDG";
}
html[lang="ar"] .section-title[data-i18n="recent_ads"]::after {
    content: "أحدث الإعلانات المنشورة على \2066MarketDG\2069";
    text-align: right;
}
@media (max-width: 600px) {
    .section-title[data-i18n="recent_ads"] {
        padding: 13px 14px 13px 16px;
        border-radius: 12px;
    }
}
/* FIN DZMARKET FINITION ANNONCES V2 */
/* Les menus natifs gardent une palette claire pour éviter le texte clair sur un survol clair,
   même si le champ fermé suit le thème sombre. */
.search-box select {
    color-scheme: light;
}

.search-box select option {
    background-color: #ffffff;
    color: #26372c;
}

.search-box select option:checked {
    background-color: #dcefe3;
    color: #194b35;
}
