/* استيراد خطوط أديب */
@font-face {
  font-family: fl;
  src: url(../fonts/COMM\ -\ Lyon\ Arabic\ Display\ Light.otf);
}

@font-face {
  font-family: fr;
  src: url(../fonts/COMM\ -\ Lyon\ Arabic\ Display\ Regular.otf);
}

@font-face {
  font-family: b;
  src: url(../fonts/COMM\ -\ Lyon\ Arabic\ Display\ Bold.otf);
}

@font-face {
  font-family: eras;
  src: url(../fonts/ERASDEMI.TTF);
}

@font-face {
  font-family: eras-s;
  src: url(../fonts/ERASLGHT.TTF);
}

* {
  margin: 0;
  padding: 0;
  font-family: b;
}

:root {
  --main-blue: #274060;
  --accent-blue: #3d8fd6;
  --light-blue: #6ba8e2;
  --dark-blue: #1a2a3a;
}

body {
  min-height: 100vh;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
}

/* منع التمرير أثناء التحميل */
body.loading {
  overflow: hidden;
}

/* تأثير الخلفية المتحركة */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(61, 143, 214, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(107, 168, 226, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* حاوية الكتيب وأزرار التنقل */
.flipbook-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  margin-top: 10rem;
}

.shadow {
  z-index: -1;
  position: absolute;
  content: "";
  right: 0;
  width: 50%;
  height: 100%;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
}

#flipbook {
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}

.hard {
  color: white;
  font-weight: bolder;
  background-color: white;
}
.hard.p2 {
  background: linear-gradient(to right, white 0%, white 55%, #ebebeb 100%);
}
.hard.p7 {
  background: linear-gradient(to left, white 0%, white 55%, #ebebeb 100%);
}

.page {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pages {
  position: relative;
  background-color: white;
}
.pages.even {
  background: linear-gradient(to right, white 0%, white 55%, #ebebeb 100%);
}
.pages.even::after {
  content: "";
  position: absolute;
  cursor: pointer;
  width: 60px;
  top: 0;
  left: 0;
  height: 60px;
}
.pages.even::before {
  content: "";
  position: absolute;
  cursor: pointer;
  width: 60px;
  bottom: 0;
  left: 0;
  height: 60px;
}
.pages.odd {
  background: linear-gradient(to left, white 0%, white 55%, #ebebeb 100%);
}
.pages.odd::after {
  content: "";
  position: absolute;
  cursor: pointer;
  width: 60px;
  top: 0;
  right: 0;
  height: 60px;
}
.pages.odd::before {
  content: "";
  position: absolute;
  cursor: pointer;
  width: 60px;
  bottom: 0;
  right: 0;
  height: 60px;
}

/* تنسيق الصور داخل الصفحات */
.pages img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* تنسيق الغلاف الأمامي */
.cover-front {
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cover-front img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* تنسيق الغلاف الخلفي */
.cover-back {
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cover-back img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* زر التحكم بالصوت */
.sound-toggle-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--light-blue) 100%);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(61, 143, 214, 0.3);
  transition: all 0.3s ease;
}

.sound-toggle-btn:hover:not(.muted) {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(61, 143, 214, 0.6);
  background: linear-gradient(135deg, var(--light-blue) 0%, var(--accent-blue) 100%);
}

.sound-toggle-btn.muted {
  background: linear-gradient(135deg, #999 0%, #666 100%);
  opacity: 0.7;
}

.sound-toggle-btn.muted:hover {
  background: linear-gradient(135deg, #666 0%, #999 100%);
  opacity: 0.9;
}

.sound-toggle-btn i {
  transition: all 0.3s ease;
}

/* زر ملء الشاشة */
.fullscreen-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--light-blue) 100%);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(61, 143, 214, 0.3);
  transition: all 0.3s ease;
}

.fullscreen-btn:hover:not(.active) {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(61, 143, 214, 0.6);
  background: linear-gradient(135deg, var(--light-blue) 0%, var(--accent-blue) 100%);
}

.fullscreen-btn i {
  transition: all 0.3s ease;
}

.fullscreen-btn.active {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  box-shadow: 0 4px 20px rgba(243, 156, 18, 0.4);
}

.fullscreen-btn.active:hover {
  background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
  box-shadow: 0 8px 30px rgba(243, 156, 18, 0.6);
}

/* شاشة التحميل */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--main-blue) 0%, var(--dark-blue) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin-bottom: 30px;
  animation: pulse 2s ease-in-out infinite;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}

.loading-content p {
  font-family: fr;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

/* شريط العنوان */
.header-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(39, 64, 96, 0.98) 0%, rgba(26, 42, 58, 0.98) 100%);
  backdrop-filter: blur(25px);
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 999;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--accent-blue), transparent) 1;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

/* زر الرئيسية في الهيدر */
.header-home-btn {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--light-blue) 100%);
  color: white;
  padding: 14px 28px;
  border-radius: 50px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: bold;
  font-family: fb;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(61, 143, 214, 0.5);
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.header-home-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.header-home-btn:hover::before {
  width: 300px;
  height: 300px;
}

.header-home-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 35px rgba(61, 143, 214, 0.7);
  border-color: rgba(255, 255, 255, 0.5);
}

.header-home-btn:active {
  transform: translateY(-1px) scale(1.02);
}

.header-home-btn i {
  font-size: 20px;
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

.header-home-btn:hover i {
  transform: scale(1.2);
}

.header-home-btn span {
  position: relative;
  z-index: 1;
  letter-spacing: 0.5px;
}

.header-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(61, 143, 214, 0.05) 20%, 
    rgba(107, 168, 226, 0.05) 50%, 
    rgba(61, 143, 214, 0.05) 80%, 
    transparent 100%);
  pointer-events: none;
  z-index: -1;
}

@keyframes logoGlow {
  0%, 100% {
    filter: drop-shadow(0 4px 12px rgba(61, 143, 214, 0.4));
  }
  50% {
    filter: drop-shadow(0 4px 20px rgba(107, 168, 226, 0.6));
  }
}

.header-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.header-text h1 {
  font-family: b;
  color: white;
  font-size: 28px;
  margin: 0;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 0%, #e0f2ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* زر قائمة الصفحات */
.pages-menu-btn {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--light-blue) 100%);
  color: white;
  padding: 14px 28px;
  border-radius: 50px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: bold;
  font-family: fb;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(61, 143, 214, 0.5);
  position: relative;
  overflow: hidden;
}

.pages-menu-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.pages-menu-btn:hover::before {
  width: 300px;
  height: 300px;
}

.pages-menu-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 35px rgba(61, 143, 214, 0.7);
  border-color: rgba(255, 255, 255, 0.5);
}

.pages-menu-btn:active {
  transform: translateY(-1px) scale(1.02);
}

.pages-menu-btn i {
  font-size: 20px;
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

.pages-menu-btn:hover i {
  transform: rotate(180deg);
}

.pages-menu-btn span {
  position: relative;
  z-index: 1;
  letter-spacing: 0.5px;
}

/* القائمة الجانبية */
.pages-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  height: 100vh;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 250, 255, 0.98) 100%);
  backdrop-filter: blur(20px);
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
  border-left: 3px solid var(--accent-blue);
  scrollbar-width: thin;
  scrollbar-color: var(--accent-blue) rgba(61, 143, 214, 0.1);
}

.pages-sidebar::-webkit-scrollbar {
  width: 8px;
}

.pages-sidebar::-webkit-scrollbar-track {
  background: rgba(61, 143, 214, 0.1);
  border-radius: 10px;
}

.pages-sidebar::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 10px;
}

.pages-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--light-blue);
}

.pages-sidebar.active {
  right: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--light-blue) 100%);
  border-bottom: 3px solid rgba(255, 255, 255, 0.3);
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-header h2 {
  color: white;
  font-size: 24px;
  font-family: fr;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.close-sidebar-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s ease;
}

.close-sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.pages-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

.page-item {
  background: white;
  border: 3px solid rgba(61, 143, 214, 0.2);
  border-radius: 15px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.page-item:hover {
  transform: translateX(-5px);
  border-color: var(--accent-blue);
  box-shadow: 0 4px 20px rgba(61, 143, 214, 0.3);
  background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(240, 248, 255, 1) 100%);
}

.page-item.active {
  border-color: var(--accent-blue);
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--light-blue) 100%);
  box-shadow: 0 4px 20px rgba(61, 143, 214, 0.5);
}

.page-item.active .page-number,
.page-item.active .page-label {
  color: white;
}

.page-thumbnail {
  width: 80px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(61, 143, 214, 0.3);
  flex-shrink: 0;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.page-item.active .page-thumbnail {
  border-color: white;
}

.page-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.page-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.page-number {
  font-size: 20px;
  font-weight: bold;
  color: var(--accent-blue);
  font-family: eras;
}

.page-label {
  font-size: 14px;
  color: var(--main-blue);
  font-family: fr;
}

/* الطبقة الشفافة */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* أزرار التنقل */
.navigation-controls {
  position: relative;
  margin-top: 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 1000;
  background: linear-gradient(135deg, var(--main-blue) 0%, var(--dark-blue) 100%);
  padding: 15px 30px;
  border-radius: 60px;
  box-shadow: 0 8px 30px rgba(39, 64, 96, 0.5), 0 0 60px rgba(61, 143, 214, 0.3);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(107, 168, 226, 0.4);
}

.nav-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--light-blue) 100%);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(61, 143, 214, 0.3);
  transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(61, 143, 214, 0.6);
  background: linear-gradient(135deg, var(--light-blue) 0%, var(--accent-blue) 100%);
}

.nav-btn:active {
  transform: scale(0.95);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: linear-gradient(135deg, #ccc 0%, #999 100%);
}

/* عداد الصفحات في شريط التنقل */
.nav-page-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  font-family: eras;
  color: white;
  font-weight: bold;
  min-width: 80px;
  justify-content: center;
  position: relative;
}

.nav-page-counter::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 30px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.nav-page-counter::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 30px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.nav-page-counter .current {
  color: #ffffff;
  font-size: 24px;
  font-family: eras;
  transition: all 0.3s ease;
  text-shadow: 0 2px 8px rgba(107, 168, 226, 0.6);
  font-weight: bold;
}

.nav-page-counter .separator {
  color: rgba(255, 255, 255, 0.5);
  font-size: 18px;
  font-family: eras;
}

.nav-page-counter .total {
  color: rgba(255, 255, 255, 0.8);
  font-size: 20px;
  font-family: eras;
}

/* تعليمات الاستخدام - مخفية الآن */
.instructions {
  display: none;
}

/* زر تحميل PDF */
.download-pdf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 30px auto 0;
  padding: 16px 40px;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--light-blue) 100%);
  color: white;
  text-decoration: none;
  border-radius: 50px;
  font-family: fr;
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 8px 25px rgba(39, 64, 96, 0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  max-width: 300px;
}

.download-pdf-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.download-pdf-btn:hover::before {
  left: 100%;
}

.download-pdf-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(39, 64, 96, 0.4);
}

.download-pdf-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(39, 64, 96, 0.3);
}

.download-pdf-btn i {
  font-size: 20px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.download-pdf-btn span {
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

/* حالة "تم التحميل" */
.download-pdf-btn.downloaded {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
  transform: scale(1.05);
}

.download-pdf-btn.downloaded:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 12px 35px rgba(16, 185, 129, 0.5);
}

.download-pdf-btn.downloaded i {
  animation: checkPulse 0.6s ease;
}

.download-pdf-btn.downloaded span {
  animation: fadeInText 0.4s ease;
}

@keyframes checkPulse {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeInText {
  0% {
    opacity: 0;
    transform: translateY(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}


/* وضع ملء الشاشة */
body.fullscreen-mode {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

body.fullscreen-mode .header-bar,
body.fullscreen-mode .footer,
body.fullscreen-mode .download-pdf-btn,
body.fullscreen-mode .pages-sidebar {
  display: none !important;
}

body.fullscreen-mode .flipbook-container {
  margin-top: 0;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height للجوال */
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  background: var(--dark-blue);
}

body.fullscreen-mode #flipbook {
  max-height: 95vh;
  max-height: 95dvh; /* Dynamic viewport height للجوال */
  max-width: 95vw;
}

body.fullscreen-mode .navigation-controls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  background: rgba(39, 64, 96, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 50px;
  padding: 12px 20px;
}

/* تحسينات للجوال في وضع ملء الشاشة */
@media (max-width: 768px) {
  body.fullscreen-mode .navigation-controls {
    bottom: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 10px 15px;
  }
  
  body.fullscreen-mode #flipbook {
    max-height: 90vh;
    max-height: 90dvh;
  }
}

/* دعم iPhone notch و safe areas */
@supports (padding: max(0px)) {
  body.fullscreen-mode .flipbook-container {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  body.fullscreen-mode .navigation-controls {
    margin-bottom: env(safe-area-inset-bottom);
  }
}

/* الفوتر */
.footer {
  width: 100%;
  background: linear-gradient(135deg, var(--main-blue) 0%, var(--dark-blue) 100%);
  color: white;
  position: relative;
  z-index: 10;
  margin-top: 3rem;
  box-shadow: 0 -5px 30px rgba(39, 64, 96, 0.3);
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--accent-blue) 25%, 
    var(--light-blue) 50%, 
    var(--accent-blue) 75%, 
    transparent 100%);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 50px 40px 30px;
}

.footer-main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  margin-bottom: 30px;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.footer-section:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(107, 168, 226, 0.3);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.footer-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--accent-blue), var(--light-blue));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  box-shadow: 0 4px 15px rgba(61, 143, 214, 0.3);
  margin-bottom: 5px;
}

.footer-section h4 {
  font-family: b;
  font-size: 20px;
  color: white;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.footer-date {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: fr;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

.footer-date i {
  color: var(--light-blue);
  font-size: 16px;
}

.footer-date span {
  font-family: eras;
  color: white;
}

.footer-date strong {
  font-family: b;
  color: white;
}

.team-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: fr;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.team-item:hover {
  background: rgba(255, 255, 255, 0.1);
  padding-right: 15px;
}

.team-item i {
  color: var(--light-blue);
  font-size: 18px;
}

.team-item span {
  font-family: fr;
  color: white;
}

.footer-bottom {
  text-align: center;
}

.footer-divider {
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.3) 50%, 
    transparent 100%);
  margin-bottom: 20px;
}

.footer-copyright {
  font-family: fr;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  text-align: center;
}

.footer-copyright .year {
  font-family: eras-s;
  color: rgba(255, 255, 255, 0.8);
}

/* تصميم متجاوب */
@media (max-width: 768px) {
  
  .sound-toggle-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
  
  .fullscreen-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
  
  .download-pdf-btn {
    padding: 14px 30px;
    font-size: 16px;
    max-width: 280px;
  }
  
  .download-pdf-btn i {
    font-size: 18px;
  }
  
  .header-bar {
    padding: 15px 20px;
  }
  
  .header-text h1 {
    font-size: 22px;
  }
  
  .pages-menu-btn {
    padding: 10px 18px;
    font-size: 14px;
  }
  
  .header-home-btn {
    padding: 10px 18px;
    font-size: 14px;
  }
  
  .pages-sidebar {
    width: 320px;
    right: -320px;
  }
  
  .page-thumbnail {
    width: 60px;
    height: 80px;
  }
  
  .page-number {
    font-size: 18px;
  }
  
  .page-label {
    font-size: 12px;
  }
  
  .nav-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
  
  .navigation-controls {
    padding: 12px 20px;
    gap: 15px;
    margin-top: 20px;
  }
  
  .nav-page-counter {
    padding: 0 10px;
    min-width: 60px;
  }
  
  .nav-page-counter .current {
    font-size: 20px;
  }
  
  .nav-page-counter .separator {
    font-size: 16px;
  }
  
  .nav-page-counter .total {
    font-size: 18px;
  }
  
  .footer-content {
    padding: 40px 25px 25px;
  }
  
  .footer-main {
    grid-template-columns: 1fr;
    gap: 25px;
  }
  
  .footer-section {
    padding: 18px;
  }
  
  .footer-section h4 {
    font-size: 18px;
  }
  
  .footer-icon {
    width: 45px;
    height: 45px;
    font-size: 22px;
  }
  
  .footer-date,
  .team-item {
    font-size: 14px;
  }
  
  .footer-copyright {
    font-size: 13px;
  }
}

@media (max-width: 500px) {
  
  /* إخفاء النصوص والاكتفاء بالأيقونات */
  .pages-menu-btn span,
  .header-home-btn span {
    display: none;
  }
  
  .pages-menu-btn,
  .header-home-btn {
    padding: 10px 14px;
    min-width: auto;
  }
  
  .pages-menu-btn i,
  .header-home-btn i {
    margin: 0;
  }
}

@media (max-width: 480px) {
  
  .sound-toggle-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .fullscreen-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .download-pdf-btn {
    padding: 12px 24px;
    font-size: 14px;
    max-width: 250px;
    gap: 8px;
  }
  
  .download-pdf-btn i {
    font-size: 16px;
  }
  
  .download-pdf-btn span {
    font-size: 14px;
  }
  
  .header-bar {
    padding: 12px 15px;
  }
  
  .header-text h1 {
    font-size: 18px;
  }
  
  .pages-menu-btn {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .pages-menu-btn i {
    font-size: 18px;
  }
  
  .header-home-btn {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  .header-home-btn i {
    font-size: 18px;
  }
  
  .pages-sidebar {
    width: 90%;
    right: -90%;
  }
  
  .sidebar-header {
    padding: 20px;
  }
  
  .sidebar-header h2 {
    font-size: 20px;
  }
  
  .pages-grid {
    padding: 15px;
    gap: 12px;
  }
  
  .page-item {
    padding: 12px;
    gap: 12px;
  }
  
  .page-thumbnail {
    width: 50px;
    height: 70px;
  }
  
  .page-number {
    font-size: 16px;
  }
  
  .page-label {
    font-size: 11px;
  }
  
  .nav-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .navigation-controls {
    padding: 10px 15px;
    gap: 12px;
    margin-top: 15px;
  }
  
  .nav-page-counter {
    padding: 0 8px;
    min-width: 50px;
  }
  
  .nav-page-counter .current {
    font-size: 18px;
  }
  
  .nav-page-counter .separator {
    font-size: 14px;
  }
  
  .nav-page-counter .total {
    font-size: 16px;
  }
  
  .footer-content {
    padding: 35px 20px 20px;
  }
  
  .footer-main {
    gap: 20px;
  }
  
  .footer-section {
    padding: 15px;
  }
  
  .footer-section h4 {
    font-size: 17px;
  }
  
  .footer-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .footer-date,
  .team-item {
    font-size: 13px;
  }
  
  .footer-copyright {
    font-size: 12px;
  }
}