/* Muallam overrides on top of the ZenBlog template (frontend/css/main.css). */

/*
 * Theme: the look of the original muallam.com - Poppins everywhere, near-black text and
 * bold headings, Bootstrap's standard blue for buttons and links.
 * Every ZenBlog and Muallam style reads these variables, so this block sets the whole look.
 */
:root {
    --default-font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --heading-font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --nav-font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --default-color: #252525;
    --heading-color: #252525;
    --accent-color: #0d6efd;
    --accent-hover-color: #0b5ed7;
    --accent-active-color: #0a58ca;
    --nav-color: #505050;
    --nav-hover-color: #0d6efd;
    --nav-dropdown-color: #505050;
    --nav-dropdown-hover-color: #0d6efd;
    --bs-body-font-family: var(--default-font);
    --bs-link-color: #0d6efd;
    --bs-link-hover-color: #0a58ca;
}

h1, h2, h3 {
    font-weight: 700;
}

h4, h5, h6 {
    font-weight: 600;
}

a {
    color: var(--accent-color);
}

a:hover {
    color: var(--accent-active-color);
}

/* Header */
.header {
    border-bottom: 1px solid #e9ecef;
    padding: 12px 0;
}

.header .logo h1 {
    font-weight: 700;
}

.header-account-toggle {
    color: var(--default-color);
    text-decoration: none;
    font-family: var(--nav-font);
    font-size: 0.95rem;
}

.header-account-toggle:hover,
.header-account-toggle:focus {
    color: var(--accent-color);
}

.user-avatar {
    flex-shrink: 0;
    object-fit: cover;
}

.user-avatar-initials {
    border-radius: 50%;
    background: var(--accent-color);
    color: var(--contrast-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--nav-font);
    font-weight: 600;
}

.header .dropdown-menu {
    font-family: var(--nav-font);
    font-size: 0.95rem;
}

/* Below 1200px ZenBlog orders the logo (1) and the menu toggle (3); keep the account area between them. */
@media (max-width: 1200px) {
    .header .header-account {
        order: 2;
        margin-right: 0.75rem;
    }
}

/* Buttons in the brand colour */
.btn-accent {
    --bs-btn-color: var(--contrast-color);
    --bs-btn-bg: var(--accent-color);
    --bs-btn-border-color: var(--accent-color);
    --bs-btn-hover-color: var(--contrast-color);
    --bs-btn-hover-bg: var(--accent-hover-color);
    --bs-btn-hover-border-color: var(--accent-active-color);
    --bs-btn-active-color: var(--contrast-color);
    --bs-btn-active-bg: var(--accent-active-color);
    --bs-btn-active-border-color: #0a53be;
    font-family: var(--nav-font);
}

.btn-outline-accent {
    --bs-btn-color: var(--accent-color);
    --bs-btn-border-color: var(--accent-color);
    --bs-btn-hover-color: var(--contrast-color);
    --bs-btn-hover-bg: var(--accent-color);
    --bs-btn-hover-border-color: var(--accent-color);
    --bs-btn-active-color: var(--contrast-color);
    --bs-btn-active-bg: var(--accent-color);
    --bs-btn-active-border-color: var(--accent-color);
    font-family: var(--nav-font);
}

/* Home */
.home-hero {
    padding: 72px 0;
}

.home-hero-lead {
    max-width: 640px;
}

.empty-state {
    border: 1px dashed #dee2e6;
    border-radius: 8px;
}

/* Footer */
.footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

/* Error pages */
.error-page {
    padding: 96px 0;
}

.error-page .error-code {
    font-family: var(--nav-font);
    font-size: 4.5rem;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1;
}

[x-cloak] {
    display: none !important;
}

/* Sign up / sign in */
.auth-section {
    padding: 56px 0 72px;
}

.auth-card {
    border: 1px solid #e9ecef;
    border-radius: 12px;
}

.field-error {
    color: var(--bs-form-invalid-color);
    font-size: 0.875rem;
    min-height: 1.25rem;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    color: var(--bs-secondary-color);
    z-index: 5;
}

.password-strength .progress {
    height: 4px;
}

/* Keep Bootstrap's valid/invalid icon clear of the show-password button. */
.form-control.has-toggle {
    padding-right: 4.5rem;
}

.form-control.has-toggle.is-valid,
.form-control.has-toggle.is-invalid {
    background-position: right 2.75rem center;
}

/*
 * No glow around fields: Bootstrap's focus ring (box-shadow) is switched off for inputs, text areas and
 * selects in every state. The border colour still shows which field is active (blue), invalid (red) or valid (green).
 */
.form-control:focus,
.form-select:focus,
.form-control.is-valid:focus,
.form-control.is-invalid:focus,
.form-select.is-valid:focus,
.form-select.is-invalid:focus,
.was-validated .form-control:valid:focus,
.was-validated .form-control:invalid:focus,
.was-validated .form-select:valid:focus,
.was-validated .form-select:invalid:focus {
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-color);
}

/*
 * Floating labels in the old site's style: the label starts inside the box and, once the field is focused
 * or filled, moves up onto the top border (smaller, blue while typing). Restyles Bootstrap's .form-floating,
 * so the markup stays standard.
 */
.form-floating > .form-control,
.form-floating > .form-select {
    height: 3.25rem;
    min-height: 3.25rem;
    padding: 0.75rem 1rem;
    line-height: 1.5;
}

.form-floating > textarea.form-control {
    height: auto;
    padding-top: 0.9rem;
}

/* Bootstrap pushes the text down to make room for a label inside the box; ours sits on the border instead. */
.form-floating > .form-control:focus,
.form-floating > .form-control:not(:placeholder-shown),
.form-floating > .form-control:-webkit-autofill {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.form-floating > textarea.form-control:focus,
.form-floating > textarea.form-control:not(:placeholder-shown) {
    padding-top: 0.9rem;
}

.form-floating > label {
    top: 50%;
    left: 0.7rem;
    height: auto;
    max-width: calc(100% - 1.4rem);
    padding: 0 0.35rem;
    border: 0;
    line-height: 1.2;
    color: #777;
    /* Same colour as the card behind it, so the label hides the border line it sits on. */
    background-color: var(--bs-card-bg, var(--bs-body-bg));
    transform: translateY(-50%);
    transform-origin: left center;
    transition: top 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.form-floating > textarea ~ label {
    top: 1.5rem;
}

.form-floating > label::after {
    display: none;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-control:-webkit-autofill ~ label,
.form-floating > .form-select ~ label {
    top: 0;
    color: #252525;
    transform: translateY(-50%) scale(0.85);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-select:focus ~ label {
    color: var(--accent-color);
}

.form-floating > .form-control.is-invalid ~ label,
.form-floating > .form-select.is-invalid ~ label {
    color: var(--bs-form-invalid-color);
}

.form-floating > .form-control:disabled ~ label,
.form-floating > .form-select:disabled ~ label {
    color: var(--bs-secondary-color);
}

/* Unverified email reminder under the header */
.verify-email-banner {
    background: #fff8e1;
    border-bottom: 1px solid #f3e2a9;
    color: #5c4a12;
    font-family: var(--nav-font);
    font-size: 0.9rem;
}

/* Member area */
.member-area {
    padding: 32px 0 64px;
}

.member-nav-links {
    flex-direction: column;
    gap: 2px;
}

.member-nav-links .nav-link {
    color: var(--default-color);
    font-family: var(--nav-font);
    font-size: 0.95rem;
    border-radius: 8px;
}

.member-nav-links .nav-link:hover {
    background: #f1f3f5;
}

.member-nav-links .nav-link.active {
    background: var(--accent-color);
    color: var(--contrast-color);
}

/* Below lg the sidebar becomes a horizontal, scrollable row of tabs. */
@media (max-width: 991.98px) {
    .member-nav-links {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        border-bottom: 1px solid #e9ecef;
        padding-bottom: 8px;
    }

    .member-nav-links .nav-link {
        white-space: nowrap;
    }
}

.stat-card {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    height: 100%;
}

.stat-card .stat-value {
    font-family: var(--nav-font);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-card .stat-label {
    font-family: var(--nav-font);
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

/* Every status badge is as wide as the longest label ("Restricted"), so they line up. */
.post-status-badge {
    display: inline-block;
    min-width: 6.25rem;
    text-align: center;
}

/* Profile page */
.profile-photo-preview {
    width: 96px;
    height: 96px;
}

.settings-card {
    border: 1px solid #e9ecef;
    border-radius: 10px;
}

.profile-link {
    font-size: 0.9rem;
    background: #f1f3f5;
    padding: 4px 8px;
    border-radius: 6px;
}

.profile-bio {
    font-size: 1rem;
    line-height: 1.75;
}

/* Category and post cards */
.category-card,
.post-card {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    color: var(--default-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.category-card:hover,
.post-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Card halves: the top (image, title, summary) opens the post, the strip below the line opens the author. */
.post-card-main,
.post-card-author {
    color: inherit;
    text-decoration: none;
}

.post-card-title {
    color: var(--heading-color);
    transition: color 0.2s;
}

a.post-card-main:hover .post-card-title,
a.post-card-main:focus-visible .post-card-title {
    color: var(--accent-color);
}

.post-card-author {
    border-top: 1px solid #e9ecef;
    padding: 0.75rem var(--bs-card-spacer-x);
    border-radius: 0 0 10px 10px;
    transition: background-color 0.2s;
}

a.post-card-author:hover,
a.post-card-author:focus-visible {
    background-color: #f5f8ff;
}

a.post-card-author:hover .post-card-author-name,
a.post-card-author:focus-visible .post-card-author-name {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Post editor */
.post-editor .ql-toolbar.ql-snow {
    border-radius: 8px 8px 0 0;
    border-color: #dee2e6;
    background: #f8f9fa;
}

.post-editor .ql-container.ql-snow {
    border-radius: 0 0 8px 8px;
    border-color: #dee2e6;
    min-height: 360px;
    font-family: var(--default-font);
    font-size: 1rem;
}

.post-editor.is-invalid .ql-toolbar.ql-snow,
.post-editor.is-invalid .ql-container.ql-snow {
    border-color: var(--bs-form-invalid-border-color);
}

.featured-preview {
    max-height: 200px;
    width: 100%;
    object-fit: cover;
}

.post-filters .nav-link {
    font-family: var(--nav-font);
    font-size: 0.9rem;
    padding: 0.35rem 0.75rem;
}

.post-filters .nav-link.active {
    background: var(--accent-color);
}

/* Post card image */
.post-card-image {
    height: 180px;
    object-fit: cover;
    border-radius: 10px 10px 0 0;
}

/* Preview */
.preview-banner {
    background: #e7f1ff;
    border-bottom: 1px solid #b6d4fe;
    color: #084298;
    font-family: var(--nav-font);
    font-size: 0.9rem;
}

/* Admin changes (word-by-word highlights for the author) */
.diff-added {
    background: #d1e7dd;
    color: #0a3622;
    text-decoration: none;
    border-radius: 3px;
    padding: 0 2px;
}

.diff-removed {
    background: #f8d7da;
    color: #58151c;
    text-decoration: line-through;
    border-radius: 3px;
    padding: 0 2px;
}

.post-diff .diff-block {
    margin-bottom: 0.9rem;
    line-height: 1.7;
}

.post-diff .diff-block-same {
    color: #6c757d;
}

.post-diff .diff-block-changed,
.post-diff .diff-block-added,
.post-diff .diff-block-removed {
    border-left: 3px solid var(--accent-color);
    padding-left: 0.75rem;
}

.post-diff .diff-heading {
    font-weight: 600;
    font-size: 1.15rem;
}

.post-diff .diff-list-item::before {
    content: "\2022  ";
}

.post-diff .diff-quote {
    font-style: italic;
}

/* Full post */
.post-article-title {
    font-size: clamp(1.9rem, 4vw, 2.75rem);
    line-height: 1.2;
}

.post-article-image {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: 10px;
}

.post-content {
    font-size: 1.05rem;
    line-height: 1.85;
    overflow-wrap: break-word;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.post-content blockquote {
    border-left: 4px solid #dee2e6;
    padding-left: 1rem;
    color: var(--bs-secondary-color);
    font-style: italic;
}

.post-content pre {
    background: #f6f8fa;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.post-content .ql-align-center { text-align: center; }
.post-content .ql-align-right { text-align: right; }
.post-content .ql-align-justify { text-align: justify; }

.post-footer {
    border-top: 1px solid #e9ecef;
}

.author-box {
    background: #f8f9fa;
    border-radius: 10px;
}

/* Search */
.home-search {
    max-width: 560px;
}

.header-search .form-control {
    width: 180px;
    border-radius: 20px;
    font-family: var(--nav-font);
}

/* Home page: featured slider */
.featured-slider {
    border-radius: 12px;
    overflow: hidden;
}

.featured-slide {
    position: relative;
    display: flex;
    align-items: flex-end;
    height: 400px;
    color: #fff;
    text-decoration: none;
    background: #252525;
}

.featured-slide-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.featured-slide:hover .featured-slide-image {
    transform: scale(1.03);
}

/* Darkens the bottom of the picture so the white text stays readable on any photo. */
.featured-slide::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.35) 50%, rgba(0, 0, 0, 0) 80%);
}

.featured-slide-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    padding: 2rem 2.5rem 2.75rem;
}

.featured-slide-category {
    display: inline-block;
    background: var(--accent-color);
    color: #fff;
    font-family: var(--nav-font);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.3em 0.75em;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.featured-slide-title {
    color: #fff;
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    line-height: 1.25;
    margin-bottom: 0.5rem;
}

.featured-slide-summary {
    color: rgba(255, 255, 255, 0.88);
    margin-bottom: 0.75rem;
}

.featured-slide-meta {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

.featured-slider .swiper-pagination-bullet {
    background: #fff;
    opacity: 0.6;
}

.featured-slider .swiper-pagination-bullet-active {
    background: var(--accent-color);
    opacity: 1;
}

.featured-slider .swiper-button-prev,
.featured-slider .swiper-button-next {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: #252525;
    top: 45%;
}

.featured-slider .swiper-button-prev::after,
.featured-slider .swiper-button-next::after {
    font-size: 1rem;
    font-weight: 700;
}

@media (max-width: 767.98px) {
    .featured-slide {
        height: 300px;
    }

    .featured-slide-content {
        padding: 1.25rem 1.25rem 2.25rem;
    }

    .featured-slider .swiper-button-prev,
    .featured-slider .swiper-button-next {
        display: none;
    }
}

/* Home page: section headings and category blocks */
.home-section-heading {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.post-mini-list li + li {
    border-top: 1px solid #e9ecef;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
}

.post-mini {
    color: var(--default-color);
    text-decoration: none;
}

.post-mini-image {
    flex: 0 0 auto;
    width: 84px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
}

.post-mini-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    color: #adb5bd;
    font-size: 1.4rem;
}

.post-mini-title {
    font-family: var(--heading-font);
    font-weight: 600;
    line-height: 1.35;
    color: var(--heading-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}

.post-mini:hover .post-mini-title,
.post-mini:focus-visible .post-mini-title {
    color: var(--accent-color);
}

/* Visitors who asked their system for less motion get no scroll animations. */
@media (prefers-reduced-motion: reduce) {
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .featured-slide-image {
        transition: none;
    }
}

/* Share buttons (post page): round brand-coloured icons */
.share-label {
    font-family: var(--nav-font);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--heading-color);
}

.share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    font-size: 1.05rem;
    text-decoration: none;
    transition: transform 0.15s, filter 0.15s;
}

.share-button:hover,
.share-button:focus-visible {
    color: #fff;
    filter: brightness(0.9);
    transform: translateY(-2px);
}

.share-facebook { background: #1877f2; }
.share-whatsapp { background: #25d366; }
.share-linkedin { background: #0a66c2; }
.share-x { background: #000; }
.share-telegram { background: #229ed9; }
.share-email { background: #6c757d; }
.share-copy,
.share-native { background: #e9ecef; color: #252525; }

.share-copy:hover,
.share-copy:focus-visible,
.share-native:hover,
.share-native:focus-visible {
    color: #252525;
}

.share-copy.is-copied {
    background: #198754;
    color: #fff;
}

.share-copied {
    color: #198754;
}

@media (prefers-reduced-motion: reduce) {
    .share-button {
        transition: none;
    }

    .share-button:hover {
        transform: none;
    }
}

/* Online status: green dot on avatars, "Active now" on the bio page */
.user-avatar-presence {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.online-dot {
    position: absolute;
    right: 2%;
    bottom: 2%;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px #fff;
}

.presence-label {
    color: var(--bs-secondary-color);
}

.presence-label.is-online {
    color: #15803d;
    font-weight: 500;
}

.presence-label.is-online::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 0.4rem;
    border-radius: 50%;
    background: #22c55e;
    vertical-align: 0.05em;
}

/* Contact page */
.contact-card {
    border: 1px solid #e9ecef;
    border-radius: 12px;
}

/* Spam trap: kept off-screen rather than display:none, which some bots skip. */
.contact-trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Privacy policy and terms */
.legal-page {
    line-height: 1.75;
}

.legal-page h3 {
    font-size: 1.2rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    scroll-margin-top: 90px;
}

.legal-toc {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.legal-toc ol {
    columns: 2;
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

@media (max-width: 575.98px) {
    .legal-toc ol {
        columns: 1;
    }
}

/* Right-hand sidebar (home and post pages): categories now, space for ads later */
.site-sidebar {
    position: sticky;
    top: 90px;
}

.sidebar-box {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1.25rem;
}

.sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--heading-color);
    margin-bottom: 0.75rem;
}

.sidebar-categories a {
    display: block;
    padding: 0.4rem 0.75rem;
    margin: 0 -0.75rem;
    border-radius: 6px;
    color: var(--default-color);
    font-family: var(--nav-font);
    font-size: 0.95rem;
}

.sidebar-categories a:hover {
    background: #f1f5ff;
    color: var(--accent-color);
}

.sidebar-categories a.active {
    background: var(--accent-color);
    color: var(--contrast-color);
    font-weight: 500;
}

/* Below the large breakpoint the sidebar drops under the content and should scroll normally. */
@media (max-width: 991.98px) {
    .site-sidebar {
        position: static;
    }
}

/* Breadcrumbs */
.site-breadcrumbs .breadcrumb {
    font-family: var(--nav-font);
}

.site-breadcrumbs .breadcrumb-item a {
    color: var(--accent-color);
    text-decoration: none;
}

.site-breadcrumbs .breadcrumb-item a:hover {
    text-decoration: underline;
}

.site-breadcrumbs .breadcrumb-item.active {
    color: var(--bs-secondary-color);
}

/* Like button */
.like-button {
    border: 1px solid #dee2e6;
    border-radius: 20px;
    color: var(--default-color);
    font-family: var(--nav-font);
    padding: 0.2rem 0.75rem;
}

.like-button:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.like-button.is-liked {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--contrast-color);
}

.like-button .like-count {
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Comments */
.comments {
    border-top: 1px solid #e9ecef;
    padding-top: 1.5rem;
}

.comment {
    padding: 0.85rem 0;
    border-bottom: 1px solid #f1f3f5;
    scroll-margin-top: 90px;
}

.comment-replies {
    margin-left: 2.75rem;
    padding-left: 1rem;
    border-left: 2px solid #e9ecef;
}

.comment-replies .comment:last-child {
    border-bottom: 0;
}

.comment-body {
    overflow-wrap: anywhere;
}

.comment-hidden > .d-flex {
    opacity: 0.6;
}

.comment-actions .btn-link {
    text-decoration: none;
    font-family: var(--nav-font);
}
