/* =====================================================================
   SITE STYLE (Admin → System → Site Style)
   Header / homepage / footer designs, card styles and dark mode.
   ===================================================================== */

/* ---------- Header designs ---------- */
.theme-toggle { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.theme-toggle:hover { background: rgba(255, 255, 255, .28); }
.theme-toggle .icon-light, [data-theme="dark"] .theme-toggle .icon-dark { display: none; }
[data-theme="dark"] .theme-toggle .icon-light { display: inline; }

/* Light menu bar (h2, h3, h5) */
.main-nav.nav-light { background: var(--card); box-shadow: 0 1px 0 var(--border), 0 6px 18px -12px rgba(15, 23, 42, .25); }
.main-nav.nav-light .nav-link { color: var(--text) !important; }
.main-nav.nav-light .nav-link:hover, .main-nav.nav-light .nav-link.active { background: var(--primary-soft); color: var(--primary) !important; }
.main-nav.nav-light .navbar-toggler { color: var(--text); border-color: var(--border); }
.main-nav.nav-light .nav-search input { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.main-nav.nav-light .nav-search button { background: var(--primary); }
.main-nav.nav-light .theme-toggle { background: var(--primary-soft); color: var(--primary); }

/* Dark menu bar (h4, h6) */
.main-nav.nav-dark { background: var(--navy); }
.main-nav.nav-dark .nav-search button { background: var(--primary); }

/* Active item underline (h5, h6) */
.main-nav.nav-underline-active .nav-link.active, .main-nav.nav-underline-active .nav-link:hover { background: transparent; box-shadow: inset 0 -3px 0 var(--primary); }
.main-nav.nav-dark.nav-underline-active .nav-link.active { color: #fff !important; }

/* Centered (h2) */
.header-centered { padding: 2rem 0 1.6rem; }
.header-centered .brand { text-align: center; justify-content: center; }
.header-centered .brand-name { font-size: 2.6rem; }
.nav-centered { border-top: 1px solid var(--border); }

/* Logo + menu in one bar (h3, h4) */
.main-nav.nav-inline { padding: .55rem 0; }
.main-nav.nav-inline .brand-name { font-size: 1.55rem; }
.main-nav.nav-inline .brand-tagline { display: none; }
.main-nav.nav-inline .brand-logo { max-height: none; }
.main-nav.nav-inline .nav-link { padding: .6rem .85rem !important; border-radius: var(--radius-sm, 8px); }
.main-nav.nav-dark.nav-inline .brand, .main-nav.nav-dark.nav-inline .brand-name { color: #fff; }
.main-nav.nav-dark.nav-inline .brand-name span { color: var(--primary-light); }
.main-nav.nav-minimal { box-shadow: 0 1px 0 var(--border); }
.main-nav.nav-inline .navbar-toggler { margin: 0; }

/* Colored logo area (h5) */
.site-header.header-color { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.header-color .brand, .header-color .brand-name, .header-color .brand-name span { color: #fff; }
.header-color .brand-tagline { color: rgba(255, 255, 255, .8); }
.header-social a { color: #fff; font-size: 1.1rem; margin-left: .9rem; opacity: .9; }
.header-social a:hover { opacity: 1; color: #fff; }

/* Colored top bar (h6) */
.topbar-color .topbar { background: var(--primary); color: rgba(255, 255, 255, .9); }
.topbar-color .topbar a { color: #fff; }

/* ---------- Homepage layouts ---------- */
.hero-news { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; margin-bottom: 2rem; }
.hero-news .hero-lead { min-height: 420px; }
.hero-news .hero-lead h2 { font-size: 1.8rem; }
.headlines { background: var(--card); border: 1px solid var(--border); padding: 1rem 1.2rem; }
.headlines-title { font-weight: 800; color: var(--primary); text-transform: uppercase; font-size: .82rem; letter-spacing: .06em; margin-bottom: .75rem; }
.hero-banner { margin-bottom: 2rem; }
.hero-banner .hero-item { min-height: 460px; }
.hero-banner .hero-item h2 { font-size: 2.2rem; max-width: 780px; }
.hero-banner .overlay { padding: 2rem; }
.hero-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 2rem; }
.hero-tiles.n1 { grid-template-columns: 1fr; }
.hero-tiles.n2 { grid-template-columns: 1fr 1fr; }
.hero-tiles .hero-item { min-height: 300px; }
.hero-tiles .hero-item h2 { font-size: 1.25rem; }
@media (max-width: 991.98px) {
    .hero-news { grid-template-columns: 1fr; }
    .hero-news .hero-lead { min-height: 320px; }
    .hero-tiles { gap: 8px; }
    .hero-tiles .hero-item { min-height: 0; aspect-ratio: 3 / 4; }
    .hero-tiles .hero-item h2 { font-size: .95rem; }
    .hero-banner .hero-item { min-height: 340px; }
    .hero-banner .hero-item h2 { font-size: 1.6rem; }
}
@media (max-width: 575.98px) {
    .hero-tiles { gap: 6px; }
    .hero-tiles .hero-item .overlay { padding: .5rem; }
    .hero-tiles .hero-item h2 {
        font-size: .72rem; line-height: 1.3; margin: 0;
        display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden;
    }
    .hero-tiles .cat-badge, .hero-tiles .hero-meta { display: none; }
    .hero-banner .hero-item { min-height: 260px; }
    .hero-banner .hero-item h2 { font-size: 1.25rem; }
}

.section-title .section-more { order: 3; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.cat-block { margin-bottom: 2.25rem; }

.post-big { background: var(--card); border: 1px solid var(--border); overflow: hidden; }
.post-big .thumb { display: block; aspect-ratio: 16 / 8; overflow: hidden; background: var(--border); }
.post-big .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.post-big:hover .thumb img { transform: scale(1.03); }
.post-big .body { padding: 1.5rem 1.75rem 1.75rem; }
.post-big h2 { font-size: 1.7rem; font-weight: 800; line-height: 1.3; margin: .25rem 0 .75rem; }
.post-big h2 a { color: var(--text); }
.post-big h2 a:hover { color: var(--primary); }
.post-big p { color: var(--muted); font-size: 1.02rem; line-height: 1.75; }
.post-big-date { color: var(--muted); font-size: .85rem; }
.read-more { font-weight: 700; }

/* ---------- Footer designs ---------- */
.footer-subscribe { display: flex; gap: .5rem; flex-wrap: wrap; }
.footer-subscribe .form-control { flex: 1 1 200px; }
.footer-minimal { background: var(--card); color: var(--muted); border-top: 1px solid var(--border); padding: 1.4rem 0; margin-top: 3rem; }
.footer-minimal a { color: var(--text); }
.footer-minimal .footer-social a { background: var(--primary-soft); color: var(--primary); }
.footer-inline-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.footer-centered { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: rgba(255, 255, 255, .85); }
.footer-centered .footer-brand, .footer-centered .footer-brand span { color: #fff !important; }
.footer-centered a { color: #fff; }
.footer-centered .footer-social a { background: rgba(255, 255, 255, .15); }
.footer-centered .footer-social a:hover { background: #fff; color: var(--primary); }
.footer-centered .footer-bottom { border-color: rgba(255, 255, 255, .15); }
.footer-newsletter { padding-top: 0; }
.newsletter-band { background: var(--primary); color: #fff; padding: 2rem 0; margin-bottom: 3rem; }
.newsletter-band h4 { color: #fff; font-weight: 800; margin-bottom: .25rem; }
.newsletter-band .footer-subscribe { min-width: min(100%, 420px); }
.newsletter-band .btn-primary { background: var(--navy); border-color: var(--navy); }
.footer-light { background: var(--card); color: var(--muted); border-top: 1px solid var(--border); }
.footer-light h5, .footer-light .footer-brand { color: var(--text); }
.footer-light a, .footer-light .mini-post h4 a { color: var(--text); }
.footer-light a:hover { color: var(--primary); }
.footer-light .footer-social a { background: var(--primary-soft); color: var(--primary); }
.footer-light .footer-social a:hover { background: var(--primary); color: #fff; }
.footer-light .footer-bottom, .footer-light .mini-post { border-color: var(--border); }
.footer-light .mini-thumb { background: var(--border); }

/* ---------- Corners & card styles ---------- */
.post-card, .post-list-item, .widget, .single-post, .author-box, .comments-area, .post-big, .headlines,
.empty-state, .archive-header, .hero-item, .post-nav > div { border-radius: var(--radius); }
.post-list-item .thumb, .featured-img, .mini-thumb, .ad-slot img { border-radius: var(--radius-sm, 8px); }

.cards-shadow .post-card, .cards-shadow .post-list-item, .cards-shadow .widget:not(.widget-newsletter):not(.widget-sidebar_ad),
.cards-shadow .single-post, .cards-shadow .author-box, .cards-shadow .comments-area, .cards-shadow .post-nav > div:not(:empty),
.cards-shadow .post-big, .cards-shadow .headlines, .cards-shadow .empty-state {
    border-color: transparent; box-shadow: 0 8px 28px -14px rgba(15, 23, 42, .22);
}
.cards-flat .post-card, .cards-flat .post-list-item, .cards-flat .widget:not(.widget-newsletter),
.cards-flat .single-post, .cards-flat .author-box, .cards-flat .comments-area, .cards-flat .post-nav > div,
.cards-flat .post-big, .cards-flat .headlines, .cards-flat .empty-state {
    border-color: transparent; box-shadow: none;
}
.cards-flat .post-card:hover, .cards-flat .post-list-item:hover { box-shadow: none; transform: none; }
.cards-flat .widget-title { border-bottom-width: 3px; }

/* ---------- Dark mode ---------- */
[data-theme="dark"] {
    --text: #e2e8f0; --muted: #94a3b8; --border: #1f2a44; --bg: #0b1220; --card: #111a2e;
    color-scheme: dark;
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .site-header:not(.header-color) { background: var(--card); }
[data-theme="dark"] .brand, [data-theme="dark"] .brand:hover { color: var(--text); }
[data-theme="dark"] .post-card .thumb, [data-theme="dark"] .post-list-item .thumb, [data-theme="dark"] .mini-thumb { background: #1a2540; }
[data-theme="dark"] .thumb-placeholder { background: linear-gradient(135deg, #16213a, #1d2b4a); color: #3b4f7a; }
[data-theme="dark"] .post-content code { background: #1a2540; color: #fda4af; }
[data-theme="dark"] .post-content th { background: #16213a; }
[data-theme="dark"] .avatar-initial { background: rgba(var(--primary-rgb), .2); color: var(--primary-light); }
[data-theme="dark"] .main-nav .sub-menu { background: var(--card); }
[data-theme="dark"] .main-nav .sub-menu a { color: var(--text); }
[data-theme="dark"] .nav-search input { background: var(--bg); color: var(--text); }
[data-theme="dark"] .site-footer:not(.footer-centered):not(.footer-light):not(.footer-minimal) { background: #070d1a; }
[data-theme="dark"] a { color: var(--primary-light); }
[data-theme="dark"] .cat-badge, [data-theme="dark"] .btn-primary, [data-theme="dark"] .section-title h2,
[data-theme="dark"] .main-nav:not(.nav-light) .nav-link, [data-theme="dark"] .social-grid a, [data-theme="dark"] .share-bar a { color: #fff; }
[data-theme="dark"] .post-card h3 a, [data-theme="dark"] .post-list-item h3 a, [data-theme="dark"] .mini-post h4 a,
[data-theme="dark"] .post-big h2 a, [data-theme="dark"] .post-nav a, [data-theme="dark"] .author-box h4 a,
[data-theme="dark"] .cat-list a, [data-theme="dark"] .tag-cloud a, [data-theme="dark"] .author-mini { color: var(--text) !important; }
[data-theme="dark"] .tag-cloud a:hover { color: #fff !important; }
[data-theme="dark"] .cards-shadow .post-card, [data-theme="dark"] .cards-shadow .widget { box-shadow: 0 8px 28px -14px rgba(0, 0, 0, .6); }

/* Footer always at the bottom, even on short pages */
body { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1 0 auto; }

/* ---------- Responsive ads ---------- */
/* Every ad fits its box. Fixed-size ad code that is still too wide is scaled down by main.js (fitAds). */
.ad-slot { max-width: 100%; min-width: 0; overflow: hidden; text-align: center; }
.ad-inner { display: block; max-width: 100%; margin: 0 auto; }
.ad-inner img { max-width: 100%; height: auto; }
.ad-inner.ad-scaled { max-width: none; transform-origin: top left; margin: 0; }
.ad-mobile .ad-inner:not(.ad-scaled) { max-width: 300px; }
.ad-mobile .ad-inner { min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.site-header .header-ad { flex: 1 1 320px; max-width: 728px; margin-left: auto; }
.header-ad-row .header-ad { margin: 0 auto; }

/* ---------- Member accounts ---------- */
.nav-tools { display: flex; align-items: center; gap: .5rem; }
.nav-account { width: 38px; height: 38px; border-radius: 50%; border: 0; padding: 0; background: rgba(255, 255, 255, .16); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; overflow: hidden; }
.nav-account:hover { background: rgba(255, 255, 255, .28); color: #fff; }
.main-nav.nav-light .nav-account { background: var(--primary-soft); color: var(--primary); }
.nav-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; font-size: .95rem; }
.account-menu .dropdown-menu { border-radius: var(--radius-sm, 8px); min-width: 220px; box-shadow: 0 16px 34px -12px rgba(15, 23, 42, .35); }
.account-menu .dropdown-header { color: var(--text); white-space: normal; }
.account-menu .dropdown-header small { color: var(--muted); }

.auth-box { max-width: 460px; margin: 1rem auto 2rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.25rem 2rem; }
.auth-box h1 { font-size: 1.6rem; font-weight: 800; margin: .25rem 0 .35rem; }
.auth-icon { width: 58px; height: 58px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); font-size: 1.6rem; display: inline-flex; align-items: center; justify-content: center; }
.cards-shadow .auth-box, .cards-shadow .account-card, .cards-shadow .account-panel { border-color: transparent; box-shadow: 0 8px 28px -14px rgba(15, 23, 42, .22); }
.resend-box { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: center; background: var(--primary-soft); border-radius: var(--radius-sm, 8px); padding: .6rem; }
.otp-input { letter-spacing: .5em; font-weight: 700; font-variant-numeric: tabular-nums; }
.reset-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1.25rem; }
.reset-switch button { display: flex; align-items: center; gap: .65rem; text-align: left; padding: .75rem .85rem; border: 1.5px solid var(--border); border-radius: 12px; background: var(--card); color: inherit; transition: border-color .15s, background .15s, box-shadow .15s; }
.reset-switch button > i { font-size: 1.35rem; color: var(--muted, #64748b); }
.reset-switch button strong { display: block; font-size: .95rem; line-height: 1.2; }
.reset-switch button small { display: block; font-size: .75rem; color: var(--muted, #64748b); }
.reset-switch button:hover { border-color: var(--primary); }
.reset-switch button.active { border-color: var(--primary); background: var(--primary-soft, #eff6ff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.reset-switch button.active > i { color: var(--primary); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: .6rem; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; }
.btn-google:hover, .btn-google:focus { background: #f7f8f8; color: #1f1f1f; border-color: #c6c9cc; }
.auth-or { display: flex; align-items: center; gap: .75rem; margin: 1.1rem 0; color: var(--muted, #6c757d); font-size: .85rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
@media (max-width: 575.98px) { .auth-box { padding: 1.5rem 1.1rem; } }

.account-card, .account-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.account-card h2 { font-size: 1.15rem; font-weight: 800; margin: .75rem 0 .15rem; }
.account-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; font-size: 2.2rem; display: inline-flex; }
.account-avatar.sm { width: 72px; height: 72px; font-size: 1.7rem; flex: none; }
.account-nav { text-align: left; }
.account-nav a, .account-nav button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .8rem; border-radius: var(--radius-sm, 8px); color: var(--text); font-weight: 500; border: 0; background: none; text-align: left; }
.account-nav a:hover, .account-nav button:hover { background: var(--primary-soft); color: var(--primary); }
.account-nav a.active { background: var(--primary); color: #fff; }
.account-nav .count { margin-left: auto; font-size: .75rem; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 0 .55rem; font-weight: 700; }
.account-nav a.active .count { background: rgba(255, 255, 255, .25); color: #fff; }
.account-nav button { color: #dc2626; }
.account-panel h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 1.25rem; }
.saved-row { display: flex; align-items: center; gap: .75rem; border-bottom: 1px dashed var(--border); }
.saved-row .mini-post { flex: 1; border: 0; }
.my-comment { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.my-comment:last-child { border-bottom: 0; }

.save-btn { width: auto !important; border-radius: 999px !important; padding: 0 1rem; background: var(--primary-soft) !important; color: var(--primary) !important; font-weight: 600; font-size: .9rem; gap: .35rem; margin-left: auto; }
.save-btn.saved { background: var(--primary) !important; color: #fff !important; }
.comment-avatar { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.member-badge { color: var(--primary); font-size: .85rem; }
.login-to-comment { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; background: var(--primary-soft); border-radius: var(--radius-sm, 8px); padding: 1rem 1.1rem; }
.login-to-comment span { margin-right: auto; }
