@font-face {
    font-family: 'IBM Plex Sans Arabic';
    src: url('../fonts/IBMPlexSansArabic-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Sans Arabic';
    src: url('../fonts/IBMPlexSansArabic-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Sans Arabic';
    src: url('../fonts/IBMPlexSansArabic-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'IBM Plex Sans Arabic';
    src: url('../fonts/IBMPlexSansArabic-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Lexend Deca';
    src: url('../fonts/en/LexendDeca-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Lexend Deca';
    src: url('../fonts/en/LexendDeca-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Lexend Deca';
    src: url('../fonts/en/LexendDeca-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Lexend Deca';
    src: url('../fonts/en/LexendDeca-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary-color: #0d6efd;
    --soft-bg: #f6f8fb;
    --line-color: #e7ebf0;
    --font-arabic: 'IBM Plex Sans Arabic', Tahoma, Arial, sans-serif;
    --font-ui: 'Lexend Deca', 'IBM Plex Sans Arabic', Tahoma, Arial, sans-serif;
}

body {
    font-family: var(--font-arabic);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.8;
    background: var(--soft-bg);
    color: #1f2937;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body,
button,
input,
select,
textarea {
    font-family: var(--font-arabic);
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-family: var(--font-arabic);
    font-weight: 600;
    line-height: 1.6;
    color: #0f172a;
}

h1,
.h1 {
    font-weight: 700;
}

h2,
.h2,
h3,
.h3 {
    font-weight: 600;
}

p,
li,
td,
th,
label,
input,
textarea,
select {
    font-size: 0.98rem;
}

small,
.small,
.text-muted,
.footer-note,
.message-meta {
    font-weight: 500;
}

.btn,
.form-label,
.navbar-brand,
.nav-link,
.table thead th,
.dropdown-item {
    font-weight: 500;
}

.btn .bi,
.nav-link .bi,
.badge .bi,
.dropdown-item .bi,
.message-meta .bi,
.chat-date-badge .bi,
.message-attachment-label .bi {
    line-height: 1;
}

.btn,
.nav-link,
.stat-number,
.message-meta,
code,
.badge {
    font-family: var(--font-ui);
}

html[lang='ar'] .btn,
html[lang='ar'] .nav-link,
html[lang='ar'] .badge {
    font-family: var(--font-arabic);
}

.site-navbar {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line-color);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: 1px solid var(--line-color);
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-mark img {
    max-width: 38px;
    height: auto;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.brand-title {
    font-size: 1.02rem;
    font-weight: 700;
    color: #0f172a;
}

.brand-subtitle {
    font-size: 0.88rem;
    font-weight: 500;
    color: #64748b;
}

.site-navbar .navbar-toggler {
    border-color: var(--line-color);
}

.site-navbar .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #334155;
    font-size: 0.96rem;
    font-weight: 500;
    padding: 0.7rem 1rem;
    border-radius: 999px;
}

.site-navbar .nav-link.active,
.site-navbar .nav-link:hover {
    color: var(--primary-color);
    background: #e7f0ff;
}

a {
    text-decoration: none;
}

.site-header {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-bottom: 1px solid var(--line-color);
}

.logo-box img {
    max-width: 110px;
    height: auto;
}

.hero-card,
.auth-card,
.admin-card,
.section-card,
.chat-wrapper,
.message-composer,
.member-card {
    border: 1px solid var(--line-color);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.hero-title {
    font-size: clamp(1.45rem, 2.4vw, 2.1rem);
    line-height: 1.8;
    font-weight: 700;
}

.hero-card p,
.section-card p,
.auth-card p,
.admin-card p {
    font-size: 1rem;
}

.section-card h2,
.auth-card h1,
.admin-topbar h1,
.admin-card h2,
.admin-card h3 {
    font-weight: 600;
}

.page-shell {
    min-height: 100vh;
}

.admin-sidebar {
    min-height: 100vh;
    background: #0f172a;
    color: #fff;
}

.admin-sidebar-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.45rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
}

.admin-sidebar a {
    color: #e5e7eb;
    display: block;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    margin-bottom: 0.35rem;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.admin-topbar {
    border-bottom: 1px solid var(--line-color);
    background: #fff;
}

.admin-topbar h1 {
    font-size: 1.05rem;
}

.stat-card {
    border: 1px solid var(--line-color);
    border-radius: 18px;
    padding: 1rem;
    background: #fff;
    height: 100%;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.chat-page {
    min-height: 100vh;
    background: #efeae2;
}

.chat-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    box-shadow: none;
}

.chat-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    border-bottom: 1px solid var(--line-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.8rem 7rem;
    background-image:
      radial-gradient(circle at 20% 20%, rgba(255,255,255,0.45) 0, rgba(255,255,255,0) 22%),
      radial-gradient(circle at 80% 20%, rgba(255,255,255,0.35) 0, rgba(255,255,255,0) 20%);
}

.message-row {
    display: flex;
    margin-bottom: 0.75rem;
}

.chat-date-divider {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0 1rem;
}

.chat-date-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: #475569;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.message-row.admin {
    justify-content: flex-end;
}

.message-row.member {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 78%;
    padding: 0.7rem 0.9rem;
    border-radius: 16px;
    position: relative;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.message-body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.message-body-text {
    line-height: 1.85;
}

.message-row.admin .message-bubble {
    background: #dcf8c6;
    border-bottom-right-radius: 6px;
}

.message-row.member .message-bubble {
    background: #fff;
    border-bottom-left-radius: 6px;
}

.message-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.76rem;
    color: #6b7280;
    margin-top: 0.35rem;
}

.message-attachment-link {
    display: inline-block;
}

.message-image-thumb {
    width: min(280px, 100%);
    max-width: 100%;
    border-radius: 14px;
    display: block;
    object-fit: cover;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}

.message-video-preview {
    width: min(320px, 100%);
    max-width: 100%;
    border-radius: 14px;
    background: #000;
}

.message-audio-preview {
    width: min(280px, 100%);
    max-width: 100%;
}

.message-attachment-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.message-attachment-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.84rem;
    color: #475569;
    font-weight: 500;
}

.message-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px dashed rgba(15, 23, 42, 0.12);
}

.btn-icon-only {
    width: 2.25rem;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: 999px;
}

.btn-icon-only .bi {
    font-size: 0.95rem;
}

.question-message-card {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.1rem 0;
}

.question-message-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    align-self: flex-start;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.1);
    color: #0d4fd4;
    font-size: 0.78rem;
    font-weight: 600;
}

.question-message-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.9;
}

.question-message-state,
.question-message-footnote {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-size: 0.84rem;
    color: #475569;
}

.question-message-state.answered {
    color: #0f766e;
    font-weight: 600;
}

.question-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.question-option-btn {
    border-radius: 999px;
    border: 1px solid rgba(13, 110, 253, 0.18);
    background: rgba(255, 255, 255, 0.88);
    color: #0f172a;
    padding-inline: 0.9rem;
}

.question-option-btn:hover:not(:disabled) {
    border-color: rgba(13, 110, 253, 0.4);
    background: #eef5ff;
    color: #0d4fd4;
}

.question-option-btn.is-selected,
.question-option-btn:disabled.is-selected {
    background: #dff6ec;
    border-color: rgba(22, 163, 74, 0.3);
    color: #166534;
    opacity: 1;
}

.question-option-btn:disabled {
    opacity: 0.72;
    cursor: not-allowed;
}

.message-composer {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    z-index: 10;
    padding: 0.75rem;
    border-radius: 18px 18px 0 0;
}

.message-composer .composer-inner {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 0.5rem;
    align-items: center;
}

.composer-attachment-preview {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(13, 110, 253, 0.14);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.composer-attachment-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #e8f1ff;
    color: #0d6efd;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.05rem;
}

.composer-attachment-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.composer-attachment-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    word-break: break-word;
    line-height: 1.6;
}

.composer-attachment-size {
    font-size: 0.86rem;
    font-weight: 500;
    color: #64748b;
    line-height: 1.6;
}

.composer-textarea {
    resize: none;
    min-height: 46px;
    max-height: 130px;
    border-radius: 14px;
    font-size: 0.98rem;
}

.attach-menu {
    min-width: 220px;
}

.link-expired-card {
    max-width: 520px;
}

.site-footer {
    border-top: 1px solid var(--line-color);
    background: #fff;
}

.footer-note {
    color: #64748b;
}

.chat-empty-state {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #64748b;
    padding: 2rem 1rem;
}

.chat-active .site-navbar,
.chat-active .site-footer {
    display: none;
}

.admin-chat-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-chat-member-card {
    position: sticky;
    top: 1rem;
    z-index: 6;
}

.admin-chat-member-grid,
.admin-chat-linkbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.member-meta-item {
    border: 1px solid var(--line-color);
    border-radius: 16px;
    background: #fbfcff;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.member-meta-item span {
    font-size: 0.8rem;
    color: #64748b;
}

.member-meta-item strong {
    font-size: 0.95rem;
    color: #0f172a;
    word-break: break-word;
}

.member-meta-link a {
    color: var(--primary-color);
}

.admin-chat-actions {
    min-width: min(100%, 260px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.admin-chat-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    padding: 0.55rem 0.9rem;
}

.admin-chat-board {
    min-height: calc(100vh - 250px);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

.admin-chat-board .chat-header {
    position: sticky;
    top: 0;
    z-index: 4;
}

.admin-chat-messages {
    min-height: 50vh;
    max-height: calc(100vh - 390px);
    padding-bottom: 1rem;
}

.admin-message-composer {
    position: sticky;
    bottom: 0;
    right: auto;
    left: auto;
    border-radius: 0;
    border-top: 1px solid var(--line-color);
    margin-top: auto;
    box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.05);
}

.admin-chat-closed-note {
    border-top: 1px solid var(--line-color);
    background: #fff;
    color: #64748b;
    text-align: center;
    padding: 1rem;
}

.question-picker-modal .modal-content,
.question-picker-modal {
    border-radius: 24px;
}

.question-picker-results {
    display: grid;
    gap: 0.85rem;
}

.question-picker-card {
    border: 1px solid var(--line-color);
    border-radius: 18px;
    background: #fbfcff;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.question-picker-title {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.9;
    color: #0f172a;
}

.question-picker-answers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.question-picker-answer-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #334155;
    font-size: 0.8rem;
    font-weight: 500;
}

.question-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.question-picker-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #64748b;
    font-size: 0.82rem;
}

.question-picker-empty {
    min-height: 180px;
    border: 1px dashed var(--line-color);
    border-radius: 20px;
    background: #fbfcff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    color: #64748b;
}

.question-answer-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.question-answer-row .input-group-text {
    background: #f8fafc;
}

.question-delete-modal .modal-content {
    border-radius: 24px;
}

.question-delete-preview {
    border: 1px solid rgba(239, 68, 68, 0.15);
    background: #fff5f5;
    border-radius: 16px;
    padding: 0.95rem 1rem;
    line-height: 1.9;
    color: #7f1d1d;
    font-weight: 500;
}

.media-gallery-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(13, 110, 253, 0.16), transparent 34%),
        linear-gradient(180deg, #08111f 0%, #101827 100%);
    color: #fff;
}

.media-gallery-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
}

.media-gallery-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
}

.media-gallery-heading h1 {
    color: #fff;
}

.media-gallery-count {
    min-width: 56px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding-inline: 0.85rem;
}

.media-gallery-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.media-gallery-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.media-gallery-view {
    min-height: 58vh;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.media-gallery-image,
.media-gallery-video {
    max-width: 100%;
    max-height: 72vh;
    display: block;
}

.media-gallery-meta {
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 1.1rem;
}

.media-gallery-caption {
    margin-top: 0.85rem;
    color: rgba(255, 255, 255, 0.84);
    line-height: 1.9;
}

.media-gallery-strip-wrap {
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.9rem;
}

.media-gallery-strip {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    cursor: grab;
    scrollbar-width: thin;
}

.media-gallery-strip.dragging {
    cursor: grabbing;
    user-select: none;
}

.media-gallery-thumb {
    position: relative;
    flex: 0 0 120px;
    height: 82px;
    border-radius: 18px;
    overflow: hidden;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.media-gallery-thumb.active {
    border-color: #fff;
    transform: translateY(-1px);
}

.media-gallery-thumb img,
.media-gallery-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-thumb-badge {
    position: absolute;
    inset-inline-start: 0.55rem;
    inset-block-start: 0.55rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.74);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.media-gallery-empty {
    flex: 1;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.table thead th {
    white-space: nowrap;
    font-size: 0.92rem;
}

.form-label {
    font-size: 0.95rem;
}

.btn-lg {
    font-size: 1rem;
}

.btn-sm {
    font-size: 0.84rem;
}

@media (max-width: 767.98px) {
    body {
        font-size: 0.96rem;
    }

    .brand-mark {
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }

    .brand-mark img {
        max-width: 32px;
    }

    .brand-subtitle {
        font-size: 0.78rem;
    }

    .hero-title {
        font-size: 1.35rem;
        line-height: 1.75;
    }

    .site-navbar .nav-link {
        padding-inline: 0.85rem;
    }

    .admin-chat-member-card {
        top: 0.5rem;
    }

    .admin-chat-board {
        min-height: calc(100vh - 220px);
        border-radius: 20px;
    }

    .admin-chat-messages {
        max-height: calc(100vh - 430px);
    }

    .media-gallery-shell {
        padding: 0.75rem;
    }

    .media-gallery-header {
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .media-gallery-count {
        justify-self: center;
    }

    .media-gallery-view {
        min-height: 44vh;
    }

    .media-gallery-thumb {
        flex-basis: 96px;
        height: 72px;
    }

    .admin-sidebar {
        min-height: auto;
        border-radius: 0 0 20px 20px;
    }

    .message-bubble {
        max-width: 88%;
    }

    .message-composer .composer-inner {
        grid-template-columns: auto 1fr auto;
    }

    .composer-attachment-preview {
        padding: 0.75rem 0.85rem;
    }

    .send-btn {
        grid-column: 1 / -1;
    }

    .question-picker-footer {
        flex-direction: column;
        align-items: stretch;
    }
}
