:root {
    --bg: #0a0c1a;
    --bg-soft: #121629;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-strong: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.12);
    --text: #f4f7ff;
    --muted: #aab2cf;
    --primary: #8d72ff;
    --primary-dark: #5f41e4;
    --accent: #2dd4bf;
    --danger: #ff6b81;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    --radius-lg: 28px;
    --radius-md: 20px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

body {
    background:
        url("../images/pattern-icons.svg"),
        radial-gradient(circle at top left, rgba(141, 114, 255, 0.22), transparent 28%),
        radial-gradient(circle at bottom right, rgba(45, 212, 191, 0.16), transparent 24%),
        var(--bg);
    color: var(--text);
    font-family: "Inter", "Cairo", sans-serif;
    min-height: 100vh;
    background-attachment: fixed;
    background-size:
        190px 190px,
        auto,
        auto,
        auto;
}

html[lang="ar"] body,
html[dir="rtl"] body {
    font-family: "Cairo", "Inter", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(18px);
    background: rgba(10, 12, 26, 0.75);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.navbar-brand,
.nav-link {
    color: var(--text) !important;
}

.nav-link {
    opacity: 0.8;
}

.nav-link:hover,
.nav-link:focus {
    opacity: 1;
}

.hero-section,
.auth-section,
.post-page {
    padding-top: 3rem;
}

.hero-card,
.auth-card,
.single-post-card,
.comment-box,
.admin-panel-card,
.admin-stat-card,
.post-card,
.empty-state {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero-card,
.auth-card,
.admin-panel-card {
    padding: 2rem;
}

.hero-badge,
.footer-chip,
.back-link,
.comment-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    font-size: 0.9rem;
}

.section-heading h2,
.section-title {
    font-weight: 800;
}

.post-card {
    overflow: hidden;
    height: 100%;
}

.post-image-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 260px;
    padding: 0.85rem;
    background:
        radial-gradient(circle at top right, rgba(141, 114, 255, 0.14), transparent 38%),
        radial-gradient(circle at bottom left, rgba(45, 212, 191, 0.1), transparent 34%),
        rgba(255, 255, 255, 0.03);
}

.post-card-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.single-post-image {
    width: 100%;
    object-fit: cover;
    max-height: 480px;
}

.post-card-body,
.single-post-body,
.comment-box,
.empty-state,
.comment-admin-item {
    padding: 1.5rem;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.post-card-title,
.single-post-title {
    font-weight: 800;
    line-height: 1.3;
}

.post-card-title {
    font-size: 1.35rem;
    min-height: 3.4rem;
}

.single-post-title {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 1.5rem;
}

.post-card-excerpt,
.single-post-content,
.text-muted,
.form-text {
    color: var(--muted) !important;
}

.single-post-content {
    font-size: 1.06rem;
    line-height: 2;
}

.posts-toolbar {
    display: grid;
    gap: 1rem;
}

[data-posts-panel] {
    position: relative;
}

[data-posts-panel].is-loading {
    opacity: 0.72;
    transition: opacity 0.18s ease;
    pointer-events: none;
}

.search-form {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
    max-width: 720px;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background:
        radial-gradient(circle at top left, rgba(141, 114, 255, 0.2), transparent 36%),
        radial-gradient(circle at bottom right, rgba(45, 212, 191, 0.14), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 18px 48px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px);
    overflow: hidden;
}

.search-form::before,
.search-form::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    opacity: 0.8;
}

.search-form::before {
    width: 180px;
    height: 180px;
    top: -95px;
    inset-inline-end: -55px;
    background: radial-gradient(circle, rgba(141, 114, 255, 0.22), transparent 68%);
}

.search-form::after {
    width: 150px;
    height: 150px;
    bottom: -85px;
    inset-inline-start: -40px;
    background: radial-gradient(circle, rgba(45, 212, 191, 0.18), transparent 68%);
}

.search-form .form-control {
    flex: 1 1 220px;
    position: relative;
    z-index: 1;
    background: rgba(8, 11, 22, 0.4);
    border-color: rgba(255, 255, 255, 0.12);
}

.search-form .btn,
.search-form .form-control {
    position: relative;
    z-index: 1;
}

.search-form .btn-gradient {
    box-shadow: 0 14px 34px rgba(95, 65, 228, 0.28);
}

.search-summary {
    color: var(--muted);
    font-size: 0.96rem;
}

.search-summary strong {
    color: var(--text);
    font-weight: 700;
}

.search-summary-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 0.22rem 0.65rem;
    margin-inline-start: 0.5rem;
    border-radius: 999px;
    background: rgba(45, 212, 191, 0.14);
    color: #b8fff4;
    font-size: 0.85rem;
    font-weight: 700;
}

.pagination-wrap {
    margin-top: 2rem;
}

.pagination .page-link {
    min-width: 44px;
    padding: 0.72rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    box-shadow: none;
}

.pagination .page-item {
    padding-inline: 0.2rem;
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: transparent;
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.34);
    border-color: rgba(255, 255, 255, 0.06);
}

.pagination .page-link:hover,
.pagination .page-link:focus {
    color: var(--text);
    background: rgba(141, 114, 255, 0.12);
    border-color: rgba(141, 114, 255, 0.3);
}

.btn-gradient {
    color: #fff;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 16px 40px rgba(95, 65, 228, 0.35);
}

.btn-gradient:hover,
.btn-gradient:focus {
    color: #fff;
    transform: translateY(-1px);
}

.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
}

.form-control:focus,
.form-select:focus {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(141, 114, 255, 0.9);
    box-shadow: 0 0 0 0.25rem rgba(141, 114, 255, 0.18);
}

.form-select option,
.form-select optgroup {
    background: #0b1020;
    color: var(--text);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.comment-list,
.comment-admin-list {
    display: grid;
    gap: 1rem;
}

.comment-item,
.comment-admin-item {
    padding: 1rem 1.15rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.comment-item strong,
.comment-admin-item strong {
    font-size: 1rem;
    font-weight: 600;
    color: #eef2ff;
}

.comment-item .small,
.comment-admin-item .small {
    font-size: 0.84rem;
}

.comment-item p,
.comment-admin-item p {
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.85;
    font-weight: 400;
    word-break: break-word;
}

.empty-state {
    text-align: center;
}

.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(7, 9, 20, 0.8);
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-sidebar {
    padding: 2rem 1.25rem;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(8, 11, 22, 0.92);
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-brand {
    display: inline-block;
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.admin-welcome {
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.admin-link {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    color: var(--text);
    transition: all 0.2s ease;
}

.admin-link:hover,
.admin-link:focus {
    border-color: rgba(141, 114, 255, 0.45);
    background: rgba(141, 114, 255, 0.14);
}

.admin-link-danger:hover,
.admin-link-danger:focus {
    border-color: rgba(255, 107, 129, 0.45);
    background: rgba(255, 107, 129, 0.14);
}

.admin-content {
    min-width: 0;
}

.admin-stat-card {
    padding: 1.5rem;
}

.admin-stat-card span {
    color: var(--muted);
    display: block;
    margin-bottom: 0.4rem;
}

.admin-stat-card strong {
    font-size: 2rem;
    font-weight: 800;
}

.admin-table {
    color: var(--text);
    margin-bottom: 0;
}

.admin-table > :not(caption) > * > * {
    background: transparent;
    color: inherit;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.table-thumb,
.upload-preview-image {
    width: 92px;
    height: 72px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.upload-preview {
    min-height: 100%;
    display: flex;
    align-items: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
}

.status-badge.published {
    background: rgba(45, 212, 191, 0.15);
    color: #8ff5e4;
}

.status-badge.draft {
    background: rgba(255, 184, 77, 0.15);
    color: #ffd391;
}

.alert {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
}

.alert-success {
    background: rgba(45, 212, 191, 0.16);
    color: #c6fff6;
    border-color: rgba(45, 212, 191, 0.24);
}

.alert-danger {
    background: rgba(255, 107, 129, 0.16);
    color: #ffd6de;
    border-color: rgba(255, 107, 129, 0.24);
}

.page-intro,
.d-flex .h3,
.h5 {
    color: var(--text);
}

code {
    color: #d8ccff;
}

textarea.form-control {
    min-height: 180px;
}

.rt-editor {
    display: grid;
    gap: 0.75rem;
}

.rt-toolbar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(18px);
}

.rt-group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.rt-divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.12);
}

.rt-btn {
    width: 38px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.88);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.rt-btn:hover,
.rt-btn:focus {
    background: rgba(141, 114, 255, 0.18);
    border-color: rgba(141, 114, 255, 0.35);
    transform: translateY(-1px);
}

.rt-btn.is-active {
    background: rgba(45, 212, 191, 0.16);
    border-color: rgba(45, 212, 191, 0.32);
    color: #dffff9;
}

.rt-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.rt-select {
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.88);
    padding: 0 0.75rem;
    min-width: 160px;
    outline: none;
    color-scheme: dark;
}

.rt-select:focus {
    border-color: rgba(141, 114, 255, 0.55);
    box-shadow: 0 0 0 0.2rem rgba(141, 114, 255, 0.14);
}

.rt-select option {
    background: #0b1020;
    color: #f4f7ff;
}

.rt-color {
    width: 44px;
    height: 34px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
}

.rt-color--bg {
    position: relative;
}

.rt-color--bg::before {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.35);
    pointer-events: none;
}

.rt-editor--disabled {
    opacity: 0.55;
}

.rt-editor--disabled .rt-surface {
    cursor: not-allowed;
}

.editor-lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    margin: 0;
    min-height: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.editor-lang-switch.form-check {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

.editor-lang-switch.form-switch {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

.editor-lang-switch .form-check-input {
    float: none;
    margin: 0 !important;
}

.editor-lang-switch .form-check-label {
    margin: 0;
    line-height: 1.4;
}

html[dir="rtl"] .editor-lang-switch {
    flex-direction: row-reverse;
}

.rt-surface {
    min-height: 260px;
    height: auto;
    overflow: auto;
}

.rt-surface:focus {
    outline: none;
}

.rt-surface h2,
.rt-surface h3 {
    margin-top: 1.2rem;
    margin-bottom: 0.75rem;
}

.rt-surface ul,
.rt-surface ol {
    padding-inline-start: 1.25rem;
}

.rt-surface blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-inline-start: 3px solid rgba(45, 212, 191, 0.55);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    color: #dff9f6;
}

.rt-surface a,
.single-post-content a {
    color: #7ee7d8;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
    font-weight: 600;
    word-break: break-word;
    transition: color 0.16s ease, text-decoration-color 0.16s ease, opacity 0.16s ease;
}

.rt-surface a {
    background: rgba(45, 212, 191, 0.08);
    padding: 0.08rem 0.2rem;
    border-radius: 6px;
}

.rt-surface a:hover,
.rt-surface a:focus,
.single-post-content a:hover,
.single-post-content a:focus {
    color: #b8fff4;
    text-decoration-color: rgba(184, 255, 244, 0.95);
}

.single-post-content a {
    text-decoration-color: rgba(126, 231, 216, 0.6);
}

.single-post-content a:visited {
    color: #c4b5fd;
    text-decoration-color: rgba(196, 181, 253, 0.55);
}

.sidebar-stack {
    display: grid;
    gap: 1.5rem;
    position: relative;
}

.goodreads-widget {
    position: relative;
}

.goodreads-widget--shelf {
    position: sticky;
    top: 110px;
}

.goodreads-widget--discovery .goodreads-widget-inner {
    padding: 1.25rem;
}

.discoveryBox {
    direction: ltr;
    text-align: left;
}

.goodreads-widget-inner {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background:
        radial-gradient(circle at top right, rgba(45, 212, 191, 0.14), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
    box-shadow: var(--shadow);
}

.goodreads-badge {
    background: rgba(45, 212, 191, 0.12);
    border-color: rgba(45, 212, 191, 0.22);
}

.goodreads-text {
    color: var(--muted);
    line-height: 1.8;
}

.goodreads-cover-wrap {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}

.goodreads-cover {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.goodreads-book-card {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.goodreads-kicker {
    display: inline-block;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9deee2;
    margin-bottom: 0.75rem;
}

.goodreads-book-title {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.35;
}

.goodreads-links {
    display: grid;
    gap: 0.75rem;
}

.goodreads-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.goodreads-link span {
    color: var(--muted);
}

.goodreads-link strong {
    font-size: 0.95rem;
}

.discoveryBoxTitle {
    font-size: 1.35rem;
    font-weight: 900;
    margin: 0 0 1rem;
    letter-spacing: -0.02em;
}

.discoveryBoxTitle em {
    color: #9deee2;
    font-style: normal;
}

.discoveryBoxDiscovery {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 1rem;
    padding: 1.2rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.discoveryBoxDiscovery + .discoveryBoxDiscovery {
    margin-top: 1rem;
}

.discoverySourceActionText {
    color: var(--muted);
    margin: 0 0 0.85rem;
    font-size: 0.95rem;
}

.discoverySourceCovers {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.55rem;
    overflow-x: auto;
    padding-bottom: 2px;
}

.bookImgSimilar {
    width: 62px;
    height: 90px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    object-fit: cover;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.bookImgSimilar:hover {
    transform: translateY(-2px);
}

.discoveryBoxResultBook {
    min-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.35rem;
    text-align: end;
}

.discoveryBoxResultActionText {
    margin: 0;
    font-weight: 800;
    color: #cfe7ff;
}

.discoveryBoxResultDescriptors {
    margin: 0 0 0.35rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.bookImgDiscovered {
    display: inline-flex;
    width: 86px;
    height: 132px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.28);
}

.bookImgDiscovered img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.discoveryBoxArrow {
    position: absolute;
    inset-inline-end: 1rem;
    inset-block-start: 1rem;
    opacity: 0.6;
    pointer-events: none;
}

.discoveryBoxArrow img {
    width: 44px;
    height: auto;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.3));
}

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

    .admin-sidebar {
        position: static;
        height: auto;
        border-inline-end: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .post-card-title {
        min-height: auto;
    }

    .goodreads-widget--shelf {
        position: static;
    }

    .search-form {
        width: 100%;
    }


    .discoveryBoxDiscovery {
        grid-template-columns: 1fr;
    }

    .discoveryBoxArrow {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .hero-card,
    .auth-card,
    .admin-panel-card,
    .single-post-body,
    .comment-box {
        padding: 1.25rem;
    }

    .post-image-link {
        height: 220px;
    }
}
