/* Premium Stylesheet for Mossadegh Library Frontend Shortcode */

.ml-public-container {
    max-width: 1280px;
    box-sizing: border-box;
    font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif;
}

.ml-public-container.ml-public-content-only {
    margin-top: 15px;
}

.ml-public-container * {
    box-sizing: border-box;
}

/* Header & Title */
.ml-public-header {
    margin-bottom: 40px;
}

.ml-public-title {
    color: #1C2226;
    font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif;
}

/* Search Bar styling */

.ml-public-search-inner {
    display: flex;
    gap: 12px;
    max-width: 100%;
}

.ml-public-search-input-wrapper {
    position: relative;
    flex-grow: 1;
}

.ml-public-search-input-wrapper .ml-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    width: 20px;
    height: 20px;
    z-index: 2;
}

.ml-public-search-input {
    width: 100%;
    height: 54px;
    padding: 17px 17px 17px 48px !important;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #334155;
    background-color: #ffffff;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ml-public-search-input::placeholder {
    color: #788891;
    opacity: 1;
}

.ml-public-search-input:focus {
    outline: none;
    border-color: #0d9488;
    /* Teal border on focus */
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.ml-public-search-btn {
    height: 57px;
    padding: 17px 24px;
    background-color: #091F2C;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ml-public-search-btn:hover {
    background-color: #7A9DB0;
}

/* Main Layout split */
.ml-public-layout {
    display: flex;
    gap: 48px;
    align-items: flex-start;
}

/* Sidebar Filters */
.ml-public-sidebar {
    width: 276px;
    max-width: 276px;
    flex-shrink: 0;
    background-color: transparent;
    border: none;
    padding: 0;
    position: sticky;
    top: 40px;
}

.ml-sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid #B3C7D2;
    padding-bottom: 16px;
}

.ml-filter-icon {
    font-size: 16px;
}

.ml-sidebar-title {
    font-size: clamp(14px, 1.2vw, 16px);
    font-weight: 700;
    color: #3A4047;
    margin: 0;
}

.ml-filter-group {
    margin-bottom: 16px;
    border-bottom: 1px solid #B3C7D2;
    padding-bottom: 16px;
}

.ml-filter-group:last-child {
    border-bottom: none;
}

.ml-filter-group-title {
    font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
    font-weight: 700;
    color: #1C2226;
    margin: 0 0 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.ml-filter-options {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
    transition: max-height 0.25s ease-out, opacity 0.25s ease-out;
    opacity: 1;
}

.ml-filter-group.collapsed .ml-filter-options {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.ml-accordion-arrow {
    width: 16px !important;
    height: 16px !important;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    display: inline-block !important;
}

.ml-accordion-arrow path {
    stroke: #7A99AC !important;
}

.ml-filter-group.collapsed .ml-accordion-arrow {
    transform: rotate(-90deg);
}

/* Scrollbar styling for options */
.ml-filter-options::-webkit-scrollbar {
    width: 4px;
}

.ml-filter-options::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.ml-filter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: clamp(0.75rem, 0.7rem + 0.1vw, 0.8125rem);
    color: #58666E;
    user-select: none;
}

.ml-filter-checkbox,
#mossadegh-library-public-app input[type="checkbox"].ml-filter-checkbox,
aside.ml-public-sidebar input[type="checkbox"].ml-filter-checkbox {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
    border: 1.5px solid var(--border-primary, #9AAAB3) !important;
    border-radius: 5px !important;
    background-color: #ffffff !important;
    background-image: none !important;
    cursor: pointer !important;
    position: relative !important;
    transition: all 0.2s ease-in-out !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

.ml-filter-checkbox::before,
#mossadegh-library-public-app input[type="checkbox"].ml-filter-checkbox::before,
aside.ml-public-sidebar input[type="checkbox"].ml-filter-checkbox::before {
    content: "" !important;
    width: 9px !important;
    height: 5px !important;
    border-left: 2px solid #ffffff !important;
    border-bottom: 2px solid #ffffff !important;
    border-top: none !important;
    border-right: none !important;
    background: transparent !important;
    transform: rotate(-45deg) translate(0.5px, -0.5px) scale(0) !important;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform-origin: center !important;
    box-sizing: border-box !important;
}

.ml-filter-checkbox:checked,
#mossadegh-library-public-app input[type="checkbox"].ml-filter-checkbox:checked,
aside.ml-public-sidebar input[type="checkbox"].ml-filter-checkbox:checked {
    background-color: #6BA4B8 !important;
    border-color: #6BA4B8 !important;
    background-image: none !important;
}

.ml-filter-checkbox:checked::before,
#mossadegh-library-public-app input[type="checkbox"].ml-filter-checkbox:checked::before,
aside.ml-public-sidebar input[type="checkbox"].ml-filter-checkbox:checked::before {
    transform: rotate(-45deg) translate(0.5px, -0.5px) scale(1) !important;
}

.ml-filter-checkbox:focus,
.ml-filter-checkbox:active,
.ml-filter-checkbox:focus-visible,
#mossadegh-library-public-app input[type="checkbox"].ml-filter-checkbox:focus {
    outline: none !important;
    box-shadow: none !important;
}

.ml-checkbox-text {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ml-checkbox-count {
    color: #94a3b8;
    font-size: 11px;
}

.ml-reset-filters-btn {
    width: 100%;
    height: 56px;
    background-color: transparent;
    color: #091F2C;
    border: 1px solid #091F2C;
    border-radius: 8px;
    font-size: clamp(14px, 2vw, 16px);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ml-reset-filters-btn:hover {
    background-color: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

/* Main Content area */
.ml-public-main {
    flex-grow: 1;
}

/* Active Tags */
.ml-active-filters-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #B3C7D2;
}

.ml-active-label {
    font-size: 14px;
    font-weight: 400;
    color: #58666E;
    line-height: 1;
}

.ml-active-tags-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ml-tag-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #ECEEF0;
    border: none;
    border-radius: 100px;
    padding: 4px 12px;
    font-size: 14px;
    color: #3A4047;
    font-weight: 400;
    line-height: 1;
}

.ml-tag-remove-btn {
    border: none;
    background: transparent;
    color: #7A99AC;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease;
}

.ml-tag-remove-btn:hover {
    opacity: 0.7;
}

.ml-clear-all-tags {
    border: none;
    background: transparent;
    color: #091F2C;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    padding: 6px 12px;
    transition: opacity 0.15s ease;
    margin-left: 8px;
    line-height: 1;
}

.ml-clear-all-tags:hover {
    opacity: 0.7;
}

/* Results text counter */
.ml-results-status {
    font-size: clamp(0.875rem, 0.85rem + 0.2vw, 1rem);
    color: #3A4047;
    margin-bottom: 24px;
}

/* Grid of Cards */
.ml-books-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 12px;
    row-gap: 24px;
    margin-bottom: 40px;
}

/* Single Card */
.ml-book-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.ml-card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 268px;
    background-color: #f8fafc;
    overflow: hidden;
}

.ml-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.ml-card-content {
    padding: 8px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.ml-card-tag {
    display: inline-flex;
    font-size: 12px;
    font-weight: 400;
    color: #2F7084;
    background-color: #EAF4F5;
    padding: 3px 10px;
    border-radius: 12px;
    margin-bottom: 8px;
    align-self: flex-start;
}

.hero-heading {
    font-size: clamp(3rem, 5vw, 4.5rem);
    line-height: 1.4;
    font-weight: 700;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ml-card-title {
    font-size: clamp(0.875rem, 0.85rem + 0.2vw, 1rem);
    font-weight: 700;
    color: #1C2226;
    line-height: 1.3;
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 38px;
}

.ml-card-author {
    font-size: 12px;
    color: #788891;
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ml-card-meta {
    border-top: 1px solid #EBF1F4;
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-size: 11px;
    color: #94a3b8;
}

.ml-meta-icon {
    font-size: 12px;
}

/* Pagination Row */
.ml-pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
}

.ml-page-btn {
    min-width: 40px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #42738E;
    background-color: transparent;
    border-radius: 8px;
    font-size: clmap(14px, 2vw, 16px);
    font-weight: 400;
    color: #3A4047;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.ml-page-btn:hover {
    background-color: #F3F4F6;
    border-color: #8C959F;
    color: #24292F;
}

.ml-page-btn.active {
    background-color: #245570;
    color: #ffffff;
    border: 1px solid #42738E;

}

.ml-page-dots {
    margin-top: auto;
}

/* Loading state */
.ml-loading-overlay {
    opacity: 0.5;
    pointer-events: none;
}

/* Responsive grid rules */
@media (max-width: 1024px) {
    .ml-books-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ml-public-layout {
        flex-direction: column;
        gap: 32px;
    }

    .ml-public-sidebar {
        width: 100%;
        max-width: none;
        position: static;
        display: flex;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 10px;
    }

    .ml-sidebar-header {
        width: 100%;
        margin-bottom: 8px;
    }

    .ml-filter-group {
        width: 100%;
        margin-bottom: 12px;
    }

    .ml-reset-filters-btn {
        width: 100%;
        margin-top: 12px;
        height: 44px;
        font-size: 14px;
    }

    .ml-books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .ml-public-container {
        padding: 0 10px;
    }

    .ml-public-sidebar {
        flex-direction: column;
        gap: 16px;
    }

    .ml-filter-group {
        flex: 1 1 100%;
    }

    .ml-books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Search Category Widget Styles */
.ml-search-category-widget {
    padding: 40px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif;
}

.ml-sc-search-row {
    display: flex;
    gap: 12px;
    margin-bottom: 40px;
}

.ml-sc-search-input-wrapper {
    position: relative;
    flex-grow: 1;
}

.ml-sc-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    width: 20px;
    height: 20px;
    z-index: 2;
}

.ml-sc-search-input {
    width: 100%;
    height: 54px;
    padding: 17px 17px 17px 48px !important;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #334155;
    background-color: #ffffff;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ml-sc-search-input:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.ml-sc-search-btn {
    height: 54px;
    padding: 0 28px;
    background-color: #091F2C;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: clamp(14px, 2vw, 16px);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ml-sc-search-btn:hover {
    background-color: #1b263b;
    transform: translateY(-1px);
}

.ml-sc-categories-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    align-items: stretch;
}

.ml-sc-category-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    text-align: center;
    flex: 1 1 0%;
    width: 0;
    min-height: 70px;
}

.ml-sc-category-card:hover {
    border-color: #0d9488;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.05);
    transform: translateY(-2px);
}

.ml-sc-cat-title {
    font-size: clamp(14px, 2vw, 16px);
    font-weight: 700;
    color: #2F7084;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.ml-sc-cat-count {
    font-size: clamp(12px, 2vw, 14px);
    color: #58666E;
    font-weight: 400;
}

.ml-sc-see-all-card {
    flex-direction: row;
    gap: 8px;
    background: #ffffff;
    justify-content: center;
    align-items: center;
    flex: 0 0 136px;
    max-width: 136px;
    padding: 16px;
}

.ml-sc-see-all-text {
    font-size: clamp(14px, 2vw, 16px);
    font-weight: 700;
    color: #091F2C;
}

.ml-sc-see-all-arrow {
    color: #091F2C;
    transition: transform 0.2s ease;
}

.ml-sc-see-all-card:hover .ml-sc-see-all-arrow {
    transform: translateX(4px);
}

@media (max-width: 1024px) {
    .ml-sc-categories-row {
        flex-wrap: wrap;
    }

    .ml-sc-category-card {
        flex: 1 1 calc(50% - 16px);
        min-width: 150px;
    }

    .ml-sc-see-all-card {
        flex: 1 1 100%;
        max-width: none;
    }
}

@media (max-width: 768px) {
    .ml-sc-search-row {
        flex-direction: column;
    }

    .ml-sc-search-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .ml-sc-category-card {
        flex: 1 1 100%;
    }
}

/* Latest Books Grid Widget Styles */
.ml-latest-books-widget {
    max-width: 1280px;
    font-family: 'Helvetica', 'Helvetica Neue', Arial, sans-serif;
}

.ml-lb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid #c8d6e5;
    border-left: 1px solid #c8d6e5;
}

.ml-lb-card {
    background: #ffffff;
    border-right: 1px solid #c8d6e5;
    border-bottom: 1px solid #c8d6e5;
    border-top: 2px solid #7A9DB0;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    transition: background-color 0.2s ease;
    min-width: 0;
}

.ml-lb-card:nth-child(even) {
    background-color: #FAFAFC;
}

.ml-lb-card:hover {
    background-color: #f1f5f9;
}

.ml-lb-title {
    font-weight: 700;
    color: #3A4047;
    margin: 0 0 16px 0;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.ml-lb-divider {
    width: 100px;
    height: 1px;
    background-color: #42738E;
    margin: 0 0 16px 0;
}

.ml-lb-author {
    font-size: clamp(14px, 2vw, 16px);
    color: #58666E;
    margin: 0 0 30px 0;
    font-weight: 400;
}

.ml-lb-link {
    font-size: clamp(14px, 2vw, 16px);
    font-weight: 700;
    color: #42738E;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.ml-lb-link:hover {
    color: #0d9488;
}

.ml-lb-arrow {
    transition: transform 0.2s ease;
}

.ml-lb-link:hover .ml-lb-arrow {
    transform: translateX(4px);
}

@media (max-width: 992px) {
    .ml-lb-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .ml-lb-grid {
        grid-template-columns: 1fr;
    }
}

/* Category Books Widget (Premium UI Layout) */
.ml-category-books-widget {
    width: 100%;
}

.ml-cb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
}

.ml-cb-title {
    color: #1C2226;
    margin: 0;
}

.ml-cb-see-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(14px, 2vw, 16px);
    font-weight: 700;
    color: #1C2226;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ml-cb-see-all:hover {
    color: #7A9DB0;
}

.ml-cb-see-all:hover span {
    color: #7A9DB0 !important;
}

.ml-cb-see-all:hover svg path {
    stroke: #7A9DB0 !important;
}

.ml-cb-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 27px;
}

.ml-cb-card {
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    border: 1px solid #E2E8F0;
}

.ml-cb-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.ml-cb-card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    overflow: hidden;
    background-color: #F8FAFC;
}

.ml-cb-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.ml-cb-card-body {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.ml-cb-card-title {
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 700;
    color: #1C2226;
    line-height: 1.4;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ml-cb-card-author {
    font-size: clamp(14px, 2vw, 16px);
    color: #788891;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-bottom: 16px !important;
    border-bottom: 1px solid #EBF1F4;
    font-weight: 400;
}

.ml-cb-card-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: clamp(12px, 2vw, 14px);
    margin: 16px 0 0 0;
    color: #788891;
    font-weight: 400;
}

.ml-clock-icon {
    width: 16px;
    height: 16px;
    stroke: #788891;
}

@media (max-width: 1024px) {
    .ml-cb-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    .ml-cb-header {
        margin-bottom: 30px;
    }
}

@media (max-width: 768px) {
    .ml-cb-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ml-cb-header {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .ml-cb-grid {
        grid-template-columns: 1fr;
    }
}