@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;600;700&family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-header: #0d0d0d;
    --accent-green: #00e676;
    --accent-cyan: #00e5ff;
    --accent-orange: #ff6d00;
    --accent-gold: #ffd600;
    --text-primary: #f0f0f0;
    --text-secondary: #aaaaaa;
    --border-color: rgba(255,255,255,0.07);
    --navbar-height: 64px;
    --banner-height: 40px;
    --right-sidebar-width: 300px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding-top: calc(var(--navbar-height) + var(--banner-height)) !important;
    margin-top: 0 !important;
    min-height: 100vh;
}

/* ===== BANDEAU APP ===== */
.app-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--banner-height);
    background: linear-gradient(90deg, #00695c, #00897b, #00acc1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 10000;
    text-decoration: none;
    color: white;
    font-size: 12px;
    font-weight: 700;
}
.app-banner img { width: 24px; height: 24px; border-radius: 6px; }
.store-badges { display: flex; gap: 6px; }
.badge {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    border: 1px solid rgba(255,255,255,0.3);
}

/* ===== NAVBAR ===== */
.main-navbar {
    position: fixed;
    top: var(--banner-height); left: 0; right: 0;
    height: var(--navbar-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    z-index: 9000;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 4px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.6);
}

.navbar-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
}
.navbar-hamburger:hover { background: rgba(255,255,255,0.08); }

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 12px;
}
.navbar-logo img { width: 36px; height: 36px; border-radius: 8px; }
.navbar-logo span {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.nav-item { position: relative; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}
.nav-link i.arrow { font-size: 10px; transition: transform 0.2s; }
.nav-link:hover, .nav-link.active { color: var(--accent-green); background: rgba(0,230,118,0.08); }
.nav-item:hover > .nav-link { color: var(--accent-green); }
.nav-item:hover > .nav-link i.arrow { transform: rotate(180deg); }

.nav-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #1c1c1c;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    min-width: 220px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.7);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 99999;
    padding: 8px;
}
.nav-item:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: #aaa;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.15s;
    white-space: nowrap;
}
.nav-dropdown a i { width: 18px; color: var(--accent-green); font-size: 13px; flex-shrink: 0; }
.nav-dropdown a:hover { color: #fff; background: rgba(0,230,118,0.1); }

.navbar-search {
    margin-left: auto;
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 6px 14px;
    gap: 8px;
    flex-shrink: 0;
}
.navbar-search input {
    background: none; border: none; outline: none;
    color: var(--text-primary); font-size: 0.85rem; width: 160px;
}
.navbar-search input::placeholder { color: var(--text-secondary); }
.navbar-search i { color: var(--text-secondary); font-size: 13px; }

/* ===== LAYOUT PRINCIPAL - PLEINE LARGEUR ===== */
.page-wrapper {
    display: flex;
    width: 100%;
    min-height: calc(100vh - var(--navbar-height) - var(--banner-height));
}

/* Contenu principal - prend tout l'espace disponible */
.main-content {
    flex: 1;
    padding: 24px 28px;
    min-width: 0;
    overflow-x: hidden;
    /* PAS de max-width, PAS de margin-left */
}

/* Sidebar droite - fixe à droite */
.sidebar-right {
    width: var(--right-sidebar-width);
    flex-shrink: 0;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-left: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* Sidebar gauche mobile - cachée par défaut, slide depuis gauche */
.sidebar-left {
    position: fixed;
    top: calc(var(--navbar-height) + var(--banner-height));
    left: -280px;
    width: 260px;
    height: calc(100vh - var(--navbar-height) - var(--banner-height));
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    transition: left 0.3s ease;
    z-index: 8000;
}
.sidebar-left.active { left: 0; }

.sidebar-left-header {
    padding: 18px;
    background: linear-gradient(135deg, #0a3d2e, #0d5c44);
    border-bottom: 2px solid var(--accent-green);
    text-align: center;
}
.sidebar-left-header h2 {
    font-family: 'Rajdhani', sans-serif;
    color: var(--accent-green);
    font-size: 1.1rem;
    letter-spacing: 2px;
}
.sidebar-left-header p { color: var(--text-secondary); font-size: 0.75rem; margin-top: 4px; }

.sidebar-menu { list-style: none; padding: 8px 0; }
.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 600;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}
.sidebar-menu li a i { width: 18px; color: var(--accent-green); font-size: 13px; }
.sidebar-menu li a:hover, .sidebar-menu li a.active {
    color: var(--accent-green);
    background: rgba(0,230,118,0.06);
    border-left-color: var(--accent-green);
    padding-left: 24px;
}
.sidebar-divider { height: 1px; background: var(--border-color); margin: 6px 14px; }

/* ===== WIDGETS SIDEBAR DROITE ===== */
.widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}
.widget-title {
    padding: 10px 14px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}
.widget-title.green { color: var(--accent-green); background: rgba(0,230,118,0.05); }
.widget-title.cyan  { color: var(--accent-cyan);  background: rgba(0,229,255,0.05); }
.widget-title.gold  { color: var(--accent-gold);  background: rgba(255,214,0,0.05); }
.widget-body { padding: 12px 14px; }

.quick-links { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.quick-links li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s;
}
.quick-links li a i { width: 16px; color: var(--accent-cyan); font-size: 12px; }
.quick-links li a:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.app-widget { text-align: center; }
.app-widget img { width: 64px; height: 64px; border-radius: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.4); margin-bottom: 8px; }
.app-widget h3 { font-family: 'Rajdhani', sans-serif; font-size: 1rem; margin-bottom: 4px; }
.app-widget p { color: var(--text-secondary); font-size: 0.76rem; line-height: 1.5; margin-bottom: 12px; }
.store-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 9px 14px; border-radius: 10px;
    text-decoration: none; font-size: 0.82rem; font-weight: 700;
    margin-bottom: 8px; transition: all 0.2s;
}
.store-btn.android { background: linear-gradient(135deg, #1b5e20, #2e7d32); color: white; }
.store-btn.ios     { background: linear-gradient(135deg, #1a237e, #283593); color: white; }
.store-btn:hover   { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.4); }
.store-btn i       { font-size: 16px; }

/* ===== CONTENU DE PAGE ===== */
.page-title-container {
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0a3d2e, #0d5c44);
    border: 1px solid rgba(0,230,118,0.15);
    margin-bottom: 16px;
}
.page-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.5rem;
    text-align: center;
    color: var(--accent-green);
    font-weight: 700;
}
p.page-title { font-size: 0.88rem; font-weight: 400; color: var(--text-secondary); margin-top: 4px; }

.container { background: transparent; padding: 0; margin: 0; }

.section h2 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 8px;
    margin: 18px 0 10px;
}
.subsection h3 {
    color: var(--accent-cyan);
    font-size: 0.98rem;
    font-weight: 700;
    margin: 14px 0 8px;
    padding-left: 10px;
    border-left: 3px solid var(--accent-cyan);
}
.hadith {
    border-radius: 10px; padding: 14px 18px;
    margin: 8px 0; border: 1px solid var(--border-color);
}
.hadith-text { color: var(--text-primary); font-size: 0.92rem; line-height: 1.8; margin-bottom: 8px; }
.hadith-source { color: var(--text-secondary); font-size: 0.78rem; font-style: italic; border-top: 1px solid var(--border-color); padding-top: 6px; }
.hadith:nth-child(4n+1) { background: linear-gradient(135deg, rgba(0,230,118,0.06), rgba(0,229,255,0.04)); }
.hadith:nth-child(4n+2) { background: linear-gradient(135deg, rgba(213,0,249,0.06), rgba(98,0,234,0.04)); }
.hadith:nth-child(4n+3) { background: linear-gradient(135deg, rgba(255,109,0,0.06), rgba(255,214,0,0.04)); }
.hadith:nth-child(4n+4) { background: linear-gradient(135deg, rgba(0,229,255,0.06), rgba(41,182,246,0.04)); }

.note {
    background: linear-gradient(135deg, rgba(255,109,0,0.1), rgba(255,214,0,0.05));
    border: 1px solid rgba(255,109,0,0.2);
    border-radius: 10px; padding: 16px 18px; margin: 16px 0;
}
.note h3 { color: var(--accent-orange); margin-bottom: 8px; }
.note p, .note ul { color: rgba(255,255,255,0.8); font-size: 0.88rem; line-height: 1.7; }
.note ul { padding-left: 18px; margin-top: 6px; }
.note li { margin-bottom: 4px; }

.seo-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px; padding: 18px; margin-top: 28px;
    font-size: 0.87rem; line-height: 1.8; color: var(--text-secondary);
}
.seo-box h2 {
    font-family: 'Rajdhani', sans-serif;
    color: var(--accent-green); font-size: 1.1rem;
    margin-bottom: 12px; padding: 0; background: none;
}
.seo-box p { margin-bottom: 10px; }
.seo-box a { color: var(--accent-cyan); text-decoration: none; }
.seo-box a:hover { text-decoration: underline; }
.seo-box strong { color: var(--text-primary); }

/* ===== FOOTER ===== */
.site-footer {
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    padding: 40px 28px 20px;
    margin-top: 40px;
    width: 100%;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px; margin-bottom: 28px;
}
.footer-col h4 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem; font-weight: 700;
    letter-spacing: 1px; color: var(--accent-green); margin-bottom: 12px;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 6px; }
.footer-col ul li a { color: var(--text-secondary); text-decoration: none; font-size: 0.82rem; transition: color 0.2s; }
.footer-col ul li a:hover { color: var(--accent-green); }
.footer-bottom {
    text-align: center; padding-top: 18px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary); font-size: 0.78rem;
}

/* ===== BOTTOM NAV MOBILE ===== */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    z-index: 7000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.bottom-nav a {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--text-secondary); text-decoration: none;
    font-size: 10px; font-weight: 600; gap: 2px; transition: color 0.2s;
}
.bottom-nav a .bn-icon { font-size: 20px; }
.bottom-nav a:hover, .bottom-nav a.active { color: var(--accent-green); }

#scrollTopBtn {
    position: fixed; bottom: 80px; right: 20px;
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, #00695c, #00897b);
    border: none; color: white; font-size: 16px;
    cursor: pointer; display: none; z-index: 6000;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}

.overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    opacity: 0; visibility: hidden;
    transition: all 0.3s; z-index: 7500;
}
.overlay.active { opacity: 1; visibility: visible; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    :root { --right-sidebar-width: 260px; }
    .navbar-search { display: none; }
}

@media (max-width: 768px) {
    body { padding-bottom: 72px; }
    .navbar-hamburger { display: block; }
    .navbar-menu { display: none; }
    .navbar-search { display: none; }
    .sidebar-right { display: none; }
    .page-wrapper { flex-direction: column; }
    .main-content { padding: 4px 2px !important; width: 100% !important; max-width: 100% !important; }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .site-footer { padding-bottom: 80px; }
    /* Tout le contenu prend toute la largeur sur mobile */
    .main-content > * { margin-left: 2px !important; margin-right: 2px !important; width: calc(100% - 4px) !important; box-sizing: border-box !important; }
    .container { padding: 4px 2px !important; margin: 0 !important; }
}

@media (min-width: 769px) {
    .bottom-nav { display: none; }
    #scrollTopBtn { bottom: 30px; }
}


/* Assurer que le contenu ne commence pas sous la navbar */
.page-wrapper .main-content {
    padding-top: 20px !important;
}

/* ===== FORCE OVERRIDE - ANTI MARGIN-TOP ===== */
html body .container,
html body .main-content .container,
html body .page-wrapper .container {
    margin-top: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
html body .page-wrapper .main-content {
    padding-top: 16px !important;
}

/* ===== FIX H1 TITRES INVISIBLES ===== */
/* Le -webkit-background-clip:text sans -webkit-text-fill-color rend le texte transparent */
.page-title {
    -webkit-text-fill-color: transparent !important;
    color: #00e676 !important;
}
.page-title-container h1,
.page-title-container .page-title {
    -webkit-text-fill-color: transparent;
}
/* Si pas de gradient, forcer la couleur */
h1 {
    color: var(--accent-green);
}

/* ===== FIX DÉFINITIF PADDING-TOP BODY ===== */
/* Ce bloc doit rester EN DERNIER pour overrider tout CSS inline */
html body {
    padding-top: calc(var(--navbar-height) + var(--banner-height)) !important;
    margin-top: 0 !important;
}
html body .main-content > *:first-child,
html body .main-content .container:first-child,
html body .main-content > div:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
