/* =============================================
   Secure PDF Viewer — viewer.css
   ============================================= */

/* متغیرها */
:root {
    --spv-primary:     #2563eb;
    --spv-primary-h:   #1d4ed8;
    --spv-bg:          #1e1e2e;
    --spv-toolbar-bg:  #16213e;
    --spv-border:      #334155;
    --spv-text:        #e2e8f0;
    --spv-text-muted:  #94a3b8;
    --spv-radius:      10px;
    --spv-shadow:      0 4px 24px rgba(0,0,0,.35);
}

/* =================== Wrapper =================== */
.spv-viewer-wrap {
    font-family: 'Tahoma', 'IRANSans', Arial, sans-serif;
    direction: rtl;
    background: var(--spv-bg);
    border-radius: var(--spv-radius);
    box-shadow: var(--spv-shadow);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    margin: 20px 0;
}

/* =================== Toolbar =================== */
.spv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--spv-toolbar-bg);
    padding: 8px 14px;
    border-bottom: 1px solid var(--spv-border);
    flex-wrap: wrap;
    gap: 8px;
}

.spv-toolbar-left,
.spv-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.spv-page-info {
    font-size: 13px;
    color: var(--spv-text);
    min-width: 90px;
    text-align: center;
    direction: ltr;
}

.spv-btn-icon {
    background: rgba(255,255,255,.08);
    border: 1px solid var(--spv-border);
    color: var(--spv-text);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    line-height: 1;
}
.spv-btn-icon:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.spv-btn-icon:disabled { opacity: .35; cursor: not-allowed; }

.spv-btn-view {
    background: rgba(255,255,255,.06);
    border: 1px solid var(--spv-border);
    color: var(--spv-text-muted);
    border-radius: 6px;
    padding: 0 10px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    transition: all .15s;
}
.spv-btn-view.active,
.spv-btn-view:hover {
    background: var(--spv-primary);
    border-color: var(--spv-primary);
    color: #fff;
}

/* =================== Viewer Body =================== */
.spv-viewer-body {
    position: relative;
    overflow: hidden;
    background: #111827;
    display: flex;
    align-items: stretch;
}

/* --- Paged View --- */
.spv-paged-view {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    overflow: auto;
}
.spv-paged-view.spv-active { display: flex; }

.spv-page-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 20px;
    transition: transform .2s;
}

.spv-page-img {
    max-width: 100%;
    max-height: calc(var(--spv-height, 650px) - 100px);
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    border-radius: 4px;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
    object-fit: contain;
}

.spv-page-loading {
    position: absolute;
    color: var(--spv-text-muted);
    font-size: 14px;
    animation: spv-pulse 1.2s ease-in-out infinite;
}
@keyframes spv-pulse {
    0%, 100% { opacity: .4; }
    50%       { opacity: 1; }
}

/* --- Scroll View --- */
.spv-scroll-view {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: center;
    flex-direction: column;
    padding: 20px 0;
    gap: 16px;
    scroll-behavior: smooth;
}
.spv-scroll-view.spv-active { display: flex; }

.spv-scroll-page-item {
    position: relative;
    max-width: 100%;
    padding: 0 20px;
    text-align: center;
}
.spv-scroll-page-item img {
    max-width: 100%;
    box-shadow: 0 4px 24px rgba(0,0,0,.5);
    border-radius: 4px;
    pointer-events: none;
    -webkit-user-drag: none;
}
.spv-scroll-page-num {
    text-align: center;
    font-size: 11px;
    color: var(--spv-text-muted);
    margin-top: 6px;
}
.spv-scroll-placeholder {
    background: #1a1f2e;
    border-radius: 4px;
    width: 500px;
    max-width: 90%;
    height: 700px;
    animation: spv-pulse 1.5s ease-in-out infinite;
}

/* --- Paywall --- */
.spv-paywall {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(17,24,39,0) 0%, rgba(17,24,39,.95) 40%, #111827 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 30px;
    z-index: 10;
}
.spv-paywall-box {
    background: #1e2a3a;
    border: 1px solid var(--spv-border);
    border-radius: 12px;
    padding: 24px 30px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.spv-paywall-icon { font-size: 36px; margin-bottom: 10px; }
.spv-paywall-title { color: #fff; margin: 0 0 8px; font-size: 18px; }
.spv-paywall-msg { color: var(--spv-text-muted); font-size: 14px; margin: 0 0 16px; line-height: 1.7; }
.spv-paywall-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

/* =================== Statusbar =================== */
.spv-statusbar {
    background: var(--spv-toolbar-bg);
    border-top: 1px solid var(--spv-border);
    padding: 6px 14px;
    font-size: 12px;
    color: var(--spv-text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.spv-doc-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spv-access-badge {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.spv-badge-full    { background: #14532d; color: #86efac; }
.spv-badge-partial { background: #713f12; color: #fcd34d; }

/* =================== Buttons =================== */
.spv-btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background .15s;
}
.spv-btn-primary {
    background: var(--spv-primary);
    color: #fff;
}
.spv-btn-primary:hover { background: var(--spv-primary-h); color: #fff; }

/* =================== No Access =================== */
.spv-no-access-wrap {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: var(--spv-radius);
    padding: 24px;
    margin: 20px 0;
    direction: rtl;
    font-family: Tahoma, sans-serif;
}
.spv-cover-preview {
    position: relative;
    flex-shrink: 0;
}
.spv-cover-preview img {
    width: 120px;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    filter: blur(2px);
    opacity: .7;
}
.spv-cover-lock {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}
.spv-access-box h3 { margin: 0 0 8px; color: #1e293b; }
.spv-access-box p  { color: #64748b; font-size: 14px; margin: 0 0 16px; }
.spv-access-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* =================== Account Page =================== */
.spv-docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 16px;
}
.spv-account-doc-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.spv-account-doc-card img { width: 100%; height: 160px; object-fit: cover; }
.spv-no-thumb { height: 120px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.spv-account-doc-info { padding: 12px; display: flex; flex-direction: column; gap: 8px; }

/* =================== Error =================== */
.spv-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    direction: rtl;
}

/* =================== Fullscreen =================== */
.spv-viewer-wrap:-webkit-full-screen { width: 100%; max-width: 100%; }
.spv-viewer-wrap:fullscreen { width: 100%; max-width: 100%; }

/* =================== Responsive =================== */
@media (max-width: 600px) {
    .spv-toolbar { flex-direction: column; align-items: stretch; }
    .spv-toolbar-left, .spv-toolbar-right { justify-content: center; }
    .spv-no-access-wrap { flex-direction: column; }
}
