/* ============================================
   RIKAF - Additional WordPress-specific CSS
   (Supplements style.css with WordPress-specific tweaks)
   ============================================ */

/* WordPress admin bar offset */
body.admin-bar .header { top: 32px; }
@media (max-width: 782px) {
        body.admin-bar .header { top: 46px; }
}

/* Search form alignment in header */
.header__search .search-form {
        display: flex;
        align-items: stretch;
        width: 100%;
}
.header__search .search-form select,
.header__search .search-form input[type="search"] {
        border: none;
        background: var(--bg-alt);
        padding: 0 14px;
        font-family: inherit;
        font-size: 14px;
}
.header__search .search-form input[type="search"] {
        flex: 1;
        border-radius: 0;
        min-width: 0;
}
.header__search .search-form select {
        border-radius: var(--radius) 0 0 var(--radius);
        appearance: none;
        -webkit-appearance: none;
        font-family: inherit;
        cursor: pointer;
        min-width: 120px;
}
.header__search .search-form .search-submit {
        background: var(--primary);
        color: white;
        border: none;
        padding: 0 18px;
        border-radius: 0 var(--radius) var(--radius) 0;
        cursor: pointer;
        font-size: 16px;
        transition: var(--transition);
}
.header__search .search-form .search-submit:hover {
        background: var(--primary-dark);
}

/* Sticky WordPress admin-bar adjustment for floating buttons */
.floating-buttons { z-index: 999; }

/* Pagination: WordPress-style classes mapped to Rikaf pagination */
.pagination .nav-links {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        margin: 40px 0 0;
        flex-wrap: wrap;
}
.pagination .page-numbers {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        height: 40px;
        padding: 0 12px;
        border-radius: var(--radius-sm);
        background: var(--white);
        border: 1px solid var(--border);
        color: var(--text);
        font-weight: 600;
        transition: var(--transition);
        text-decoration: none;
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
}
.pagination .page-numbers.dots {
        border: none;
        background: transparent;
}

/* Comments area */
.comments-area { margin-top: 40px; }
.comments-title {
        font-family: var(--font-display);
        font-size: 1.5rem;
        margin-bottom: 24px;
        color: var(--text);
}
.comment-list {
        list-style: none;
        padding: 0;
}
.comment-list .comment {
        background: var(--white);
        border-radius: var(--radius-md);
        padding: 20px;
        margin-bottom: 16px;
        box-shadow: var(--shadow-sm);
}
.comment-list .comment .comment-body { display: flex; gap: 16px; }
.comment-list .comment .avatar {
        border-radius: 50%;
        width: 56px;
        height: 56px;
}
.comment-list .comment .comment-content { flex: 1; }
.comment-list .comment .comment-content p { margin-bottom: 8px; }
.comment-list .comment .comment-meta {
        font-size: 13px;
        color: var(--text-muted);
        margin-bottom: 8px;
}
.comment-list .children {
        list-style: none;
        padding-right: 24px;
        margin-top: 16px;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
        width: 100%;
        padding: 12px 16px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        font-family: inherit;
        font-size: 14px;
        background: var(--white);
}
.comment-form textarea { resize: vertical; min-height: 120px; }
.comment-form p { margin-bottom: 16px; }
.comment-form label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.comment-form .form-submit { margin-top: 24px; }

/* 404 page */
.error-404 {
        text-align: center;
        max-width: 720px;
        margin: 60px auto;
}
.error-404__icon {
        position: relative;
        display: inline-block;
        margin-bottom: 24px;
        color: var(--primary);
}
.error-404__icon i { font-size: 64px; opacity: 0.4; }
.error-404__code {
        display: block;
        font-family: var(--font-display);
        font-size: 96px;
        font-weight: 900;
        line-height: 1;
        color: var(--primary);
        margin-top: 12px;
}
.error-404__title {
        font-family: var(--font-display);
        font-size: 28px;
        margin-bottom: 16px;
        color: var(--text);
}
.error-404__text {
        font-size: 16px;
        color: var(--text-light);
        line-height: 1.8;
        margin-bottom: 32px;
}
.error-404__search {
        max-width: 540px;
        margin: 0 auto 32px;
}
.error-404__actions {
        display: flex;
        gap: 12px;
        justify-content: center;
        flex-wrap: wrap;
}

/* No results message */
.no-results {
        text-align: center;
        padding: 60px 20px;
        color: var(--text-muted);
}
.no-results i { font-size: 48px; margin-bottom: 16px; color: var(--border); }

/* Single blog post */
.single-post__header { margin: 40px 0 24px; text-align: center; }
.single-post__category {
        display: inline-block;
        background: var(--primary-light);
        color: var(--primary);
        padding: 4px 14px;
        border-radius: 999px;
        font-size: 13px;
        font-weight: 700;
        margin-bottom: 12px;
}
.single-post__title {
        font-family: var(--font-display);
        font-size: 36px;
        line-height: 1.3;
        margin-bottom: 16px;
        color: var(--text);
}
.single-post__meta {
        display: flex;
        justify-content: center;
        gap: 20px;
        flex-wrap: wrap;
        color: var(--text-muted);
        font-size: 14px;
}
.single-post__meta i { margin-left: 4px; }
.single-post__thumbnail {
        border-radius: var(--radius-md);
        overflow: hidden;
        margin-bottom: 32px;
        max-height: 480px;
}
.single-post__thumbnail img { width: 100%; height: auto; display: block; }
.single-post__content {
        font-size: 17px;
        line-height: 1.9;
        color: var(--text);
        max-width: 760px;
        margin: 0 auto 32px;
}
.single-post__content h2,
.single-post__content h3,
.single-post__content h4 {
        font-family: var(--font-display);
        margin: 28px 0 14px;
        color: var(--text);
}
.single-post__content p { margin-bottom: 18px; }
.single-post__content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 16px 0; }
.single-post__content blockquote {
        border-right: 4px solid var(--gold);
        padding: 14px 20px;
        background: var(--gold-light);
        border-radius: var(--radius-sm);
        font-style: italic;
        margin: 20px 0;
}
.single-post__footer {
        display: flex;
        justify-content: space-between;
        gap: 20px;
        flex-wrap: wrap;
        padding: 20px 0;
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        margin-bottom: 40px;
        max-width: 760px;
        margin-left: auto;
        margin-right: auto;
}
.single-post__tags a,
.single-post__categories a {
        display: inline-block;
        padding: 4px 10px;
        background: var(--bg-alt);
        color: var(--text);
        border-radius: 6px;
        font-size: 13px;
        text-decoration: none;
        margin: 0 4px 4px 0;
        transition: var(--transition);
}
.single-post__tags a:hover,
.single-post__categories a:hover {
        background: var(--primary);
        color: white;
}

/* Page (static) */
.rikaf-page { padding: 40px 0; }
.rikaf-page .entry-header { text-align: center; margin-bottom: 32px; }
.rikaf-page .entry-title {
        font-family: var(--font-display);
        font-size: 32px;
        color: var(--text);
}
.rikaf-page .entry-thumbnail {
        border-radius: var(--radius-md);
        overflow: hidden;
        margin-bottom: 32px;
}
.rikaf-page .entry-content {
        max-width: 760px;
        margin: 0 auto;
        font-size: 17px;
        line-height: 1.9;
        color: var(--text);
}
.rikaf-page .entry-footer {
        text-align: center;
        margin-top: 40px;
}

/* Widgets */
.widget { margin-bottom: 24px; }
.widget__title,
.footer__widget-title {
        font-family: var(--font-display);
        font-size: 16px;
        margin-bottom: 14px;
        color: var(--text);
        font-weight: 700;
}
.footer__widget-title { color: white; margin-bottom: 18px; }
.widget ul {
        list-style: none;
        padding: 0;
}
.widget ul li {
        padding: 8px 0;
        border-bottom: 1px solid var(--border-light);
}
.widget ul li:last-child { border-bottom: none; }
.widget a { color: var(--text); text-decoration: none; transition: var(--transition); }
.widget a:hover { color: var(--primary); }

/* WooCommerce-specific tweaks */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
        border-top-color: var(--primary);
        background: var(--primary-lighter);
        border-radius: var(--radius-sm);
        padding: 14px 18px;
        margin-bottom: 16px;
}
.woocommerce-message::before,
.woocommerce-info::before { color: var(--primary); }
.woocommerce-error { border-top-color: var(--red); background: var(--red-light); }
.woocommerce-error::before { color: var(--red); }

/* Make WooCommerce's <ul class="products"> transparent to the Rikaf grid layout.
   Each <li> wrapping a .book-card will participate directly in the grid. */
.woocommerce-books-grid ul.products,
.books-grid ul.products,
ul.products.woocommerce-books-grid {
        display: contents !important;
        list-style: none;
        margin: 0;
        padding: 0;
}
.woocommerce-books-grid ul.products > li,
.books-grid ul.products > li,
ul.products.woocommerce-books-grid > li {
        /* Let the inner .book-card fill the grid cell. */
        padding: 0;
        background: transparent;
}
.woocommerce-products-header { display: none; }
.woocommerce-result-count { color: var(--text-muted); }
.woocommerce-ordering select {
        padding: 8px 14px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        font-family: inherit;
        background: var(--white);
}

.woocommerce-breadcrumb { font-size: 14px; color: var(--text-muted); }
.woocommerce-breadcrumb a { color: var(--text); text-decoration: none; }
.woocommerce-breadcrumb a:hover { color: var(--primary); }

/* Single WooCommerce product */
.woocommerce div.product .product_title {
        font-family: var(--font-display);
        font-size: 32px;
        margin-bottom: 8px;
}
.woocommerce div.product p.price,
.woocommerce div.product span.price {
        color: var(--primary);
        font-size: 24px;
        font-weight: 700;
}
.woocommerce div.product p.price ins,
.woocommerce div.product span.price ins { text-decoration: none; }
.woocommerce div.product p.price del,
.woocommerce div.product span.price del {
        color: var(--text-muted);
        font-size: 16px;
        margin-left: 8px;
}
.woocommerce button.button,
.woocommerce button.button.alt,
.woocommerce a.button,
.woocommerce a.button.alt,
.woocommerce input.button,
.woocommerce #respond input#submit {
        background: var(--primary);
        color: white;
        border: none;
        padding: 12px 28px;
        border-radius: var(--radius-sm);
        font-family: inherit;
        font-weight: 700;
        cursor: pointer;
        transition: var(--transition);
}
.woocommerce button.button:hover,
.woocommerce button.button.alt:hover,
.woocommerce a.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover {
        background: var(--primary-dark);
        color: white;
}
.woocommerce button.button.btn--gold,
.woocommerce a.button.btn--gold { background: var(--gold); }
.woocommerce button.button.btn--gold:hover,
.woocommerce a.button.btn--gold:hover { background: var(--gold-dark); }

.woocommerce-tabs ul.tabs {
        list-style: none;
        padding: 0;
        margin: 0 0 24px;
        display: flex;
        gap: 4px;
        border-bottom: 1px solid var(--border);
        flex-wrap: wrap;
}
.woocommerce-tabs ul.tabs li {
        margin: 0;
        padding: 12px 20px;
        cursor: pointer;
        border-bottom: 3px solid transparent;
}
.woocommerce-tabs ul.tabs li.active {
        border-bottom-color: var(--primary);
        color: var(--primary);
        font-weight: 700;
}
.woocommerce-tabs ul.tabs li a { text-decoration: none; color: inherit; }

/* Cart table RTL fixes */
.woocommerce-cart table.cart { text-align: right; }
.woocommerce-cart table.cart td.actions .coupon .input-text {
        float: right;
        margin-left: 8px;
        margin-right: 0;
}

/* Account / login */
.woocommerce-account .woocommerce-MyAccount-navigation ul {
        list-style: none;
        padding: 0;
        background: var(--white);
        border-radius: var(--radius-md);
        overflow: hidden;
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li {
        border-bottom: 1px solid var(--border-light);
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li.is-active {
        background: var(--primary-light);
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li a {
        display: block;
        padding: 14px 20px;
        text-decoration: none;
        color: var(--text);
}
.woocommerce-account .woocommerce-MyAccount-navigation ul li a:hover {
        background: var(--bg-alt);
}

/* Skip link (a11y) */
.skip-link {
        position: absolute;
        right: -9999px;
        top: 0;
        background: var(--primary);
        color: white;
        padding: 12px 20px;
        z-index: 10000;
        border-radius: 0 0 0 var(--radius-sm);
        text-decoration: none;
        font-weight: 700;
}
.skip-link:focus {
        right: 0;
}

/* Screen-reader-text (WordPress standard) */
.screen-reader-text {
        border: 0;
        clip: rect(1px, 1px, 1px, 1px);
        clip-path: inset(50%);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute !important;
        width: 1px;
        word-wrap: normal !important;
}
.screen-reader-text:focus {
        background-color: #fff;
        border-radius: 3px;
        box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
        clip: auto !important;
        clip-path: none;
        color: #21759b;
        display: block;
        font-size: 14px;
        font-weight: 700;
        height: auto;
        right: 5px;
        line-height: normal;
        padding: 15px 23px 14px;
        text-decoration: none;
        top: 5px;
        width: auto;
        z-index: 100000;
}

/* Sticky post */
.blog-card.sticky {
        border: 2px solid var(--gold);
}

/* Custom logo sizing — ensure no overflow in header */
.header__logo img,
.custom-logo {
        max-height: 64px;
        width: auto;
        height: auto;
}

/* Hide "no-results" cart badge when empty is acceptable */
.header__action--cart .header__badge:empty { display: none; }

/* ============================================
   ALL CATEGORIES DROPDOWN (mega-menu)
   Toggled by the "كل الأقسام" button in the main nav.
   ============================================ */
.main-nav { position: relative; }
.main-nav__categories-dropdown {
        position: absolute;
        top: 100%;
        right: 0;
        width: 320px;
        max-height: 450px;
        overflow-y: auto;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
        padding: 8px;
        z-index: 100;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.main-nav__categories-dropdown.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
}
.categories-dropdown__list { list-style: none; margin: 0; padding: 0; }
.categories-dropdown__list li a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        border-radius: 8px;
        color: #1f2937;
        text-decoration: none;
        transition: background 0.15s;
}
.categories-dropdown__list li a:hover,
.categories-dropdown__list li a:focus-visible { background: #f3f4f6; }
.categories-dropdown__list li a i { width: 20px; color: #027CC1; text-align: center; }
.categories-dropdown__list li a span { flex: 1; font-size: 14px; }
.categories-dropdown__list li a small { color: #9ca3af; font-size: 12px; }
.categories-dropdown__empty {
        padding: 16px 12px;
        text-align: center;
        color: #6b7280;
        margin: 0;
        font-size: 14px;
}
@media (max-width: 768px) {
        .main-nav__categories-dropdown { width: calc(100vw - 32px); right: 16px; }
}
