@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Amiri+Quran&family=Scheherazade+New:wght@400;500;600;700&family=Tajawal:wght@300;400;500;700;800&family=Cairo:wght@300;400;500;600;700;800&display=swap');

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

:root {
  --bg: #F3EAD7;
  --bg-card: #EDE2CC;
  --bg-dark: #5C3412;
  --text: #3B2209;
  --text-muted: #7A6B52;
  --primary: #7A4A1A;
  --primary-dark: #5C3412;
  --accent: #D8C08A;
  --accent-light: #E8D9B5;
  --border: #D4C5A3;
  --white: #FFF9EF;
  --font-sans: 'Tajawal', 'Cairo', sans-serif;
  --font-serif: 'Amiri', 'Scheherazade New', serif;
  --font-content: 'Amiri', 'Scheherazade New', serif;
  --radius: 10px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.container { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(243,234,215,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--primary); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 18px;
}
.logo-img {
  width: 36px; height: 36px; border-radius: 8px; object-fit: cover;
}
.logo-text { font-family: var(--font-serif); font-weight: 700; font-size: 17px; color: var(--text); }

.nav-links { display: none; gap: 4px; align-items: center; }
.nav-links a {
  padding: 6px 14px; border-radius: 6px; font-size: 14px; font-weight: 500;
  color: var(--text-muted); transition: background .2s;
}
.nav-links a:hover { background: var(--accent-light); color: var(--text); }

.nav-search-form {
  display: flex; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; margin: 0 4px;
}
.nav-search-input {
  border: none; background: none; padding: 5px 10px;
  font-size: 13px; font-family: var(--font-sans);
  color: var(--text); width: 120px; outline: none;
  direction: rtl;
}
.nav-search-input::placeholder { color: var(--text-muted); opacity: 0.6; }
.nav-search-btn {
  background: none; border: none; padding: 5px 8px;
  color: var(--text-muted); cursor: pointer; font-size: 13px;
  transition: color .2s;
}
.nav-search-btn:hover { color: var(--primary); }

.mobile-menu-btn {
  background: none; border: none; cursor: pointer;
  padding: 8px; color: var(--text); font-size: 20px;
}
.mobile-nav {
  display: none; border-top: 1px solid var(--border);
  padding: 8px 0; background: var(--bg);
}
.mobile-nav.open { display: block; }
.mobile-nav a {
  display: block; padding: 10px 16px; font-size: 15px; font-weight: 500;
  color: var(--text-muted); border-radius: 6px; text-align: center;
}
.mobile-nav a:hover { background: var(--accent-light); }
.mobile-search-form {
  display: flex; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; margin: 8px 16px;
}
.mobile-search-input {
  flex: 1; border: none; background: none; padding: 8px 12px;
  font-size: 14px; font-family: var(--font-sans);
  color: var(--text); outline: none; direction: rtl;
}
.mobile-search-input::placeholder { color: var(--text-muted); opacity: 0.6; }
.mobile-search-btn {
  background: none; border: none; padding: 8px 12px;
  color: var(--text-muted); cursor: pointer; font-size: 14px;
}
.mobile-search-btn:hover { color: var(--primary); }

@media(min-width:768px) {
  .nav-links { display: flex; }
  .mobile-menu-btn { display: none; }
}

.hero {
  padding: 48px 0 40px; text-align: center;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--bg) 100%);
  position: relative; overflow: hidden;
}
.hero::before {
  content: 'ﷲ'; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 280px; font-family: var(--font-serif);
  color: var(--primary); opacity: 0.03; pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary); color: var(--white);
  padding: 6px 16px; border-radius: 20px; font-size: 13px;
  font-weight: 600; margin-bottom: 20px; font-family: var(--font-serif);
}
.hero-badge i { font-size: 14px; }
.hero-bismillah {
  font-family: var(--font-serif); font-size: 42px;
  color: var(--primary); opacity: 0.25; line-height: 1;
  margin-bottom: -8px;
}
.hero h1 {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 32px; line-height: 1.4; color: var(--text); margin-bottom: 8px;
}
.hero-subtitle {
  font-family: var(--font-serif); font-size: 16px;
  color: var(--text-muted); margin-bottom: 8px;
}
.hero-desc {
  font-size: 14px; color: var(--text-muted); max-width: 500px;
  margin: 0 auto 16px; line-height: 1.8;
}
.hero-divider {
  width: 60px; height: 3px; border-radius: 3px;
  background: linear-gradient(to left, var(--primary), transparent);
  margin: 0 auto 20px;
}

@media(min-width:768px) {
  .hero { padding: 64px 0 56px; }
  .hero h1 { font-size: 48px; }
  .hero-subtitle { font-size: 20px; }
  .hero-bismillah { font-size: 60px; }
}

.search-box {
  max-width: 400px; margin: 0 auto 24px; position: relative;
}
.search-box input {
  width: 100%; padding: 10px 40px 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white); font-family: var(--font-sans);
  font-size: 14px; color: var(--text); direction: rtl;
}
.search-box input:focus { outline: none; border-color: var(--primary); }
.search-box .search-icon {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px; pointer-events: none;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 20px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius); font-size: 14px;
  font-weight: 600; border: none; cursor: pointer; transition: all .2s;
  font-family: var(--font-sans); text-decoration: none;
}
.btn i { font-size: 13px; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); color: var(--white); }
.btn-secondary { background: var(--accent-light); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--accent); }
.btn-ghost { background: none; color: var(--text-muted); }
.btn-ghost:hover { background: var(--accent-light); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.social-links { display: flex; gap: 8px; justify-content: center; }
.social-link {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg-card); display: flex; align-items: center;
  justify-content: center; color: var(--text-muted); font-size: 16px;
  transition: all .2s; border: 1px solid var(--border);
}
.social-link:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }
.social-link i { font-size: 16px; }

.topics-section { padding: 32px 0 48px; }
.section-title {
  text-align: center; font-family: var(--font-serif);
  font-size: 24px; font-weight: 700; margin-bottom: 6px;
}
.section-divider {
  width: 40px; height: 2px; background: var(--primary);
  opacity: 0.4; margin: 0 auto 24px; border-radius: 2px;
}

.topics-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media(min-width:640px) { .topics-grid { grid-template-columns: repeat(2,1fr); } }
@media(min-width:1024px) { .topics-grid { grid-template-columns: repeat(3,1fr); } }

.topic-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  display: flex; flex-direction: column; gap: 0;
  transition: all .2s; cursor: pointer; text-decoration: none; color: inherit;
  position: relative;
}
.topic-card:hover { box-shadow: 0 4px 16px rgba(92,52,18,0.1); transform: translateY(-2px); }
.topic-card.card-expanded { box-shadow: 0 4px 16px rgba(92,52,18,0.1); border-color: var(--primary); }
.topic-card-title {
  font-family: var(--font-serif); font-weight: 700; font-size: 15px;
  color: var(--text); line-height: 1.8;
  display: flex; align-items: baseline; gap: 6px;
}
.topic-num {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 13px; color: var(--primary); flex-shrink: 0;
}
.topic-card-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--border);
  animation: actionsSlideIn .2s ease;
}
@keyframes actionsSlideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.topic-action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-muted); padding: 6px 12px;
  border-radius: 8px; transition: all .2s; text-decoration: none;
  cursor: pointer; border: 1px solid var(--border); background: var(--bg);
  font-family: var(--font-sans); font-weight: 500;
}
.topic-action-btn i { font-size: 12px; }
.topic-action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--accent-light); }
.topic-read-btn { color: var(--primary); border-color: var(--primary); background: rgba(122,74,26,0.06); font-weight: 600; }
.topic-read-btn:hover { background: var(--primary); color: var(--white); }
.topic-read-btn:hover i { color: var(--white); }
.topic-play-btn:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }
.topic-play-btn:hover i { color: var(--white); }
.topic-video-btn:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }
.topic-video-btn:hover i { color: var(--white); }
.topic-dl-btn:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }
.topic-dl-btn:hover i { color: var(--white); }
.topic-share-action:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }
.topic-share-action:hover i { color: var(--white); }

.card-audio-player {
  padding-top: 8px; border-top: 1px solid var(--border);
}
.card-audio-progress {
  height: 4px; border-radius: 2px; background: var(--border);
  overflow: hidden;
}
.card-audio-progress-fill {
  height: 100%; background: var(--primary); width: 0;
  border-radius: 2px; transition: width .2s;
}

.about-section {
  padding: 40px 0; background: var(--bg-card);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.about-text {
  text-align: center; font-family: var(--font-serif);
  font-size: 16px; color: var(--text-muted); line-height: 2;
  max-width: 600px; margin: 0 auto 32px;
}
.features { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media(min-width:640px) { .features { grid-template-columns: repeat(3,1fr); } }
.feature { text-align: center; padding: 16px; }
.feature-icon {
  width: 48px; height: 48px; border-radius: 10px;
  background: rgba(122,74,26,0.1); margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 20px;
}
.feature h3 { font-family: var(--font-serif); font-weight: 700; margin-bottom: 6px; font-size: 15px; }
.feature p { font-size: 13px; color: var(--text-muted); }

.site-footer {
  padding: 32px 0; text-align: center;
  border-top: 1px solid var(--border);
}
.footer-logo { display: flex; align-items: center; gap: 8px; justify-content: center; margin-bottom: 10px; }
.footer-tagline { font-family: var(--font-serif); font-size: 14px; color: var(--text-muted); margin-bottom: 12px; }
.footer-copyright { font-size: 12px; color: var(--text-muted); opacity: 0.6; margin-top: 12px; }
.footer-dev-credits {
  font-size: 11px; color: var(--text-muted); opacity: 0.5;
  margin-top: 8px;
}
.footer-dev-credits a {
  color: var(--text-muted); text-decoration: none;
  transition: all .2s;
}
.footer-dev-credits a:hover { color: var(--primary); opacity: 1; }

.topic-page { padding: 24px 0 48px; }
.topic-header { margin-bottom: 24px; }
.topic-number-badge {
  display: none;
}
.topic-detail-title {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 26px; line-height: 1.6; margin-bottom: 16px;
}
@media(min-width:768px) { .topic-detail-title { font-size: 34px; } }

.topic-media { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.media-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 13px;
  font-weight: 500; text-decoration: none; transition: all .2s;
  border: none; cursor: pointer;
}
.media-btn i { font-size: 13px; }
.media-btn-audio { background: rgba(122,74,26,0.1); color: var(--primary); }
.media-btn-audio:hover { background: rgba(122,74,26,0.2); color: var(--primary); }
.media-btn-video { background: rgba(122,74,26,0.1); color: var(--primary); }
.media-btn-video:hover { background: rgba(122,74,26,0.2); color: var(--primary); }
.media-btn-share {
  background: var(--bg-card); color: var(--text-muted);
  border: 1px solid var(--border);
}
.media-btn-share:hover { background: var(--accent-light); }

.audio-player {
  margin-bottom: 24px; padding: 16px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
}
.audio-player audio { width: 100%; }
.audio-player-label {
  font-family: var(--font-serif); font-size: 14px;
  color: var(--text-muted); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}

.topic-content {
  font-family: var(--font-content); font-size: 19px;
  line-height: 2.2; color: var(--text);
}
.topic-content p { margin-bottom: 16px; }
.topic-content .amiri-quran { font-family: 'Amiri Quran', serif; }
.topic-content span[style*="font-family"] { font-family: inherit; }
.topic-content span[style*="Amiri Quran"] { font-family: 'Amiri Quran', serif !important; }
.topic-content .serial-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: var(--white);
  font-size: 13px; font-weight: 700; margin-left: 8px;
  font-family: var(--font-sans); vertical-align: middle;
}
.topic-empty {
  text-align: center; padding: 48px 16px;
  color: var(--text-muted);
}
.topic-empty i { font-size: 48px; opacity: 0.3; }

.topic-nav {
  display: flex; gap: 12px; margin-top: 40px;
  padding-top: 24px; border-top: 1px solid var(--border);
}
.topic-nav-btn {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--white); border: 1px solid var(--border);
  text-decoration: none; color: var(--text); transition: all .2s;
}
.topic-nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.topic-nav-btn.next { flex-direction: row-reverse; text-align: left; }
.topic-nav-label { font-size: 11px; color: var(--text-muted); }
.topic-nav-title { font-family: var(--font-serif); font-weight: 700; font-size: 14px; }
.topic-nav-arrow { font-size: 16px; color: var(--primary); }

.not-found { text-align: center; padding: 80px 16px; }
.not-found h1 { font-family: var(--font-serif); font-size: 28px; margin-bottom: 12px; }
.not-found p { color: var(--text-muted); margin-bottom: 24px; }
.not-found i { color: var(--primary); }

.admin-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(243,234,215,0.95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.admin-header .header-inner { max-width: 900px; margin: 0 auto; padding: 0 16px; }

.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 16px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px 24px;
}
.login-card .logo-icon { margin: 0 auto 12px; width: 48px; height: 48px; font-size: 22px; }
.login-card h1 { text-align: center; font-family: var(--font-serif); font-size: 20px; margin-bottom: 4px; }
.login-card .subtitle { text-align: center; font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.login-error { background: #fdecea; color: #c0392b; padding: 10px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; text-align: center; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; }
.form-group label i { margin-left: 4px; font-size: 12px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-family: var(--font-sans); font-size: 14px;
  color: var(--text); background: var(--bg); direction: rtl;
}
.form-group input[type="file"] {
  padding: 8px; font-size: 13px;
}
.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary);
}
.form-group textarea { min-height: 150px; resize: vertical; font-family: var(--font-serif); line-height: 1.8; }
.form-group input[dir="ltr"] { direction: ltr; text-align: left; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.admin-tabs {
  display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--border);
  padding-bottom: 8px; flex-wrap: wrap;
}
.admin-tab {
  padding: 8px 12px; border-radius: 6px 6px 0 0; font-size: 13px;
  font-weight: 600; color: var(--text-muted); text-decoration: none; transition: all .2s;
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
}
.admin-tab i { font-size: 12px; }
.admin-tab:hover { color: var(--text); }
.admin-tab.active { background: var(--primary); color: var(--white); }

.admin-topic-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px;
}
.admin-topic-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.admin-topic-num { font-family: var(--font-serif); font-weight: 700; font-size: 13px; color: var(--primary); }
.admin-topic-title { font-family: var(--font-serif); font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-topic-chars { font-size: 11px; color: var(--text-muted); }
.admin-topic-actions { display: flex; gap: 4px; flex-shrink: 0; }
.admin-topic-actions .btn { padding: 6px 8px; }

.admin-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.admin-card h3 {
  font-family: var(--font-serif); font-size: 16px; font-weight: 700;
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.admin-card h3 i { font-size: 14px; color: var(--primary); }

.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: #eafaf1; color: #27ae60; }

@media(max-width:639px) {
  .admin-topic-item { flex-wrap: wrap; }
  .admin-topic-actions { width: 100%; justify-content: flex-end; }
}

.breadcrumb {
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  padding: 10px 0; font-size: 13px;
}
.breadcrumb-list {
  list-style: none; display: flex; flex-wrap: wrap;
  gap: 4px; align-items: center;
}
.breadcrumb-list li { display: flex; align-items: center; gap: 4px; }
.breadcrumb-list li::before { content: '/'; color: var(--text-muted); opacity: 0.5; }
.breadcrumb-list li:first-child::before { display: none; }
.breadcrumb-list a { color: var(--primary); }
.breadcrumb-list a:hover { text-decoration: underline; }
.breadcrumb-list .active { color: var(--text-muted); }

.btn-admin {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--white); border: none;
}
.btn-admin:hover { opacity: 0.9; color: var(--white); }
.nav-admin-link {
  background: var(--primary) !important; color: var(--white) !important;
  border-radius: 6px !important; font-size: 13px !important;
}

.modern-audio-player {
  margin-bottom: 24px; padding: 20px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: var(--white); position: relative; overflow: hidden;
}
.modern-audio-player::before {
  content: ''; position: absolute; top: -30px; left: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.player-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.player-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255,255,255,0.15); display: flex;
  align-items: center; justify-content: center; font-size: 20px;
  flex-shrink: 0;
}
.player-icon i { font-size: 18px; }
.player-info { min-width: 0; }
.player-title {
  font-family: var(--font-serif); font-weight: 700;
  font-size: 15px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.player-subtitle { font-size: 12px; opacity: 0.7; }
.player-controls {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.play-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.4);
  color: var(--white); display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: all .2s;
  flex-shrink: 0;
}
.play-btn:hover { background: rgba(255,255,255,0.3); }
.play-btn.playing { background: rgba(255,255,255,0.35); border-color: rgba(255,255,255,0.6); }
.play-btn svg { width: 20px; height: 20px; }
.player-progress-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px; min-width: 150px;
}
.player-time { font-size: 12px; opacity: 0.8; font-variant-numeric: tabular-nums; min-width: 32px; text-align: center; }
.player-progress {
  flex: 1; height: 6px; border-radius: 3px;
  background: rgba(255,255,255,0.2); cursor: pointer;
  position: relative; direction: rtl;
}
.player-progress-fill {
  height: 100%; border-radius: 3px;
  background: var(--accent); width: 0; position: absolute;
  top: 0; right: 0; transition: width .1s;
}
.player-progress-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--white); position: absolute;
  top: 50%; transform: translateY(-50%);
  right: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: right .1s;
}
.player-volume {
  display: flex; align-items: center; gap: 4px;
}
.vol-btn {
  background: none; border: none; color: var(--white);
  cursor: pointer; padding: 4px; opacity: 0.8;
}
.vol-btn:hover { opacity: 1; }
.vol-btn svg { width: 18px; height: 18px; }
.vol-slider {
  width: 60px; height: 4px; -webkit-appearance: none;
  background: rgba(255,255,255,0.3); border-radius: 2px; outline: none;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--white); cursor: pointer;
}
.speed-btn {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: var(--white); padding: 4px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.speed-btn:hover { background: rgba(255,255,255,0.25); }

@media(max-width:640px) {
  .player-volume { display: none; }
  .player-progress-wrap { min-width: 100px; }
}

.modern-video-player {
  margin-bottom: 24px; border-radius: 14px;
  overflow: hidden; background: #111; border: 1px solid var(--border);
}
.video-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: var(--primary-dark); color: var(--white);
  font-size: 14px; font-weight: 600;
}
.video-container {
  position: relative; padding-bottom: 56.25%; height: 0;
}
.video-container iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.video-container-native { padding: 0; }
.video-container-native video {
  width: 100%; display: block; max-height: 500px; background: #000;
}

.flipbook-page {
  display: flex; flex-direction: column;
  height: calc(100vh - 56px); background: #2c2c2c;
}
.flipbook-page:fullscreen { height: 100vh; }
.flipbook-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: #1a1a1a; border-bottom: 1px solid #333;
  gap: 8px; flex-wrap: wrap;
}
.flipbook-toolbar-right,
.flipbook-toolbar-center,
.flipbook-toolbar-left { display: flex; align-items: center; gap: 6px; }
.fb-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  background: #333; border: 1px solid #444; color: #ddd;
  cursor: pointer; transition: all .2s; text-decoration: none;
  font-size: 13px;
}
.fb-btn:hover { background: #444; color: #fff; }
.fb-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.fb-btn svg { width: 18px; height: 18px; }
.fb-btn i { font-size: 14px; }
.fb-btn-sm { width: auto; padding: 0 12px; font-size: 12px; }
.fb-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.fb-page-info {
  font-size: 13px; color: #aaa; font-family: var(--font-sans);
  padding: 0 6px; white-space: nowrap;
}
.fb-page-input {
  width: 90px; height: 32px; border-radius: 6px;
  background: #333; border: 1px solid #444; color: #ddd;
  text-align: center; font-size: 13px; direction: ltr;
}
.fb-view-toggle { display: flex; gap: 2px; }
.fb-version {
  text-align: center; padding: 6px; font-size: 12px;
  color: #888; background: #222;
}
.flipbook-container {
  flex: 1; display: flex; align-items: flex-start; justify-content: center;
  overflow: auto; padding: 10px;
}
.flipbook-loading {
  text-align: center; color: #aaa;
}
.fb-spinner {
  width: 40px; height: 40px; border: 3px solid #444;
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 1s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.fb-progress-bar {
  width: 200px; height: 4px; background: #444;
  border-radius: 2px; margin: 12px auto 0; overflow: hidden;
}
.fb-progress-fill {
  height: 100%; background: var(--accent); width: 0;
  border-radius: 2px; transition: width .3s;
}
.flipbook-canvas-wrap {
  display: flex; gap: 4px; align-items: flex-start; justify-content: center;
  direction: rtl;
}
.fb-page-container {
  position: relative; display: inline-block;
}
.fb-canvas {
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  background: #fff; display: block;
}
.fb-corner {
  position: absolute; width: 60px; height: 60px;
  cursor: pointer; z-index: 10; opacity: 0; transition: opacity .2s;
}
.fb-corner:hover { opacity: 1; }
.fb-corner-top-right { top: 0; right: 0; background: linear-gradient(225deg, rgba(255,255,255,0.3) 0%, transparent 60%); border-radius: 0 4px 0 0; }
.fb-corner-bottom-right { bottom: 0; right: 0; background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 60%); border-radius: 0 0 4px 0; }
.fb-corner-top-left { top: 0; left: 0; background: linear-gradient(315deg, rgba(255,255,255,0.3) 0%, transparent 60%); border-radius: 4px 0 0 0; }
.fb-corner-bottom-left { bottom: 0; left: 0; background: linear-gradient(45deg, rgba(255,255,255,0.3) 0%, transparent 60%); border-radius: 0 0 0 4px; }
.fb-fold-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 5; opacity: 0;
  transition: opacity .2s;
}
.fb-fold-active { opacity: 1; }
.fb-fold-active.fb-fold-tr { background: linear-gradient(225deg, rgba(200,180,140,0.25) 0%, transparent 30%); }
.fb-fold-active.fb-fold-br { background: linear-gradient(135deg, rgba(200,180,140,0.25) 0%, transparent 30%); }
.fb-fold-active.fb-fold-tl { background: linear-gradient(315deg, rgba(200,180,140,0.25) 0%, transparent 30%); }
.fb-fold-active.fb-fold-bl { background: linear-gradient(45deg, rgba(200,180,140,0.25) 0%, transparent 30%); }
.fb-fold-turn {
  opacity: 1;
  animation: foldTurn .3s ease-out forwards;
}
@keyframes foldTurn {
  0% { opacity: 0.3; }
  50% { opacity: 0.6; background: linear-gradient(225deg, rgba(200,180,140,0.5) 0%, transparent 50%); }
  100% { opacity: 0; }
}

.flipbook-bottom-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 12px 16px;
  background: #1a1a1a; border-top: 1px solid #333;
}
.fb-nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px;
  background: #333; border: 1px solid #444; color: #ddd;
  cursor: pointer; transition: all .2s; font-size: 14px;
  font-family: var(--font-sans); font-weight: 600;
}
.fb-nav-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.fb-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.fb-nav-btn i { font-size: 12px; }
.fb-bottom-page-info {
  font-size: 13px; color: #aaa; font-family: var(--font-sans);
  white-space: nowrap;
}

@media(max-width:767px) {
  .flipbook-toolbar { padding: 6px 8px; }
  .fb-btn { width: 32px; height: 32px; }
  .flipbook-toolbar-center { display: none; }
  .fb-view-toggle { display: none; }
  .fb-nav-btn { padding: 8px 14px; font-size: 13px; }
}

.seo-tool-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 12px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--border);
  text-decoration: none; color: var(--text); transition: all .2s;
  text-align: center;
}
.seo-tool-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.seo-tool-icon { font-size: 24px; margin-bottom: 6px; }
.seo-tool-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.seo-tool-desc { font-size: 11px; color: var(--text-muted); }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: right; padding: 8px; border-bottom: 2px solid var(--border); font-weight: 600; color: var(--text-muted); }
.admin-table td { padding: 8px; border-bottom: 1px solid var(--border); }
.admin-table td i { margin-left: 4px; font-size: 12px; }
.admin-table a { color: var(--primary); word-break: break-all; }

.theme-toggle {
  background: none; border: 1px solid var(--border);
  width: 36px; height: 36px; border-radius: 8px;
  cursor: pointer; font-size: 16px; display: flex;
  align-items: center; justify-content: center;
  transition: all .2s; color: var(--text);
}
.theme-toggle:hover { background: var(--accent-light); border-color: var(--primary); }
.mobile-theme-toggle { display: flex; }
@media(min-width:768px) {
  .mobile-theme-toggle { display: none; }
}

.topic-share-btn {
  background: none; border: 1px solid var(--border);
  width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 14px; display: flex;
  align-items: center; justify-content: center;
  transition: all .2s; flex-shrink: 0; color: var(--text-muted);
}
.topic-share-btn:hover { background: var(--accent-light); border-color: var(--primary); color: var(--primary); }

html.dark .site-header {
  background: rgba(26,21,16,0.95);
}
html.dark .admin-header {
  background: rgba(26,21,16,0.95);
}
html.dark .hero {
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--bg) 100%);
}
html.dark .hero::before { opacity: 0.05; }
html.dark .login-card { background: var(--bg-card); }
html.dark .form-group input, html.dark .form-group textarea, html.dark .form-group select {
  background: var(--bg); color: var(--text); border-color: var(--border);
}
html.dark .search-box input { background: var(--bg-card); color: var(--text); border-color: var(--border); }
html.dark .topic-content .amiri-quran { font-family: 'Amiri Quran', serif; }
html.dark .alert-success { background: #1a2e1a; color: #5cb85c; }
html.dark .login-error { background: #2e1a1a; color: #e74c3c; }

.hero-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45); z-index: 1;
}
.hero[style*="background-image"] .container { position: relative; z-index: 2; }
.hero[style*="background-image"] .hero-badge { background: rgba(122,74,26,0.85); }
.hero[style*="background-image"] h1,
.hero[style*="background-image"] .hero-subtitle,
.hero[style*="background-image"] .hero-desc { color: #fff; }
.hero[style*="background-image"]::before { display: none; }
.hero[style*="background-image"] .hero-bismillah { color: #fff; opacity: 0.4; }

.hero-calligraphy { margin-bottom: 16px; }
.hero-calligraphy img {
  max-height: 100px; max-width: 80%;
  object-fit: contain; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
}
@media(min-width:768px) {
  .hero-calligraphy img { max-height: 140px; }
}

.hero-split .container { max-width: 1100px; }
.hero-split-inner {
  display: flex; align-items: center; gap: 40px; text-align: right;
}
.hero-split-inner.hero-content-right { flex-direction: row-reverse; }
.hero-split-content { flex: 1; min-width: 0; }
.hero-split-content .hero-desc { margin: 0 0 16px; max-width: none; }
.hero-split-content .search-box { margin: 0 0 16px; max-width: 360px; }
.hero-split-actions {
  display: flex; flex-direction: column; gap: 12px;
  flex-shrink: 0;
}
.hero-content-left .hero-split-actions { align-items: flex-end; }
.hero-content-right .hero-split-actions { align-items: flex-start; }
@media(max-width:767px) {
  .hero-split-inner { flex-direction: column !important; text-align: center; }
  .hero-split-content .search-box { margin: 0 auto 16px; }
  .hero-split-content .social-links { justify-content: center !important; }
  .hero-split-actions { width: 100%; align-items: center !important; }
}

@keyframes heroShimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
.btn-hero-lg {
  padding: 14px 28px; font-size: 16px; border-radius: 12px;
  position: relative; overflow: hidden;
}
.btn-hero-lg::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 25%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0.2) 75%, transparent 100%);
  background-size: 200% 100%;
  animation: heroShimmer 3s ease-in-out infinite;
  pointer-events: none; border-radius: inherit;
}
.btn-hero-lg:hover::before { animation-duration: 1.5s; }
.btn-hero-lg i { font-size: 15px; position: relative; z-index: 1; }
.btn-hero-xl {
  padding: 18px 36px; font-size: 18px; border-radius: 14px;
  position: relative; overflow: hidden;
}
.btn-hero-xl::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 25%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0.2) 75%, transparent 100%);
  background-size: 200% 100%;
  animation: heroShimmer 3s ease-in-out infinite;
  animation-delay: 0.5s; pointer-events: none; border-radius: inherit;
}
.btn-hero-xl:hover::before { animation-duration: 1.5s; }
.btn-hero-xl i { font-size: 17px; position: relative; z-index: 1; }
.hero-split-actions .btn-primary { background: rgba(122,74,26,0.85); }
.hero-split-actions .btn-primary:hover { background: rgba(92,52,18,0.95); }
.hero-split-actions .btn-secondary { background: rgba(232,217,181,0.7); border-color: rgba(212,197,163,0.6); }
.hero-split-actions .btn-secondary:hover { background: rgba(216,192,138,0.85); }
.hero[style*="background-image"] .hero-actions .btn-primary { background: rgba(122,74,26,0.8); }
.hero[style*="background-image"] .hero-actions .btn-primary:hover { background: rgba(92,52,18,0.95); }
.hero[style*="background-image"] .hero-actions .btn-secondary { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); color: #fff; }
.hero[style*="background-image"] .hero-actions .btn-secondary:hover { background: rgba(255,255,255,0.25); }
.hero[style*="background-image"] .hero-split-actions .btn-primary { background: rgba(122,74,26,0.8); }
.hero[style*="background-image"] .hero-split-actions .btn-secondary { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); color: #fff; }
.hero[style*="background-image"] .hero-split-actions .btn-secondary:hover { background: rgba(255,255,255,0.25); }

.nav-social-links { display: flex; gap: 4px; align-items: center; margin: 0 4px; }
.social-link-sm { width: 28px; height: 28px; font-size: 13px; border-radius: 6px; }
.social-link-sm i { font-size: 13px; }

.topic-card-wrap { position: relative; }

.card-video-overlay {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border-top: none; overflow: hidden;
}
.card-video-close {
  display: flex; align-items: center; gap: 4px; justify-content: center;
  width: 100%; padding: 8px; background: var(--bg-card); border: none;
  border-bottom: 1px solid var(--border); cursor: pointer;
  font-family: var(--font-sans); font-size: 13px; color: var(--text-muted);
  font-weight: 500;
}
.card-video-close:hover { background: var(--accent-light); color: var(--primary); }
.card-video-container {
  position: relative; padding-bottom: 56.25%; height: 0;
}
.card-video-container iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.card-video-container-native { }
.card-video-container-native video { width: 100%; display: block; max-height: 250px; background: #000; }

.media-close-btn {
  position: absolute; top: 12px; left: 12px;
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25);
  color: var(--white); width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; transition: all .2s; z-index: 2;
}
.media-close-btn:hover { background: rgba(255,255,255,0.3); }
.media-close-light {
  position: static; background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.25); color: #fff;
}
.media-close-light:hover { background: rgba(255,255,255,0.3); }
.modern-audio-player { position: relative; }

.share-menu-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.share-menu {
  background: var(--white); border-radius: 16px;
  width: 100%; max-width: 320px; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  animation: shareMenuIn .2s ease;
}
@keyframes shareMenuIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.share-menu-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-family: var(--font-serif); font-weight: 700; font-size: 16px;
}
.share-menu-close {
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px; transition: all .2s;
}
.share-menu-close:hover { background: var(--accent-light); }
.share-menu-options { padding: 8px; }
.share-option {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 16px; border-radius: 10px;
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  color: var(--text); text-decoration: none;
  border: none; background: none; cursor: pointer; transition: all .15s;
}
.share-option:hover { background: var(--accent-light); }
.share-option i { font-size: 18px; width: 24px; text-align: center; }
.share-option .fa-whatsapp { color: #25D366; }
.share-option .fa-telegram { color: #0088cc; }
.share-option .fa-facebook { color: #1877F2; }
.share-option .fa-x-twitter { color: #000; }
.share-option .fa-copy { color: var(--primary); }

.toast-msg {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--primary-dark); color: var(--white);
  padding: 12px 24px; border-radius: 10px; font-size: 14px;
  font-family: var(--font-sans); font-weight: 500;
  z-index: 10000; opacity: 0; transition: all .3s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }

html.dark .share-menu { background: var(--bg-card); }
html.dark .share-option .fa-x-twitter { color: #fff; }
html.dark .card-video-overlay { background: var(--bg-card); border-color: var(--border); }
html.dark .card-video-close { background: var(--bg); }
html.dark .hero-overlay { background: rgba(0,0,0,0.6); }
