/*
Theme Name: Masail World
Theme URI: https://masailworld.com
Author: Masail World Team
Author URI: https://masailworld.com
Description: A premium, modern English-UI WordPress theme for Masail World (Darul Ifta Ahl-e-Sunnat). Built with Tailwind CSS, Google Fonts (Outfit & Inter), Glassmorphic Cards, Fatawa, Articles, Books, and custom Navy Dome & Gold Color Theme with official local logo.
Version: 2.8.0
Text Domain: masailworld
Domain Path: /languages
*/

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&family=Outfit:wght@400;500;600;700;800&display=swap');

@font-face {
  font-family: 'NaatFont';
  src: url('https://res.cloudinary.com/awescreative/raw/upload/v1749150996/Awes/naatfont.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Crisp White UI Backgrounds */
  --background-white: #FFFFFF;
  --background-ivory: #F8FAFC;
  --background-warm: #F1F5F9;

  /* Midnight Navy & Slate */
  --navy-dark: #0F172A;
  --navy-primary: #1E3A8A;
  --navy-highlight: #475569;

  /* Metallic Gold — Dark to Light */
  --gold-dark: #92400E;
  --gold-deep: #B45309;
  --gold-medium: #D97706;
  --gold-primary: #C5A059;
  --gold-light: #F59E0B;
  --gold-pale: #FEF3C7;

  /* Subtle Crisp Slate Grid / Border Lines */
  --grid-line: #E2E8F0;
  --grid-line-soft: rgba(226, 232, 240, 0.8);

  /* Fonts (English: Plus Jakarta Sans & Outfit, Urdu: NaatFont) */
  --font-heading: 'Outfit', 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-urdu: 'NaatFont', serif;
}

html, body {
  scroll-behavior: smooth;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

#wpadminbar {
  display: none !important;
}

/* Global Website Smooth Transitions */
a, button, input, select, textarea, .card, .topic-item, .nav-link, .circular-logo {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: var(--font-body);
  font-size: 100%;
  line-height: 1.65;
  background-color: var(--background-ivory);
  color: var(--navy-dark);
  padding-bottom: 0;
  padding-top: 0 !important;
  margin-top: 0 !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 767px) {
  html, body {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
  body {
    padding-bottom: 84px !important;
  }
  #mw-header {
    top: 0 !important;
  }
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
}

.font-urdu {
  font-family: var(--font-urdu), serif;
  letter-spacing: normal !important;
}

/* Glassmorphism & Card styling */
.glass-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--grid-line);
}

/* Hero Ken Burns Zoom-Pan & Soft Swap Background Animation */
.hero-section {
  position: relative;
  background-color: var(--navy-dark);
  overflow: hidden;
}

.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  animation: heroKenBurnsSwap 18s infinite ease-in-out;
  will-change: transform, opacity;
}

.hero-slide.slide-1 {
  animation-delay: 0s;
}

.hero-slide.slide-2 {
  animation-delay: 6s;
}

.hero-slide.slide-3 {
  animation-delay: 12s;
}

@keyframes heroKenBurnsSwap {
  0% {
    opacity: 0;
    transform: scale(1) translate(0%, 0%);
  }
  5% {
    opacity: 1;
  }
  33% {
    opacity: 1;
  }
  38% {
    opacity: 0;
    transform: scale(1.15) translate(-1.5%, -1%);
  }
  100% {
    opacity: 0;
    transform: scale(1.18) translate(-2%, -1.5%);
  }
}

.circular-logo {
  border-radius: 50%;
  object-fit: cover;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background-color: var(--gold-deep);
  border-radius: 4px;
}
::-webkit-scrollbar-track {
  background: var(--background-warm);
}

/* Tag dropdown combobox styles */
.tag-combobox { position: relative; min-width: 240px; }
.tag-button { width: 100%; text-align: left; }
.tag-panel { position: absolute; top: 100%; left: 0; z-index: 50; background: var(--background-white); border: 1px solid var(--gold-pale); border-radius: 12px; margin-top: 8px; width: min(360px, 90vw); box-shadow: 0 12px 28px rgba(12, 35, 64, 0.15); }
.tag-panel .inner { max-height: 320px; overflow-y: auto; }
.tag-search { border: 0; border-bottom: 1px solid var(--grid-line-soft); padding: 10px 12px; width: 100%; outline: none; background: var(--background-white); }
.tag-option { padding: 10px 12px; cursor: pointer; text-align: left; }
.tag-option:hover { background: var(--background-warm); }
.tag-option[aria-selected="true"] { background: var(--gold-pale); font-weight: bold; color: var(--navy-dark); }

/* Pagination buttons */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center; }
.page-btn { border: 1px solid var(--gold-pale); background: var(--background-white); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; color: var(--navy-primary); }
.page-btn.active { background: var(--navy-primary); color: var(--gold-light); font-weight: bold; border-color: var(--navy-dark); }
.page-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Custom Toast Notifications */
.mw-toast {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background-color: var(--navy-dark);
  color: var(--gold-light);
  border: 1px solid var(--gold-primary);
  padding: 12px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(12, 35, 64, 0.3);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Line Clamp utility */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hero Latest Fatwa Ticker Loop Slider Animation (Mobile & Desktop) */
@keyframes mwTickerMarquee {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-50%); }
}
.mw-ticker-track {
  display: flex;
  width: max-content;
  animation: mwTickerMarquee 35s linear infinite;
  will-change: transform;
}
.mw-ticker-track:hover {
  animation-play-state: paused;
}

/* Website-Wide Subtle Fade-In */
@keyframes mwFadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.mw-animate-fade {
  animation: mwFadeInUp 0.6s ease-out forwards;
}

/* Fatawa Single Page Non-Editable Read-Only Enforcement */
[contenteditable],
#fatwa-container,
#fatwa-question,
#fatwa-answer {
  -webkit-user-modify: read-only !important;
  outline: none !important;
}
[contenteditable="true"] {
  outline: none !important;
}

/* ==========================================================================
   AI Fatwa Chatbot ChatGPT Minimalist & Premium UI Custom Styles
   ========================================================================== */

#mw-ai-chat-drawer {
  box-shadow: 0 20px 50px rgba(12, 35, 64, 0.5), 0 0 30px rgba(200, 170, 112, 0.2);
}

/* Chat Messages Custom Scrollbar */
#mw-chat-messages::-webkit-scrollbar {
  width: 5px;
}
#mw-chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(200, 170, 112, 0.4);
  border-radius: 10px;
}
#mw-chat-messages::-webkit-scrollbar-thumb:hover {
  background-color: rgba(200, 170, 112, 0.8);
}
#mw-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

/* Suggestion Chips Hover */
.mw-chip {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.mw-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 170, 112, 0.25);
}

/* Chat Action Button */
.mw-chat-btn-primary {
  transition: all 0.2s ease-in-out;
}
.mw-chat-btn-primary:hover {
  transform: translateX(-2px);
  box-shadow: 0 4px 14px rgba(12, 35, 64, 0.3);
}

/* Pulse Glow for AI Floating Button */
@keyframes mwGlowPulse {
  0%, 100% {
    box-shadow: 0 0 15px rgba(200, 170, 112, 0.4), 0 8px 25px rgba(12, 35, 64, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(226, 198, 129, 0.8), 0 12px 35px rgba(12, 35, 64, 0.7);
  }
}
/* Full-Screen AI App Specific Styles */
body.page-template-page-ask #loader {
  display: none !important;
}

#mw-app-sidebar::-webkit-scrollbar {
  width: 4px;
}
#mw-app-sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(200, 170, 112, 0.3);
  border-radius: 10px;
}

/* Pro Fatwa Reader Font Scaling & Premium Typography */
.fatwa-font-sm { font-size: 1.25rem !important; line-height: 2.0 !important; }
.fatwa-font-md { font-size: 1.45rem !important; line-height: 2.2 !important; }
.fatwa-font-lg { font-size: 1.65rem !important; line-height: 2.4 !important; }
.fatwa-font-xl { font-size: 1.95rem !important; line-height: 2.6 !important; }

#fatwa-question, #fatwa-answer {
  font-size: 1.45rem;
  line-height: 2.2;
}
@media (min-width: 768px) {
  #fatwa-question, #fatwa-answer {
    font-size: 1.65rem;
    line-height: 2.4;
  }
}

/* Modal Backdrop Blur & Animations */
.mw-modal-backdrop {
  background: rgba(12, 35, 64, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.3s ease-in-out;
}
.mw-modal-box {
  box-shadow: 0 25px 60px rgba(12, 35, 64, 0.4), 0 0 35px rgba(200, 170, 112, 0.25);
  border: 1px solid rgba(200, 170, 112, 0.4);
}

/* Verified Badge & Crest Borders */
.mw-gold-border-card {
  border: 1px solid var(--grid-line);
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
}

/* ==========================================================================
   COMPREHENSIVE PRINT STYLESHEET — A4 Portrait, RTL Urdu Fatwa Layout
   Only the #fatwa-pdf-template is shown; all website chrome is hidden.
   ========================================================================== */
@media print {

  /* A4 Page Setup with generous, balanced margins */
  @page {
    size: A4 portrait;
    margin: 12mm 10mm 15mm 10mm;
  }

  /* ---- Hide Everything on Screen ---- */
  *,
  *::before,
  *::after {
    visibility: hidden !important;
  }

  /* ---- Show Only the Print Template ---- */
  #fatwa-pdf-template,
  #fatwa-pdf-template *,
  #fatwa-pdf-template .mw-print-page,
  #fatwa-pdf-template .mw-print-page * {
    visibility: visible !important;
  }

  /* ---- Template Positioning for Print ---- */
  #fatwa-pdf-template {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 999999 !important;
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  #fatwa-pdf-template .mw-print-page {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    direction: rtl !important;
    color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* ---- RTL / Urdu Typography for Print ---- */
  #fatwa-pdf-template h1,
  #fatwa-pdf-template h2,
  #fatwa-pdf-template p,
  #fatwa-pdf-template div {
    direction: rtl !important;
    text-align: right !important;
  }

  /* ---- Page Breaks ---- */
  #fatwa-pdf-template h1,
  #fatwa-pdf-template h2 {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  #fatwa-pdf-template p,
  #fatwa-pdf-template div {
    orphans: 3 !important;
    widows: 3 !important;
  }

  /* ---- Ensure gradient colors render in print ---- */
  #fatwa-pdf-template [style*="background"] {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* ---- Hide website UI elements ---- */
  header,
  footer,
  nav,
  #mw-header,
  #mw-footer,
  #mw-ai-chat-drawer,
  #mw-ai-fab,
  .mw-toast,
  #wpadminbar,
  #mw-share-modal,
  #mw-pdf-modal,
  #mw-export-print-modal,
  #loader,
  main,
  body > *:not(#fatwa-pdf-template) {
    display: none !important;
    visibility: hidden !important;
  }
}







/* ==========================================================================
   PDF Export Specific Styles (from fatwa export.html)
   When the .exporting-pdf class is applied to the container via JS,
   it hides unnecessary UI elements to ensure a clean PDF output.
   ========================================================================== */
.exporting-pdf .pdf-hide {
    display: none !important;
}

.exporting-pdf {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 2.5rem !important;
    background: #ffffff !important;
    max-width: none !important;
    width: 100% !important;
}

.exporting-pdf .pdf-clean-border {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin-bottom: 1rem !important;
}

.exporting-pdf .pdf-adjust-mt {
    margin-top: 0 !important;
}

/* --- Premium PDF Additions --- */

/* Elements only visible in PDF */
.pdf-only {
    display: none !important;
}

.exporting-pdf .pdf-only {
    display: block !important;
}

.exporting-pdf .pdf-only-flex {
    display: flex !important;
}

/* Prevent awkward page breaks in the middle of content */
.pdf-avoid-break {
    break-inside: avoid;
    page-break-inside: avoid;
}

/* Official Watermark */
.pdf-watermark {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
    font-size: 8rem;
    color: rgba(217, 119, 6, 0.04); /* Very faint gold */
    z-index: 0;
    pointer-events: none;
    white-space: nowrap;
    user-select: none;
}

.exporting-pdf .pdf-watermark {
    display: block;
}

/* Ensure content stays above watermark */
.exporting-pdf .relative-content {
    position: relative;
    z-index: 10;
}

/* Force readable, fixed font sizes for PDF output overriding inline styles */
.exporting-pdf .mw-fatwa-reader-text {
    font-size: 18px !important;
    line-height: 2.2 !important;
}

.exporting-pdf .mw-pdf-header-scale {
    font-size: 1.25rem !important; /* Adjust headers slightly for PDF */
}
