﻿/* Vazirmatn Font Family - Self Hosted */
@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/vazirmatn/Vazirmatn-Thin.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/vazirmatn/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/vazirmatn/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/vazirmatn/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


.lang-fa {
    /* Main Radzen Font Variable */
    --rz-family: 'Vazirmatn', sans-serif !important;
    /* Specific overrides for text and components */
    --rz-text-font-family: 'Vazirmatn', sans-serif !important;
    --rz-button-font-family: 'Vazirmatn', sans-serif !important;
    /* Set the reading direction */
    direction: rtl;
    text-align: right;
}

/* Force standard HTML elements and Radzen class-based components */
.lang-fa,
.lang-fa .rz-button-text,
.lang-fa .rz-cell-data,
.lang-fa .rz-column-title {
    font-family: 'Vazirmatn', sans-serif !important;
}


#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

:root {
    font-size: var(--rz-root-font-size);
}

body {
    font-family: var(--rz-text-font-family);
    color: var(--rz-text-color);
    font-size: var(--rz-body-font-size);
    line-height: var(--rz-body-line-height);
    background-color: var(--rz-body-background-color);
}

.rz-body {
    --rz-body-padding: 0;
}

a {
    color: var(--rz-link-color);
}

a:hover,
a:focus {
    color: var(--rz-link-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Y5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}


/* Logo in the loginPage */
.login-logo {
    width: 8vh;
    height: auto;
    
}

@media (min-width: 768px) {
    .login-logo {
        width: 120px;
        margin-right:20px;
        margin-top:20px;
    }
}



/* ---------- EPUB-Component start---------- */


.library-container {
    height: 100vh;
    overflow: hidden;
}

.library-content {
    padding: 1rem;
    height: 100%;
    overflow-y: auto;
}

.library-title {
    margin-bottom: 1.5rem;
}

/* ---------- Grid ---------- */

.book-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile default */
    gap: 16px;
}

/* Tablet */
@media (min-width: 600px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small desktop */
@media (min-width: 900px) {
    .book-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large desktop */
@media (min-width: 1200px) {
    .book-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ---------- Cards ---------- */

.book-card {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 340px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) {
    .book-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    }
}

.placeholder-cover {
    font-size: 3.5rem;
    color: #bbb;
}

/* ---------- Text ---------- */

.book-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Button ---------- */

.read-button {
    margin-top: auto;
    width: 100%;
}

/* Better tap targets on mobile */
@media (max-width: 599px) {
    .read-button {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
}
/* ---------- EPUB-Component end---------- */


/* ---------- EPUB-viewer start---------- */
/* ---------- Root ---------- */


/* ---------- Header ---------- */

.reader-header {
    padding: 0.5rem 0.5rem;
+    background-color: var(--rz-base);
}

.reader-title {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

}

/* Hide TOC button on desktop */
.toc-toggle {
    display: inline-flex;

}

/* ---------- Body ---------- */

.reader-body {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    height:100%;
}

/* ---------- TOC ---------- */

.reader-toc {
    background: #fafafa;
    border-right: 1px solid #ddd;
    padding: 1rem;
    overflow-y: auto;
}

/* Mobile: drawer */
@media (max-width: 900px) {
    .reader-toc {
        position: absolute;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 10;
        transition: left 0.3s ease;
        width: 85%;
        max-width: 320px;
        box-shadow: 4px 0 12px rgba(0,0,0,0.15);
    }

        .reader-toc.open {
            left: 0;
        }
}

/* Desktop: always visible */
@media (min-width: 901px) {
    .toc-toggle {
        display: none;
    }
}

/* ---------- TOC Content ---------- */

.toc-cover {
    text-align: center;
    margin-bottom: 1rem;
}

    .toc-cover img {
        max-width: 95%;
        box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    }

/* Tablet - 2 columns */
@media (min-width: 768px) {
    .toc-cover {
        text-align: center;
        margin-bottom: 1rem;
        width: 10vw
    }

        .toc-cover img {
            max-width: 95%;
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        }
}

.toc-author {
    text-align: center;
    margin-bottom: 1rem;
}

.toc-description-content {
    font-size: 0.85rem;
    color: #666;
}

.toc-title {
    margin-top: 1rem;
}

/* ---------- Reader ---------- */

.reader-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: #fff;
}

/* Optimal reading width */
.reader-article {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.7;
    font-size: 1rem;
}

/* Mobile text */
@media (max-width: 600px) {
    .reader-content {
        padding: 1rem;
    }

    .reader-article {
        font-size: 0.95rem;
    }

}

/* ---------- Placeholder ---------- */

.reader-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 1rem;
}

/* ---------- EPUB-viewer end---------- */


.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    width: 100%;
}

/* Mobile first - single column on very small screens */
@media (max-width: 480px) {
    .book-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.5rem;
    }
}

/* Tablet - 2 columns */
@media (min-width: 768px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop - 3+ columns */
@media (min-width: 1024px) {
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

    .book-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    }

.book-card-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.book-cover {
    position: relative;
    width: 100%;
    padding-top: 140%; /* 1:1.4 aspect ratio for book covers */
    overflow: hidden;
    background: #f5f5f5;
}

    .book-cover img {
        position: absolute;
        top: 0;
        left: 5%;
        width: 90%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

.book-card:hover .book-cover img {
    transform: scale(1.05);
}

.book-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-card:hover .book-overlay {
    opacity: 1;
}

.book-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.book-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

/* Touch device optimization */
@media (hover: none) {
    .book-card:active {
        transform: scale(0.98);
    }

    .book-overlay {
        opacity: 0;
    }
}


/* 1. Container: Ensures the image doesn't overflow its parent */
.book-cover-container {
    width: 100%;
    display: flex;
    justify-content: center; /* Centers image if it's smaller than max-width */
}

/* 2. Image Styling */
.bookcover-img {
    /* Responsiveness */
    width: 100%; /* Try to fill the container width */
    height: 100%;
    /* Constraints (Max Width/Height) */
    max-width: 250px; /* Never get wider than a standard book size */
    max-height: 400px; /* Never get too tall */
    /* Style & Polish */
    object-fit: cover; /* Ensures the image covers the area without distortion */
    border-radius: 8px; /* Rounded corners */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08); /* 3D effect */
    transition: transform 0.2s;
}

    /* Optional: Slight pop effect on hover */
    .bookcover-img:hover {
        transform: scale(1.02);
    }


/* Loading & Error States */
.loading-overlay, .error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.loading-content, .error-container {
    text-align: center;
    padding: 2rem;
}

/* Header */
.reader-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.book-info {
    min-width: 0;
    flex: 1;
}

.book-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--rz-base-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-authors {
    margin: 0.25rem 0 0 0;
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Reader Body */
.reader-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}



/* TOC Sidebar */
.toc-sidebar {
    width: 320px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #dee2e6;
}

    .toc-header h3 {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 600;
    }

.toc-nav {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

/* Chapter Container */
.chapter-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    scroll-behavior: smooth;
}

.chapter {
    max-width: 800px;
    margin: 0 auto;
}

.chapter-title {
    margin-bottom: 2rem;
    color: var(--rz-text-color);
    font-size: 2rem;
    font-weight: 700;
}

.chapter-content {
    line-height: 1.8;
    color: var(--rz-text-color);
    margin-bottom: 3rem;
}

    .chapter-content p {
        margin-bottom: 1.5rem;
    }

    .chapter-content img {
        max-width: 100%;
        height: auto;
        margin: 2rem auto;
        display: block;
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    .chapter-content h1,
    .chapter-content h2,
    .chapter-content h3 {
        margin-top: 2rem;
        margin-bottom: 1rem;
    }

    .chapter-content blockquote {
        border-left: 4px solid #007bff;
        padding-left: 1rem;
        margin: 1.5rem 0;
        font-style: italic;
        color: var(--rz-text-color);
    }

/* Chapter Navigation */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #dee2e6;
    gap: 1rem;
}

.chapter-progress {
    text-align: center;
    flex: 1;
}

    .chapter-progress .progress {
        max-width: 300px;
        margin: 0 auto;
    }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 1rem;
}

/* TOC Overlay (mobile) */
.toc-overlay {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .reader-header {
        padding: 0.75rem 1rem;
    }

    .book-title {
        font-size: 1rem;
    }

    .toc-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1040;
        transform: translateX(-100%);
    }

        .toc-sidebar.show {
            transform: translateX(0);
        }

    .toc-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1030;
    }

    .chapter-container {
        padding: 1rem;
    }

    .chapter-title {
        font-size: 1.5rem;
    }

    .chapter-nav {
        flex-wrap: wrap;
    }

    .chapter-progress {
        order: -1;
        width: 100%;
        margin-bottom: 1rem;
    }
}



.toc-sidebar {
    top: 0;
    left: 0;
    height: 100%;
    width: 300px;
    background-color: var(--rz-base);
    box-shadow: 2px 0 10px rgba(0,0,0,.15);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1050;
    overflow-y: auto;
}

    .toc-sidebar.show {
        transform: translateX(0);
    }

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.toc-nav {
    padding: 0.5rem 1rem;
}

.toc-item {
    margin-bottom: 0.25rem;
}

.toc-link {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.35rem 0.25rem;
    font-size: 0.95rem;
    color: var(--bs-body-color);
}

    .toc-link:hover {
        text-decoration: underline;
    }

    .toc-link.active {
        font-weight: 600;
        color: var(--bs-primary);
    }

.toc-level-1 {
    padding-left: 1rem;
}

.toc-level-2 {
    padding-left: 2rem;
}

.toc-level-3 {
    padding-left: 3rem;
}

.toc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1040;
}




.book_info_card {
    max-width: 900px;
    margin: auto;
}

.book_info_header {
    flex-wrap: wrap;
}

.book_info_cover {
    width: 140px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0,0,0,.15);
}

.book_info_subtitle {
    color: var(--rz-text-secondary);
}

.book_info_description {
    font-size: 0.95rem;
    line-height: 1.6;
}

.book_info_metadata_row {
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .book_info_cover {
        width: 100px;
    }
}

.spinner-border {
    display: flex;
    flex-direction: row;
    align-items: normal;
    justify-content: center;
}