
/*
Theme Name: Nadross
Theme URI: https://nadross.com
Author: Nadross Team
Author URI: https://nadross.com
Description: The Premier Algerian University Repository Theme. Features a credit-based download economy, frontend uploads, and RTL design.
Version: 1.0.4
Text Domain: nadross
*/

:root {
    --primary: #0F52BA;
    --secondary: #000926;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: #D6E6F3;
    background-image: radial-gradient(circle at top, #A6C5D7 0%, #D6E6F3 100%);
    line-height: 1.8;
    color: #334155;
}

/* Dark mode baseline contrast fix (global) */
.dark body {
    background-color: #0B1324;
    background-image: radial-gradient(circle at top, #0F1C3A 0%, #0A1020 100%);
    color: #D1D9E6;
}

/* Many templates use text-secondary without dark override; ensure readability in dark mode */
.dark .text-secondary {
    color: #E8EEF9 !important;
}

/* ... Existing Styles ... */

/* Glassmorphism Utilities */
.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dark .glass {
    background: rgba(0, 9, 38, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
.dark ::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 5px; border: 2px solid #f1f5f9; }
.dark ::-webkit-scrollbar-thumb { background: #475569; border-color: #0f172a; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* RTL Form Fixes */
input, select, textarea { text-align: right; }
.ltr-input { text-align: left; direction: ltr; }

/* Animations */
.opacity-0 { opacity: 0; }
.translate-y-10 { transform: translateY(20px); }
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-slide-up { animation: slideUpFade 0.6s ease-out forwards; }

/* --- PROTECTED VIEWER STYLES --- */
.protected-viewer {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    position: relative;
    background-color: #525659; /* Standard PDF Viewer Gray */
    /* IMPORTANT: Enforce LTR context for PDF coordinate system */
    direction: ltr !important;
    text-align: left !important;
}

/* Canvas Styling */
.protected-viewer canvas {
    display: block;
    margin: 0 auto; /* Center pages */
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    max-width: 100% !important;
    height: auto !important;
}

/* Placeholder Styling (Before Lazy Load) */
.pdf-page-placeholder {
    transition: opacity 0.3s;
    background: #fff;
    margin: 0 auto 20px auto; /* Same spacing as canvas */
}

/* Blur Overlay for Page 16 limit */
#pdf-blur-overlay {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-top: 1px solid rgba(255,255,255,0.1);
    /* Reset direction for the overlay text back to RTL if needed, but flex handles center */
    direction: rtl;
    text-align: center;
}

/* Print Protection */
@media print {
    body * { visibility: hidden; }
    .protected-viewer, .protected-viewer * { display: none !important; }
    body:after {
        content: "المحتوى محمي بحقوق النشر. يرجى زيارة Nadross.com للوصول.";
        visibility: visible;
        display: block;
        text-align: center;
        font-size: 20pt;
        margin-top: 50px;
    }
}

/* AI Assistant Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translate3d(0, 20px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}
.animate-fade-in-up { animation: fadeInUp 0.5s ease-out forwards; }

@keyframes pulseSubtle {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.95; }
}
.animate-pulse-subtle { animation: pulseSubtle 3s ease-in-out infinite; }

/* PWA Install Floating CTA (Mobile) */
#nadross-pwa-install-fab {
    position: fixed;
    left: 50%;
    transform: translateX(-50%) translateY(18px);
    bottom: calc(82px + env(safe-area-inset-bottom));
    z-index: 65;
    opacity: 0;
    pointer-events: none;
    transition: transform .28s ease, opacity .28s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#nadross-pwa-install-fab.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

#nadross-pwa-install-fab-btn {
    border: 0;
    border-radius: 999px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0f52ba, #0a3c87);
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    box-shadow: 0 12px 28px rgba(10, 60, 135, 0.35);
}

#nadross-pwa-install-fab-btn i {
    font-size: 12px;
}

#nadross-pwa-install-fab-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    font-size: 12px;
}

@media (min-width: 768px) {
    #nadross-pwa-install-fab {
        display: none !important;
    }
}

/* PWA Launch Overlay */
#nadross-pwa-launch-screen {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 10%, #2d7cff 0%, #0f52ba 35%, #001b4d 100%);
    transition: opacity .4s ease, visibility .4s ease;
}

#nadross-pwa-launch-screen.is-hiding {
    opacity: 0;
    visibility: hidden;
}

.nadross-pwa-launch-shell {
    text-align: center;
    color: #fff;
    animation: pwaLaunchRise .55s ease both;
}

.nadross-pwa-logo-wrap {
    width: 92px;
    height: 92px;
    margin: 0 auto 14px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.nadross-pwa-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.nadross-pwa-logo-fallback {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.22);
    font-size: 34px;
    font-weight: 900;
}

.nadross-pwa-title {
    margin: 0 0 6px;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: .04em;
    text-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.nadross-pwa-subtitle {
    margin: 0;
    font-size: .82rem;
    opacity: .9;
}

@keyframes pwaLaunchRise {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
