* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --card: rgba(255, 255, 255, 0.86);
    --text: #172033;
    --muted: #667085;
    --border: #e4eaf2;
    --primary: #2563eb;
    --primary-2: #38bdf8;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

html {
    direction: rtl;
}

body {
    margin: 0;
    font-family: "Segoe UI Semilight", "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.18), transparent 34%),
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 30%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.topbar {
    height: 78px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 38px;
    border-bottom: 1px solid rgba(228, 234, 242, 0.7);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    display: grid;
    place-items: center;
    border-radius: 18px;
    font-size: 24px;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.brand-title {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.4px;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

nav {
    display: flex;
    gap: 10px;
}

nav a {
    text-decoration: none;
    color: #26364d;
    background: rgba(248, 250, 252, 0.82);
    border: 1px solid rgba(226, 232, 240, 0.9);
    padding: 10px 17px;
    border-radius: 999px;
    font-weight: 600;
    transition: 0.18s ease;
}

nav a:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 38px auto;
}

.auth-card {
    width: min(470px, 100%);
    margin: 76px auto;
    background: var(--card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 38px;
    border-radius: 30px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.72);
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 36px;
    font-weight: 600;
    letter-spacing: -0.8px;
}

.auth-card p {
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 26px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

label {
    font-weight: 600;
    color: #25334a;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.9);
    padding: 14px 15px;
    border-radius: 16px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
    transition: 0.18s ease;
}

input:focus,
textarea:focus {
    background: white;
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.10);
}

button,
.btn {
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: white;
    padding: 14px 19px;
    border-radius: 17px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    display: inline-block;
    font-family: inherit;
    transition: 0.18s ease;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.26);
}

.small-link {
    margin-top: 20px;
    color: var(--muted);
}

.small-link a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.flash {
    background: rgba(255, 251, 235, 0.92);
    border: 1px solid #fde68a;
    color: #7c5a00;
    padding: 14px 18px;
    border-radius: 18px;
    margin-bottom: 22px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(124, 90, 0, 0.05);
}

.hero {
    background: var(--card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 38px;
    border-radius: 32px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.72);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset-inline-start: -90px;
    top: -90px;
    width: 230px;
    height: 230px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.26), transparent 68%);
}

.hero h1 {
    position: relative;
    margin: 0 0 10px;
    font-size: 40px;
    font-weight: 600;
    letter-spacing: -1px;
}

.hero p {
    position: relative;
    margin: 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.7;
}

@media (max-width: 700px) {
    .topbar {
        height: auto;
        padding: 18px;
        align-items: flex-start;
        gap: 16px;
        flex-direction: column;
    }

    nav {
        flex-wrap: wrap;
    }

    .auth-card {
        margin: 34px auto;
        padding: 28px;
    }

    .hero h1 {
        font-size: 32px;
    }
}

.section-title {
    margin: 34px 0 18px;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.panel {
    background: var(--card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 28px;
    border-radius: 30px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.72);
    margin-top: 24px;
}

.panel h2 {
    margin-top: 0;
    font-size: 26px;
    font-weight: 600;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
    gap: 22px;
}

.book-card {
    position: relative;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 28px;
    padding: 18px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: 0.18s ease;
    overflow: hidden;
}

.book-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 46px rgba(15, 23, 42, 0.12);
}

.book-card.owned {
    border-color: rgba(37, 99, 235, 0.26);
}

.book-cover {
    height: 155px;
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.7), transparent 42%),
        linear-gradient(135deg, #2563eb, #38bdf8);
    color: white;
    display: grid;
    place-items: center;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 2px;
    box-shadow: inset 0 -28px 50px rgba(15, 23, 42, 0.14);
}

.book-card h3 {
    margin: 2px 0 0;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.4px;
}

.book-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
    min-height: 54px;
}

.price {
    font-size: 21px;
    font-weight: 700;
    color: #111827;
}

.badge {
    position: absolute;
    top: 28px;
    right: 28px;
    background: rgba(255, 255, 255, 0.92);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.22);
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.empty {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 24px;
    padding: 24px;
    color: var(--muted);
    box-shadow: var(--shadow);
}

.reader-header {
    background: var(--card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: 28px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.72);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.reader-header h1 {
    margin: 0 0 8px;
    font-size: 32px;
    font-weight: 600;
}

.reader-header p {
    margin: 0;
    color: var(--muted);
}

.reader-box {
    background: #111827;
    padding: 12px;
    border-radius: 28px;
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.18);
}

.pdf-frame {
    width: 100%;
    height: calc(100vh - 230px);
    border: none;
    border-radius: 18px;
    background: white;
}

.secondary {
    background: rgba(241, 245, 249, 0.95);
    color: #26364d;
    box-shadow: none;
}

.secondary:hover {
    background: white;
    color: #1d4ed8;
}
.toast.hide {
    opacity: 0;
    transform: translateX(-18px);
    transition: 0.35s ease;
}

.danger-btn {
    background: linear-gradient(135deg, #dc2626, #fb7185);
    box-shadow: 0 12px 24px rgba(220, 38, 38, 0.18);
}

.danger-btn:hover {
    box-shadow: 0 16px 30px rgba(220, 38, 38, 0.26);
}

.reader-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.secure-reader {
    background: #0f172a;
    border-radius: 28px;
    padding: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    min-height: 70vh;
}

.reader-toolbar {
    color: white;
    opacity: 0.86;
    display: flex;
    justify-content: space-between;
    padding: 0 6px 14px;
    font-weight: 600;
}

#pdfPages {
    display: flex;
    flex-direction: column;
    gap: 22px;
    align-items: center;
}

.pdf-page-wrap {
    position: relative;
    background: white;
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
    max-width: 100%;
    overflow: hidden;
    user-select: none;
}

.pdf-page-wrap canvas {
    display: block;
    max-width: 100%;
    height: auto;
    user-select: none;
}

.watermark {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    transform: rotate(-28deg);
    font-size: 34px;
    font-weight: 700;
    color: rgba(37, 99, 235, 0.13);
    pointer-events: none;
    user-select: none;
}

.secure-reader {
    height: calc(100vh - 180px);
    overflow-y: auto;
    overflow-x: hidden;
}

.secure-reader:fullscreen {
    height: 100vh;
    border-radius: 0;
}

.secure-reader:fullscreen #pdfPages {
    padding-bottom: 40px;
}





.user-top {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}

.user-avatar {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg,#2563eb,#38bdf8);
    color: white;
    display: grid;
    place-items: center;
    font-size: 26px;
    font-weight: 700;
}

.user-top h3 {
    margin: 0;
    font-size: 22px;
}

.user-top p {
    margin: 4px 0 0;
    color: var(--muted);
}

.user-stats {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(248,250,252,.9);
    border-radius: 16px;
}

.ok {
    color: #16a34a;
}

.warn {
    color: #dc2626;
}

.compact-hero {
    padding: 28px 32px;
}

.profile-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
}

.profile-card,
.mini-panel,
.book-preview-hero,
.preview-page-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 28px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.profile-card {
    padding: 24px;
    text-align: center;
}

.profile-avatar {
    width: 78px;
    height: 78px;
    margin: 0 auto 14px;
    border-radius: 26px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: white;
    font-size: 34px;
    font-weight: 700;
}

.profile-card h2 {
    margin: 0 0 6px;
    font-size: 24px;
}

.profile-card p {
    margin: 0 0 14px;
    color: var(--muted);
}

.profile-forms {
    display: grid;
    gap: 18px;
}

.mini-panel {
    padding: 22px;
}

.mini-panel h3 {
    margin: 0 0 16px;
    font-size: 21px;
}

.danger-panel p {
    color: var(--muted);
    margin-top: -6px;
}

.compact-btn {
    width: auto;
    align-self: flex-start;
    padding: 10px 16px;
    border-radius: 14px;
    font-size: 14px;
}

.book-preview-hero {
    padding: 34px;
}

.preview-label {
    display: inline-flex;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    font-weight: 700;
    margin-bottom: 12px;
}

.book-preview-hero h1 {
    margin: 0 0 10px;
    font-size: 38px;
}

.book-preview-hero p {
    color: var(--muted);
    line-height: 1.7;
    max-width: 680px;
}

.preview-price {
    font-size: 28px;
    font-weight: 800;
    margin: 18px 0;
}

.preview-pages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
}

.preview-page-card {
    padding: 14px;
}

.preview-page-title {
    font-weight: 700;
    margin-bottom: 10px;
    color: #334155;
}

.preview-page-card img {
    width: 100%;
    border-radius: 18px;
    display: block;
    user-select: none;
    pointer-events: none;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
}

@media (max-width: 850px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }
}



/* =========================
   ADMIN USERS FINAL
========================= */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 14px;
}

.admin-table thead th {
    padding: 14px 16px;
    text-align: right;
    font-size: 14px;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
}

.admin-table tbody td {
    background: rgba(255,255,255,.96);
    padding: 18px 16px;
    vertical-align: middle;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.admin-table tbody td:first-child {
    border-right: 1px solid #e2e8f0;
    border-radius: 18px 0 0 18px;
}

.admin-table tbody td:last-child {
    border-left: 1px solid #e2e8f0;
    border-radius: 0 18px 18px 0;
}

.admin-table td:nth-child(5) {
    width: 310px;
}

/* status pills */

.pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.pill.blue {
    background: rgba(37,99,235,.12);
    color: #1d4ed8;
}

.pill.gray {
    background: rgba(100,116,139,.12);
    color: #475569;
}

.pill.green {
    background: rgba(34,197,94,.12);
    color: #15803d;
}

.pill.red {
    background: rgba(239,68,68,.12);
    color: #b91c1c;
}

/* books scroll area */

.books-dropdown {
    position: relative;
    width: 260px;
}

.dropdown-toggle {
    width: 100%;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid #dbe3ee;
    background: white;
    color: #1e293b;
    cursor: pointer;
    text-align: right;
    box-shadow: none;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;

    width: 100%;
    max-height: 240px;
    overflow-y: auto;

    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 18px 36px rgba(15,23,42,.12);

    z-index: 100;
}

.dropdown-menu.open {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-list::-webkit-scrollbar {
    width: 8px;
}


.checkbox-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

/* checkbox row */

.book-check {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px 12px;

    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;

    cursor: pointer;
    transition: .18s ease;
}

.book-check:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.book-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #2563eb;
    flex-shrink: 0;
}

.book-check span {
    font-size: 14px;
    color: #1e293b;
    line-height: 1.35;
}

/* save button */

.small-btn {
    padding: 10px 16px;
    min-width: 88px;
    border-radius: 14px;
    font-size: 14px;
    white-space: nowrap;
}

.muted-small {
    color: #64748b;
    font-size: 14px;
}

.toast-wrap {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    width: min(360px, calc(100vw - 48px));
}

.toast {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
    border-radius: 18px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #172033;
    font-weight: 600;
    animation: toastUp 0.28s ease;
}

.toast-icon {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    font-weight: 900;
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.26);
}

.toast.success .toast-icon {
    background: rgba(34, 197, 94, 0.14);
    color: #15803d;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.26);
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
}

.toast.hide {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition: 0.35s ease;
}

@keyframes toastUp {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.image-cover {
    background-size: cover !important;
    background-position: center !important;
    color: transparent;
}

.reader-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(15, 23, 42, 0.92);
    border-radius: 18px;
    padding: 12px 14px;
    margin-bottom: 18px;
}

.reader-exit-btn {
    display: none;
    padding: 9px 14px;
    border-radius: 13px;
    font-size: 14px;
}

.secure-reader:fullscreen .reader-exit-btn {
    display: inline-flex;
}

.secure-reader:fullscreen {
    padding: 18px;
    overflow-y: auto;
    background: #0f172a;
}

.reader-user-watermark {
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    margin: -6px 8px 14px;
}

.pdf-page-wrap {
    width: fit-content;
    max-width: 100%;
}

.pdf-page-wrap canvas {
    background: white;
    image-rendering: auto;
}

.pdf-page-wrap canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    text-rendering: geometricPrecision;
}

.secure-page-img {
    display: block;
    width: min(100%, 980px);
    height: auto;
    border-radius: 12px;
    user-select: none;
    pointer-events: none;
}

.screen-warning {
    position: fixed;
    inset-inline-start: 50%;
    bottom: 34px;
    transform: translateX(-50%);
    z-index: 99999;
    background: rgba(15, 23, 42, 0.94);
    color: white;
    padding: 14px 20px;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
    font-weight: 700;
}

.site-footer {
    display: flex;
    justify-content: center;
    padding: 28px 16px 34px;
}

.site-footer {
    position: relative;
    min-height: 70px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255,255,255,0.92);
}

.copyright-text {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.privacy-floating-btn {
    position: absolute;
    right: 22px;
    bottom: 16px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 8px 14px;
    border-radius: 999px;

    background: rgba(37, 99, 235, 0.10);
    border: 1px solid rgba(37, 99, 235, 0.18);

    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;

    transition: 0.18s ease;
}

.privacy-floating-btn:hover {
    background: rgba(37, 99, 235, 0.18);
    transform: translateY(-2px);
}

.privacy-mini-btn:hover,
.inline-mini-btn:hover {
    background: rgba(37, 99, 235, 0.16);
    transform: translateY(-1px);
}

.terms-check {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px;
}

.terms-check input {
    width: auto;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
}

.editor-toolbar button {
    padding: 10px 14px;
    border: none;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    font-weight: 700;
    border: 1px solid #dbeafe;
}

.editor-toolbar button:hover {
    background: #eff6ff;
}

.privacy-editor {
    min-height: 420px;
    padding: 22px;
    border-radius: 18px;
    border: 1px solid #dbeafe;
    background: white;
    outline: none;
    line-height: 1.9;
    font-size: 16px;
    margin-bottom: 20px;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
}

.editor-toolbar button {
    width: auto;
    padding: 9px 13px;
    border-radius: 12px;
    background: white;
    color: #1e293b;
    box-shadow: none;
    border: 1px solid #dbeafe;
}

.privacy-editor {
    min-height: 420px;
    padding: 22px;
    border-radius: 18px;
    border: 1px solid #dbeafe;
    background: white;
    outline: none;
    line-height: 1.9;
    font-size: 16px;
    margin-bottom: 20px;
}

.editor-toolbar button.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.editor-toolbar button.active:hover {
    background: #1d4ed8;
}

select {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.9);
    padding: 14px 15px;
    border-radius: 16px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
}

select:focus {
    background: white;
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.10);
}

.institution-form {
    min-width: 240px;
    gap: 8px;
}

.institution-form input,
.institution-form select {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
}

.admin-table td:last-child {
    min-width: 150px;
}

.admin-table td:last-child form {
    margin-top: 8px;
}

.replace-pdf-box {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid rgba(0,120,255,.12);
    border-radius: 16px;
    background: #f8fbff;
}

.replace-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d4ed8;
}

.replace-pdf-box input[type="file"] {
    width: 100%;
    margin-bottom: 12px;
}

.upload-confirm-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

.upload-confirm-panel {
    position: sticky;
    top: 96px;
}

.confirm-details {
    display: grid;
    gap: 14px;
    margin: 22px 0;
}

.confirm-details div {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.confirm-details span {
    color: #64748b;
    font-weight: 700;
    font-size: 13px;
}

.confirm-details strong {
    color: #172033;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.upload-pdf-preview-panel h2 {
    margin-bottom: 16px;
}

.upload-pdf-preview {
    width: 100%;
    height: calc(100vh - 230px);
    border: none;
    border-radius: 18px;
    background: white;
}

@media (max-width: 900px) {
    .upload-confirm-layout {
        grid-template-columns: 1fr;
    }

    .upload-confirm-panel {
        position: static;
    }
}

.upload-preview-pages {
    display: grid;
    gap: 22px;
}

.upload-preview-page {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 14px;
}

.upload-preview-page img {
    width: 100%;
    display: block;
    border-radius: 14px;
    user-select: none;
    pointer-events: none;
}

.file-picker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 12px 18px;
    border-radius: 16px;
    background: rgba(37, 99, 235, 0.10);
    border: 1px solid rgba(37, 99, 235, 0.22);
    color: #1d4ed8;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.file-picker:hover {
    background: rgba(37, 99, 235, 0.16);
    transform: translateY(-1px);
}

.file-picker input[type="file"] {
    display: none;
}

.edit-book-box {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: 18px;
    background: #f8fbff;
}

.edit-book-box h4 {
    margin: 0 0 12px;
    color: #1d4ed8;
}

.file-picker {
    display: inline-flex;
    width: fit-content;
    padding: 12px 18px;
    border-radius: 16px;
    background: rgba(37, 99, 235, 0.10);
    border: 1px solid rgba(37, 99, 235, 0.22);
    color: #1d4ed8;
    font-weight: 700;
    cursor: pointer;
}

.file-picker input[type="file"] {
    display: none;
}

.preview-save-btn {
    border: none;
    box-shadow: none;
}

.edit-book-box .file-picker {
    background: rgba(248, 250, 252, 0.95);
    color: #334155;
    border-color: #e2e8f0;
}

.edit-book-box .file-picker:hover {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.25);
}

.edit-book-box .preview-save-btn {
    background: rgba(37, 99, 235, 0.10);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.22);
}

.edit-book-box .preview-save-btn:hover {
    background: rgba(37, 99, 235, 0.16);
}

.preview-reader-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: 24px;
}

.preview-book {
    width: 760px;
    min-height: 900px;
    position: relative;
}

.preview-page {
    display: none;
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 18px 44px rgba(15,23,42,.12);
}

.preview-page.active {
    display: block;
}

.flip-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 24px;
}

.preview-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin-top: 22px;
}

#pageCounter {
    font-weight: 700;
}

.preview-reader {
    display: grid;
    grid-template-columns: 64px minmax(280px, 820px) 64px;
    gap: 18px;
    align-items: center;
    justify-content: center;
    margin-top: 26px;
}

.preview-page-frame {
    background: #0f172a;
    padding: 18px;
    border-radius: 28px;
    box-shadow: 0 24px 54px rgba(15,23,42,.18);
}

.preview-page-frame img {
    width: 100%;
    display: block;
    border-radius: 16px;
    background: white;
    user-select: none;
    pointer-events: none;
}

.flip-btn {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    font-size: 34px;
    padding: 0;
}

.preview-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin-top: 22px;
}

#pageCounter {
    font-weight: 800;
    color: #334155;
}

.user-row-form {
    min-width: 240px;
    gap: 8px;
}

.user-row-form input,
.user-row-form select {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
}

.actions-cell.bottom-actions {
    vertical-align: bottom;
    display: table-cell;
}

.actions-cell.bottom-actions > button,
.actions-cell.bottom-actions > form {
    margin-top: 8px;
}

.actions-cell.bottom-actions form {
    margin-bottom: 0;
}

.compact-edit-book {
    padding: 12px;
}

.compact-edit-book h4 {
    font-size: 15px;
    margin-bottom: 10px;
}

.compact-edit-book textarea {
    min-height: 70px;
    padding: 10px 12px;
    font-size: 14px;
}

.compact-file-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.compact-edit-book .file-picker {
    padding: 9px 12px;
    border-radius: 13px;
    font-size: 13px;
}

.compact-edit-book .preview-save-btn {
    margin-top: 4px;
}
.delete-cell {
    width: 90px;
    text-align: center;
}

.table-save-bar {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-start;
}

.table-save-bar button {
    width: auto;
    padding: 12px 22px;
}

.user-row-form {
    min-width: 240px;
    gap: 8px;
}

.user-row-form input,
.user-row-form select {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
}


.expiry-small {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
}

.access-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    margin-bottom: 10px;
}

.access-row span {
    display: block;
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
}

.access-row form {
    margin: 0;
}

.expiry-badge {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 7px 11px;
    width: fit-content;
}

.renew-inline-form {
    margin: 0;
}

.renew-mini-btn {
    width: fit-content;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    box-shadow: none;
}
.expiry-small{
    display:block;
    font-size:12px;
    color:#6b7280;
    margin-top:3px;
}

.audit-filter-bar {
    display: flex;
    align-items: end;
    gap: 12px;
    margin-bottom: 18px;
    max-width: 320px;
}

.audit-filter-bar label {
    font-weight: 700;
    color: #475569;
}

.audit-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.admin-create-user-form,
.users-filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.small-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #475569;
}

.small-check input {
    width: auto;
}

.users-filter-panel {
    margin-top: 18px;
}

.users-management-panel {
    margin-top: 18px;
}

.users-filter-area {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e2e8f0;
}

.table-actions-bar {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.table-actions-bar button {
    width: auto;
}

.admin-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #dbeafe;
    color: #334155;
    font-weight: 800;
    cursor: pointer;
    transition: 0.18s ease;
}

.admin-toggle input {
    width: auto;
    accent-color: #2563eb;
}

.admin-toggle:has(input:checked) {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.delete-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(6px);
}

.delete-modal.show {
    display: flex;
}

.delete-modal-box {
    width: 420px;
    max-width: 92%;
    background: white;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.22);
    text-align: center;
}

.delete-modal-box h3 {
    margin-bottom: 12px;
    color: #0f172a;
}

.delete-modal-box p {
    color: #64748b;
    margin-bottom: 24px;
}

.delete-modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.flipbook-shell {
    display: grid;
    grid-template-columns: 64px minmax(320px, 820px) 64px;
    gap: 18px;
    align-items: center;
    justify-content: center;
    margin-top: 28px;
}

.flipbook-card {
    background: white;
    border-radius: 28px;
    padding: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
    border: 1px solid #e2e8f0;
}

.flipbook-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    color: #64748b;
    font-size: 14px;
}

.flipbook-top strong {
    color: #1d4ed8;
}

.flipbook-page-wrap {
    background: #f8fafc;
    border-radius: 22px;
    padding: 14px;
    min-height: 680px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.flipbook-page-wrap img {
    width: 100%;
    max-width: 760px;
    border-radius: 14px;
    user-select: none;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.flipbook-page-wrap img.changing {
    opacity: 0;
    transform: translateX(-8px);
}

.flip-nav-btn {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    border: none;
    font-size: 38px;
    padding: 0;
    cursor: pointer;
}

.preview-bottom-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 24px;
}

@media (max-width: 800px) {
    .flipbook-shell {
        grid-template-columns: 1fr;
    }

    .flip-nav-btn {
        width: 100%;
        border-radius: 18px;
    }

    .flipbook-page-wrap {
        min-height: auto;
    }
}

.login-lock-box {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.login-lock-box span {
    font-size: 14px;
}

#lockCountdown {
    font-size: 18px;
    color: #c2410c;
}

.paypal-box {
    width: min(420px, 100%);
    padding: 22px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
    text-align: center;
}

.paypal-box h3 {
    margin: 0 0 8px;
    font-size: 22px;
}

.paypal-box p {
    margin: 0 0 16px;
    color: #475569;
    font-weight: 700;
}

.paypal-message {
    font-family: "Segoe UI Semilight", "Segoe UI", Arial, sans-serif;
    margin-top: 12px;
    color: #b91c1c;
    font-weight: 600;
    font-size: 14px;
}

.renew-paypal-box {
    margin: 0;
}

.renew-paypal-container {
    max-width: 320px;
    margin-top: 10px;
}

.preview-bottom-actions {
    align-items: center;
    flex-wrap: wrap;
}

.store-actions {
    display: grid;
    gap: 10px;
}

.quick-buy-btn {
    width: 100%;
}

.dashboard-paypal-container {
    margin-top: 8px;
}

.preview-purchase-layout {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.preview-purchase-card {
    width: min(540px, 100%);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 32px;
    padding: 30px;
    box-shadow: 0 26px 65px rgba(15, 23, 42, 0.14);
    text-align: center;
}

.preview-purchase-label {
    display: inline-flex;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.11);
    color: #1d4ed8;
    font-weight: 800;
    margin-bottom: 14px;
}

.preview-purchase-card h2 {
    margin: 0 0 10px;
    font-size: 30px;
}

.preview-purchase-card p {
    margin: 0 auto 18px;
    color: #64748b;
    line-height: 1.7;
}

.preview-purchase-price {
    font-size: 36px;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 18px;
}

.preview-back-btn {
    margin-top: 12px;
}

.paypal-message {
    margin-top: 12px;
    color: #b91c1c;
    font-weight: 700;
}

/* ---------------------------------------- */
.preview-hero-new {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 32px;
    padding: 34px;
    box-shadow: var(--shadow);
    margin-bottom: 26px;
}

.preview-pill,
.secure-label {
    display: inline-flex;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.11);
    color: #1d4ed8;
    font-weight: 800;
    margin-bottom: 12px;
}

.preview-hero-new h1 {
    margin: 0 0 10px;
    font-size: 38px;
}

.preview-hero-new p {
    margin: 0;
    color: #64748b;
    font-size: 17px;
    line-height: 1.7;
}

.preview-sales-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.preview-buy-panel {
    position: sticky;
    top: 100px;
}

.preview-buy-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 32px;
    padding: 28px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

.preview-buy-card h2 {
    margin: 0 0 10px;
    font-size: 26px;
}

.preview-buy-card p {
    margin: 0 0 18px;
    color: #64748b;
    line-height: 1.7;
}

.preview-price-big {
    font-size: 36px;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 18px;
}

.preview-back-btn {
    width: 100%;
    margin-top: 12px;
}

.preview-reader-panel {
    background: #0f172a;
    border-radius: 34px;
    padding: 22px;
    box-shadow: 0 26px 70px rgba(15, 23, 42, 0.20);
}

.preview-reader-head {
    color: white;
    margin-bottom: 16px;
}

.preview-reader-head div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.preview-reader-head span {
    opacity: 0.75;
    font-weight: 700;
}

.preview-reader-head strong {
    color: #93c5fd;
}

.premium-flipbook {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    gap: 16px;
    align-items: center;
}

.premium-page {
    background: #f8fafc;
    border-radius: 24px;
    padding: 18px;
    min-height: 680px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.premium-page img {
    width: 100%;
    max-width: 760px;
    border-radius: 14px;
    background: white;
    user-select: none;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.premium-page img.changing {
    opacity: 0;
    transform: translateX(-8px);
}

.premium-nav-btn {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    padding: 0;
    font-size: 38px;
    box-shadow: none;
}

.paypal-message {
    margin-top: 12px;
    color: #b91c1c;
    font-weight: 800;
}

@media (max-width: 950px) {
    .preview-sales-layout {
        grid-template-columns: 1fr;
    }

    .preview-buy-panel {
        position: static;
        order: -1;
    }

    .premium-flipbook {
        grid-template-columns: 1fr;
    }

    .premium-nav-btn {
        width: 100%;
        border-radius: 18px;
    }

    .premium-page {
        min-height: auto;
    }
}

.preview-reader-head {
    display: grid;
    gap: 12px;
}

.preview-reader-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
}

.preview-fullscreen-btn {
    width: fit-content;
    padding: 9px 14px;
    border-radius: 14px;
    font-size: 14px;
    box-shadow: none;
}

.preview-fullscreen-btn.exit {
    display: none;
    background: rgba(241, 245, 249, 0.95);
    color: #26364d;
}

.preview-reader-panel:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    overflow-y: auto;
    padding: 22px;
}

.preview-reader-panel:fullscreen .premium-page {
    min-height: calc(100vh - 130px);
}

.preview-reader-panel:fullscreen .premium-page img {
    max-width: min(100%, 980px);
}

.dashboard-paypal-container {
    margin-top: 10px;
}

.paypal-message {
    margin-top: 10px;
    color: #b91c1c;
    font-family: "Segoe UI Semilight", "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

.input-error {
    border: 2px solid #dc2626 !important;
    background: #fff7f7 !important;
}

.input-error-box {
    border: 2px solid #dc2626 !important;
    background: #fff7f7 !important;
    border-radius: 14px;
    padding: 10px;
}

/* =========================
   Mobile responsive polish
   Safe CSS-only changes
   ========================= */

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .container,
    main,
    .content {
        width: 100%;
        max-width: 100%;
        padding-left: 14px;
        padding-right: 14px;
        box-sizing: border-box;
    }

    .hero {
        padding: 22px 16px;
        text-align: center;
        border-radius: 16px;
    }

    .hero h1 {
        font-size: 26px;
        line-height: 1.25;
    }

    .hero p {
        font-size: 15px;
        line-height: 1.6;
    }

    .section-title {
        font-size: 22px;
        text-align: center;
        margin: 26px 0 16px;
    }

    .grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .book-card {
        width: 100%;
        max-width: 100%;
        padding: 18px;
        border-radius: 18px;
        box-sizing: border-box;
    }

    .book-cover,
    .image-cover {
        height: 230px;
        border-radius: 14px;
    }

    .book-card h3 {
        font-size: 20px;
        line-height: 1.35;
    }

    .book-card p {
        font-size: 15px;
        line-height: 1.6;
    }

    .btn,
    button,
    input[type="submit"] {
        width: 100%;
        min-height: 46px;
        font-size: 16px;
        border-radius: 12px;
    }

    form {
        width: 100%;
    }

    input,
    select,
    textarea {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 16px;
    }

    .auth-card {
        width: 100%;
        max-width: 100%;
        padding: 22px 18px;
        margin: 18px auto;
        border-radius: 18px;
        box-sizing: border-box;
    }

    .auth-card h1 {
        font-size: 26px;
        text-align: center;
    }

    .preview-bottom-actions {
        flex-direction: column;
        gap: 12px;
    }

    .paypal-box,
    .renew-paypal-box {
        width: 100%;
        box-sizing: border-box;
    }

    .flipbook-shell {
        gap: 8px;
        padding: 0;
    }

    .flipbook-card {
        width: 100%;
        padding: 12px;
    }

    .flipbook-page-wrap img {
        max-width: 100%;
        height: auto;
    }

    .flip-nav-btn {
        width: 42px;
        min-width: 42px;
        height: 42px;
        padding: 0;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 23px;
    }

    .book-cover,
    .image-cover {
        height: 200px;
    }

    .book-card {
        padding: 16px;
    }

    .auth-card {
        padding: 20px 14px;
    }

    .flip-nav-btn {
        width: 36px;
        min-width: 36px;
        height: 36px;
        font-size: 24px;
    }
}

/* Final admin users import layout */

.bulk-import-section {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
}

.bulk-import-title {
    font-size: 18px;
    font-weight: 700;
    color: #172033;
    margin-bottom: 12px;
}

.bulk-import-form {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.bulk-import-form .small-btn,
.bulk-import-form button,
.bulk-import-form a {
    width: auto !important;
    min-width: 120px;
}

.excel-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    width: auto !important;
    padding: 0 18px;
    border-radius: 14px;
    background: #f1f5f9;
    color: #1e293b;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.excel-file-btn:hover {
    background: #eaf1f8;
}

.excel-file-btn input[type="file"] {
    display: none;
}

.excel-file-name {
    color: #64748b;
    font-size: 14px;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
