/* === LOCAL GOOGLE FONTS LIGATURES === */
/* arabic */
@font-face {
  font-family: 'Amiri';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/amiri_subset_1.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* latin-ext */
@font-face {
  font-family: 'Amiri';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/amiri_subset_2.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Amiri';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/amiri_subset_3.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Amiri';
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/amiri_subset_4.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* latin-ext */
@font-face {
  font-family: 'Amiri';
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/amiri_subset_5.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Amiri';
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/amiri_subset_6.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/amiri_subset_7.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* latin-ext */
@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/amiri_subset_8.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/amiri_subset_9.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/amiri_subset_10.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* latin-ext */
@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/amiri_subset_11.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Amiri';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/amiri_subset_12.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(fonts/cairo_subset_13.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* latin-ext */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(fonts/cairo_subset_14.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(fonts/cairo_subset_15.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/cairo_subset_13.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* latin-ext */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/cairo_subset_14.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/cairo_subset_15.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/cairo_subset_13.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* latin-ext */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/cairo_subset_14.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/cairo_subset_15.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/cairo_subset_13.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* latin-ext */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/cairo_subset_14.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/cairo_subset_15.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(fonts/cairo_subset_13.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* latin-ext */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(fonts/cairo_subset_14.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url(fonts/cairo_subset_15.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(fonts/inter_subset_28.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(fonts/inter_subset_29.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(fonts/inter_subset_30.woff2) format('woff2');
  unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(fonts/inter_subset_31.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(fonts/inter_subset_32.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(fonts/inter_subset_33.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(fonts/inter_subset_34.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter_subset_28.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter_subset_29.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter_subset_30.woff2) format('woff2');
  unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter_subset_31.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter_subset_32.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter_subset_33.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/inter_subset_34.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/inter_subset_28.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/inter_subset_29.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/inter_subset_30.woff2) format('woff2');
  unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/inter_subset_31.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/inter_subset_32.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/inter_subset_33.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/inter_subset_34.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/inter_subset_28.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/inter_subset_29.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/inter_subset_30.woff2) format('woff2');
  unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/inter_subset_31.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/inter_subset_32.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/inter_subset_33.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/inter_subset_34.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/inter_subset_28.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/inter_subset_29.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/inter_subset_30.woff2) format('woff2');
  unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/inter_subset_31.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/inter_subset_32.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/inter_subset_33.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/inter_subset_34.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* === LOCAL GOOGLE FONTS LIGATURES === */
/* Custom Fonts - ABO-THAR Symbol Font */
/* Merged @font-face rules with both WOFF2 and TTF formats supporting both ASCII and PUA ranges */
@font-face {
    font-family: 'Abo-Thar';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'Abo-thar';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'Abo Thar';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'Abo thar';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'ABO-THAR';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'Abothar';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'Abo_Thar';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'Abo_thar';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'NewSymbolFont';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'New Symbol Font';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'Abo-Thar Regular';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'Abo-thar Regular';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'Abo Thar Regular';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}
@font-face {
    font-family: 'NewSymbolFont Regular';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}

/* Special Font for Brackets - uses ABO-THAR which has bracket glyphs at PUA codepoints */
@font-face {
    font-family: 'Abo-Thar-Brackets';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F082-F083;
    font-display: swap;
}

/* Special Font for Brackets ASCII - U+0052 (R) and U+0053 (S) */
@font-face {
    font-family: 'Abo-Thar-Brackets-ASCII';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+0052-0053;
    font-display: swap;
}

/* Custom font face for textarea to exclude U+0030 (digit 0) from symbol mapping */
@font-face {
    font-family: 'Abo-Thar-Textarea';
    src: url('fonts/ABO-THAR.woff2?v=213') format('woff2'),
         url('fonts/ABO-THAR.TTF?v=213') format('truetype');
    unicode-range: U+F020-F0FF;
    font-display: swap;
}

/* ==========================================================================
   RADICAL FIX FOR QURANIC BRACKETS INVERSION
   Forces the standard Amiri font specifically for standard Quranic brackets (U+FD3E, U+FD3F)
   even if Abu Dhikr font is applied. This prevents the RTL mirroring bug.
   ========================================================================== */
@font-face { font-family: 'Abo-Thar'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abo-thar'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abo Thar'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abo thar'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'ABO-THAR'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abothar'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abo_Thar'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abo_thar'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abo-Thar Regular'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abo-thar Regular'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abo Thar Regular'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abo-Thar-Brackets-ASCII'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'NewSymbolFont'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'New Symbol Font'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'NewSymbolFont Regular'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }
@font-face { font-family: 'Abo-Thar-Textarea'; src: url('fonts/amiri_subset_1.woff2') format('woff2'); unicode-range: U+FD3E, U+FD3F; font-display: swap; }

/* Custom Properties & Themes */
:root {
    /* Dark Theme (Default) - Midnight Obsidian */
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-card: #1e1e1e;
    --border-color: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #71717a;
    
    --accent-purple: #319795; /* Emerald Teal Accent */
    --accent-cyan: #2c7a7b;
    --accent-pink: #4fd1c5;
    --accent-gradient: #319795;
    --accent-hover-gradient: #2c7a7b;
    --accent-rgb: 49, 151, 149;
    --quran-color: #81c784;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    
    --card-blur: blur(16px);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-sans: 'Cairo', sans-serif;
    
    /* Reader specific variables */
    --reader-bg: #1e1e1e;
    --reader-text: #e0e0e0;
 
    --bg-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='none' stroke='rgba%2879, 209, 197, 0.04%29' stroke-width='1'/%3E%3Ccircle cx='20' cy='20' r='1.5' fill='rgba%2879, 209, 197, 0.12%29'/%3E%3C/svg%3E");
    --bg-pattern-footer: none;
}

/* Explicit Dark Theme class */
body.dark-theme {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-card: #1e1e1e;
    --border-color: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #71717a;
    
    --accent-purple: #319795;
    --accent-cyan: #2c7a7b;
    --accent-pink: #4fd1c5;
    --accent-gradient: #319795;
    --accent-hover-gradient: #2c7a7b;
    --accent-rgb: 49, 151, 149;
    --quran-color: #81c784;
    
    --reader-bg: #1e1e1e;
    --reader-text: #e0e0e0;

    --bg-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='none' stroke='rgba%2879, 209, 197, 0.04%29' stroke-width='1'/%3E%3Ccircle cx='20' cy='20' r='1.5' fill='rgba%2879, 209, 197, 0.12%29'/%3E%3C/svg%3E");
}

/* Light Theme overrides - Pure Modern Slate & Teal (Matching Preview Image 1) */
body.light-theme {
    --bg-primary: #f0f2f5; /* Cold Slate Light Background */
    --bg-secondary: #ffffff; /* Crisp Pure White Cards & Navigation */
    --bg-card: #ffffff;
    --border-color: #e2e8f0; /* Soft Crisp Border */
    --text-primary: #2c3e50; /* Elegant Dark Slate Blue Text */
    --text-secondary: #4a5568;
    --text-muted: #94a3b8;
    
    --accent-purple: #319795; /* Emerald Teal Accent for buttons */
    --accent-cyan: #2c7a7b;
    --accent-pink: #4fd1c5;
    --accent-gradient: #319795;
    --accent-hover-gradient: #2c7a7b;
    --accent-rgb: 49, 151, 149;
    --quran-color: #2e7d32;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
    
    --reader-bg: #ffffff;
    --reader-text: #2c3e50;

    --bg-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='none' stroke='rgba%2849, 151, 149, 0.04%29' stroke-width='1'/%3E%3Ccircle cx='20' cy='20' r='1.5' fill='rgba%2849, 151, 149, 0.12%29'/%3E%3C/svg%3E");
    --bg-pattern-footer: none;
}

/* Sepia / Paper Theme overrides - Refined Warm Paper with High Contrast & Crisp White Touches */
body.sepia-theme {
    --bg-primary: #f8f4ea; /* Ultra Soft Parchment External Background */
    --bg-secondary: #ffffff; /* Crisp Warm White Cards, Navbar & Sidebar for contrast */
    --bg-card: #ffffff;
    --border-color: #e8dec7; /* Subtle Warm Golden Border */
    --text-primary: #4a3b2c; /* High Contrast Deep Warm Charcoal Text */
    --text-secondary: #6e5c4b;
    --text-muted: #968372;
    
    --accent-purple: #c59b27; /* Rich Amber Gold Accent Button */
    --accent-cyan: #a37c15;
    --accent-pink: #d3a029;
    --accent-gradient: #c59b27;
    --accent-hover-gradient: #a37c15;
    --accent-rgb: 197, 155, 39;
    --quran-color: #2b7a4b;
    
    --shadow-sm: 0 2px 8px rgba(74, 59, 44, 0.05);
    --shadow-md: 0 8px 30px rgba(74, 59, 44, 0.08);
    --shadow-lg: 0 12px 40px rgba(74, 59, 44, 0.12);
    
    --reader-bg: #fffefb; /* Extremely Bright & Soft Paper for Reading */
    --reader-text: #4a3b2c;

    --bg-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='none' stroke='rgba%28197, 155, 39, 0.04%29' stroke-width='1'/%3E%3Ccircle cx='20' cy='20' r='1.5' fill='rgba%28197, 155, 39, 0.12%29'/%3E%3C/svg%3E");
    --bg-pattern-footer: none;
}

/* Responsive Theme Selector Dropdown & Bottom Sheet */
.theme-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.theme-modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.theme-dropdown-menu {
    position: fixed;
    z-index: 9999;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    direction: rtl;
    width: 280px;
}

/* Desktop: Popover under header button */
@media (min-width: 768px) {
    .theme-dropdown-menu {
        top: 75px;
        left: 24px;
        transform: translateY(-10px) scale(0.95);
    }
    .theme-dropdown-menu.show {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }
    .theme-menu-close-btn {
        display: none;
    }
}

/* Mobile: Bottom Sheet slide up from bottom */
@media (max-width: 767px) {
    .theme-dropdown-menu {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 1.5rem;
        transform: translateY(100%);
        border-bottom: none;
    }
    .theme-dropdown-menu.show {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
}

.theme-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.85rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}
.theme-menu-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}
.theme-menu-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.theme-option-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: 1px solid transparent;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    width: 100%;
}
.theme-option-btn:hover {
    background: rgba(var(--accent-rgb), 0.08);
}
.theme-option-btn.active {
    background: rgba(var(--accent-rgb), 0.12);
    border-color: var(--accent-purple);
}

.theme-option-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.theme-option-label {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.theme-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.swatch-light {
    background: #ffffff;
    border-color: #cbd5e1;
}
.swatch-sepia {
    background: #fdf6e3;
    border-color: #e6d8b8;
}
.swatch-dark {
    background: #121726;
    border-color: #334155;
}

.theme-check-icon {
    width: 18px;
    height: 18px;
    color: var(--accent-purple);
    opacity: 0;
    transition: opacity 0.2s;
}
.theme-option-btn.active .theme-check-icon {
    opacity: 1;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    background-image: var(--bg-pattern);
    background-repeat: repeat;
    background-size: 40px 40px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

body.toc-open {
    overflow: hidden !important;
}

/* Scrollbar Styling: Hide scrollbars globally on Mobile & Desktop for Main App & Reader, preserving smooth scroll */
body:not(.admin-body) *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

html,
body,
.app-container,
.main-content,
#view-reader,
.reader-body,
.reader-pages-container,
.books-grid {
    -ms-overflow-style: none !important;  /* IE and Edge */
    scrollbar-width: none !important;  /* Firefox */
}

/* Re-enable Scrollbars ONLY for Admin Dashboard, TOC, Bookmarks & Custom Selects */
body:not(.admin-body) .toc-list::-webkit-scrollbar,
body:not(.admin-body) .toc-drawer::-webkit-scrollbar,
body:not(.admin-body) .bookmarks-list::-webkit-scrollbar,
body:not(.admin-body) .highlights-list::-webkit-scrollbar,
body:not(.admin-body) .search-results-wrapper::-webkit-scrollbar,
body.admin-body ::-webkit-scrollbar,
.dashboard-layout ::-webkit-scrollbar,
.dashboard-main ::-webkit-scrollbar,
.dashboard-body ::-webkit-scrollbar,
.dashboard-sidebar ::-webkit-scrollbar,
.custom-select-options::-webkit-scrollbar {
    display: block !important;
    width: 6px !important;
    height: 6px !important;
}
.dashboard-layout ::-webkit-scrollbar-track,
.custom-select-options::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
.dashboard-layout ::-webkit-scrollbar-thumb,
.custom-select-options::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb), 0.35);
    border-radius: 4px;
}

/* Navigation Bar */
.navbar {
    background-color: var(--bg-secondary);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
    padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
}
.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}
.logo-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}
.nav-links {
    display: flex;
    gap: 1rem;
}
.nav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.nav-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}
body.light-theme .nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
.nav-btn.active {
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.theme-toggle {
    background: rgba(var(--accent-rgb), 0.05);
    border: 1px solid var(--border-color);
    color: #ffffff;
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 10px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.theme-toggle:hover {
    transform: scale(1.05);
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #ffffff !important;
}
body.light-theme .theme-toggle {
    background: rgba(var(--accent-rgb), 0.05);
    color: #000000;
}
body.light-theme .theme-toggle:hover {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #ffffff !important;
}
body.light-theme .sun-icon { display: none; }
body:not(.light-theme) .moon-icon { display: none; }

.nav-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.nav-action-btn {
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 10px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}
.nav-action-btn:hover {
    transform: scale(1.05);
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #ffffff !important;
}

.nav-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--accent-cyan);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--bg-secondary);
    animation: scaleInBadge 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.light-theme .nav-badge {
    border-color: #fff;
}

@keyframes scaleInBadge {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* Main App Container */
.app-container {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem 2rem 2rem 2rem;
    display: flex;
    flex-direction: column;
}
.app-container.reader-view-active {
    padding-bottom: 0.5rem !important;
}
@media (max-width: 600px) {
    .app-container.reader-view-active {
        padding-bottom: 0.25rem !important;
    }
}

/* View Sections */
.view-section {
    animation: fadeIn var(--transition-normal);
}
#view-reader {
    display: flex;
    flex-direction: column;
    flex: 1;
}
.hidden {
    display: none !important;
}

/* Direct book URL initial layout styling to eliminate navbar & footer flicker */
body.reader-mode-pending .app-footer,
body.reader-mode-pending #navbar-logo-area,
body.reader-mode-pending #ai-fab {
    display: none !important;
}
body.reader-mode-pending #navbar-back-btn {
    display: flex !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 1.5rem 1rem;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.07) 0%, transparent 60%);
    border-radius: 24px;
    margin-bottom: 1rem;
}
.hero-title {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem; /* Reduced from 1rem since divider adds spacing */
    line-height: 1.2;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.75rem auto 1.25rem auto;
    opacity: 0.95;
    pointer-events: none;
}
.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

/* Advanced Search */
.search-container {
    max-width: 680px;
    margin: 0 auto;
}
.search-box {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.4rem;
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}
.search-box:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}
.search-icon {
    font-size: 1.2rem;
    padding: 0 1rem;
    display: flex;
    align-items: center;
}
.search-box input[type="text"],
.search-box input {
    flex: 1;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    color: var(--text-primary) !important;
    font-family: var(--font-sans);
    font-size: 1.05rem;
    padding: 0.5rem 0.5rem 0.5rem 0.25rem !important;
}
.search-btn {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    font-family: var(--font-sans);
    font-weight: 600;
    padding: 0.6rem 1.6rem;
    border-radius: 50px;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}
.search-btn:hover {
    opacity: 0.9;
}

/* Categories List */
.categories-container {
    position: relative;
    margin-bottom: 2.5rem;
}
.categories-container::before,
.categories-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0;
}
/* Right fade (scroll start/right side in RTL) */
.categories-container::before {
    right: 0;
    background: linear-gradient(to left, var(--bg-primary), transparent);
}
/* Left fade (scroll end/left side in RTL) */
.categories-container::after {
    left: 0;
    background: linear-gradient(to right, var(--bg-primary), transparent);
}
.categories-container.show-fade-right::before {
    opacity: 1;
}
.categories-container.show-fade-left::after {
    opacity: 1;
}

.categories-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.6rem 0.2rem;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.categories-scroll::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.category-chip {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.55rem 1.4rem;
    border-radius: 50px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}
.category-chip:hover {
    color: var(--text-primary);
    border-color: rgba(var(--accent-rgb), 0.4);
    transform: translateY(-1px);
}
.category-chip.active {
    background-color: rgba(var(--accent-rgb), 0.15) !important;
    color: var(--accent-purple) !important;
    border-color: var(--accent-purple) !important;
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.15);
    transform: translateY(-1px);
}

/* Section Title styling */
.section-title {
    font-size: 1.65rem;
    font-weight: 800;
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
    color: var(--text-primary);
}
.section-title .badge {
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    padding: 0.25rem 0.85rem;
    font-size: 0.95rem;
    border-radius: 50px;
    font-weight: 700;
    font-family: 'Amiri', 'Cairo', serif !important;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.12);
    transition: all var(--transition-fast);
}
body.light-theme .section-title .badge {
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent-purple);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
}

/* Books Grid & Cards */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.book-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-right: 4px solid var(--accent-purple); /* Accent starting line */
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 190px;
    cursor: pointer;
    padding: 1.2rem;
    box-sizing: border-box;
    position: relative;

    /* Scroll Reveal Hidden State */
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), 
                background-color var(--transition-normal), 
                border-color var(--transition-normal), 
                border-right-color var(--transition-normal), 
                box-shadow var(--transition-normal);
    will-change: opacity, transform;
}
.book-card.reveal {
    opacity: 1;
    transform: translateY(0);
}
.book-card.reveal:hover {
    transform: translateY(-4px);
    border-color: var(--accent-cyan);
    border-right-color: var(--accent-cyan);
    box-shadow: var(--shadow-md);
    background-color: rgba(255, 255, 255, 0.02);
}
body.light-theme .book-card.reveal:hover {
    background-color: rgba(0, 0, 0, 0.015);
}
.book-card-main {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex-grow: 1;
}
.book-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.book-tag {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 180px;
}
body.light-theme .book-tag {
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
}
.book-card-icon {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}
.book-card-icon svg {
    width: 18px;
    height: 18px;
}
.book-card:hover .book-card-icon {
    color: var(--accent-purple);
}
.book-title-text {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}
.book-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.book-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.book-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    margin-top: 0;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.book-card-divider {
    border-top: 1px dashed var(--border-color);
    margin-top: auto;
    margin-bottom: 0.35rem;
    width: 100%;
    height: 1px;
    flex-shrink: 0;
}
.pages-count {
    font-size: 0.8rem;
    color: var(--accent-cyan);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}
.pages-count svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.2px;
}
.read-btn {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.book-card:hover .read-btn {
    color: var(--accent-purple);
    transform: translateX(-2px);
}
.no-data-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
}

/* Reader Fullscreen mode styling */
body.reader-fullscreen-active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--safe-area-inset-top, env(safe-area-inset-top, 24px));
    background-color: var(--reader-bg);
    z-index: 9999;
    pointer-events: none;
    border-bottom: 1px solid var(--border-color);
}
body.reader-fullscreen-active .navbar {
    display: none !important;
}
body.reader-fullscreen-active .reader-header {
    display: none !important;
}
body.reader-fullscreen-active .app-container {
    padding-top: calc(1.2rem + var(--safe-area-inset-top, env(safe-area-inset-top, 24px))) !important;
}
body.reader-fullscreen-active .reader-page-header {
    position: relative !important;
    top: auto !important;
    box-shadow: none !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}
body.reader-fullscreen-active .reader-pagination {
    padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

.fullscreen-exit-btn {
    position: fixed;
    top: calc(12px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    z-index: 10000;
    background: rgba(var(--accent-rgb), 0.1);
    color: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.fullscreen-exit-btn:hover {
    transform: translateX(-50%) scale(1.05);
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #ffffff !important;
}
body.light-theme .fullscreen-exit-btn {
    background: rgba(var(--accent-rgb), 0.08);
    color: #000000;
}
body.light-theme .fullscreen-exit-btn:hover {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #ffffff !important;
}
.fullscreen-exit-btn .lucide {
    width: 20px;
    height: 20px;
}

/* Reader View styling */
.reader-header {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.back-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.back-btn:hover {
    background-color: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
}
body.light-theme .back-btn {
    background-color: #fff;
}
body.light-theme .back-btn:hover {
    background-color: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
}
.reader-book-info {
    text-align: right;
}
#reader-book-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
    line-height: 1.35;
}
.reader-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: none !important;
}

.reader-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Custom styles for Reader search and index buttons */
.back-btn.reader-search-toggle-btn,
.back-btn.toc-toggle-btn {
    background-color: var(--accent-purple);
    color: #fff;
    border: 1.5px solid var(--accent-purple);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.back-btn.reader-search-toggle-btn:hover,
.back-btn.toc-toggle-btn:hover {
    background-color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #fff;
}
body.light-theme .back-btn.reader-search-toggle-btn,
body.light-theme .back-btn.toc-toggle-btn {
    background-color: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
}
body.light-theme .back-btn.reader-search-toggle-btn:hover,
body.light-theme .back-btn.toc-toggle-btn:hover {
    background-color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #fff;
}

.back-btn.reader-search-toggle-btn.clear-active {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.back-btn.reader-search-toggle-btn.clear-active:hover {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #ef4444 !important;
}
body.light-theme .back-btn.reader-search-toggle-btn.clear-active {
    background-color: rgba(239, 68, 68, 0.08) !important;
    color: #dc2626 !important;
    border-color: rgba(239, 68, 68, 0.15) !important;
}
body.light-theme .back-btn.reader-search-toggle-btn.clear-active:hover {
    background-color: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.25) !important;
    color: #dc2626 !important;
}

#navbar-back-btn {
    background-color: var(--accent-purple);
    color: #fff;
    border: 1.5px solid var(--accent-purple);
    font-weight: bold;
}
#navbar-back-btn:hover {
    background-color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #fff;
}
body.light-theme #navbar-back-btn {
    background-color: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
}
body.light-theme #navbar-back-btn:hover {
    background-color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #fff;
}

/* Mobile responsive layout for reader header */
@media (max-width: 768px) {
    .reader-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 1rem;
    }
    .reader-book-info {
        text-align: right;
        width: 100%;
        overflow: hidden;
    }
    #reader-book-title {
        font-size: 1.05rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
        display: block;
    }
    .reader-meta {
        font-size: 0.82rem;
    }
    .reader-header-actions {
        display: flex;
        gap: 0.5rem;
        width: 100%;
        align-items: center;
    }
    .reader-header-actions .back-btn.reader-search-toggle-btn,
    .reader-header-actions .back-btn.toc-toggle-btn {
        flex: 1;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
    }
}
@media (max-width: 480px) {
    .reader-header {
        padding: 0.85rem;
        margin-bottom: 1rem;
        border-radius: 12px;
        gap: 0.6rem;
    }
    #reader-book-title {
        font-size: 0.95rem;
    }
    .reader-meta {
        font-size: 0.78rem;
    }
    .reader-header-actions .back-btn.reader-search-toggle-btn,
    .reader-header-actions .back-btn.toc-toggle-btn {
        padding: 0.45rem 0.6rem;
        font-size: 0.82rem;
    }
}
.reader-controls {
    display: flex;
    gap: 0.5rem;
}
.ctrl-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
}
.ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-cyan);
}
body.light-theme .ctrl-btn {
    background-color: #fff;
}

.reader-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.reader-sidebar {
    position: fixed;
    top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
    height: calc(100vh - var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
    max-height: calc(100vh - var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
    right: -420px; /* Slides in from right in RTL */
    width: 380px;
    max-width: 85vw;
    background-color: var(--bg-primary);
    border-right: none;
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    border-top-left-radius: 16px;
    padding: 0;
    z-index: 1100;
    box-shadow: var(--shadow-lg);
    transition: right var(--transition-normal);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    direction: ltr; /* Force scrollbar to render on the right */
}
.reader-sidebar > * {
    direction: rtl; /* Keep layout/text inside TOC right-to-left */
}
.reader-sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
    margin-bottom: 0;
    padding: 1.2rem 1.2rem 0.9rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.sidebar-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.sidebar-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-primary);
}
.sidebar-title-icon {
    width: 20px;
    height: 20px;
    stroke: var(--accent-purple);
    stroke-width: 2.2px;
}
.close-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    border-radius: 8px;
    transition: all var(--transition-fast);
}
.close-sidebar-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
body.light-theme .close-sidebar-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
.close-sidebar-btn .lucide {
    width: 18px;
    height: 18px;
}

/* TOC Search Styling */
.toc-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.1rem 0.5rem;
    transition: all var(--transition-fast);
}
.toc-search-box:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}
.toc-search-box input.toc-search-input,
.toc-search-box input[type="text"].toc-search-input {
    width: 100% !important;
    border: none !important;
    background: transparent !important;
    padding: 0.5rem 2.2rem 0.5rem 2.2rem !important;
    color: var(--text-primary) !important;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    direction: rtl !important;
}
.toc-search-box input.toc-search-input:focus,
.toc-search-box input[type="text"].toc-search-input:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}
.toc-search-icon {
    position: absolute;
    right: 0.8rem;
    width: 16px;
    height: 16px;
    color: var(--accent-purple);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}
.toc-search-clear {
    position: absolute;
    left: 0.8rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.2rem;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color var(--transition-fast);
}
.toc-search-clear:hover {
    background-color: rgba(var(--accent-rgb), 0.1);
    color: var(--text-primary);
}
body.light-theme .toc-search-clear:hover {
    background-color: rgba(var(--accent-rgb), 0.15);
}

/* Backdrop styling */
.toc-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1050;
    transition: all var(--transition-normal);
}
.toc-backdrop.hidden {
    display: none !important;
}
.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1rem 1.5rem 1.5rem;
    direction: ltr; /* Force scrollbar to render on the right */
}
.toc-item {
    direction: rtl;
    font-family: 'Abo-Thar-Brackets-ASCII', 'Abo-Thar', 'Abo-thar', 'Abo Thar', 'Abo thar', 'ABO-THAR', 'Abothar', 'Abo_Thar', 'Abo_thar', 'NewSymbolFont', 'New Symbol Font', 'Abo-Thar Regular', 'Abo-thar Regular', 'Abo Thar Regular', 'NewSymbolFont Regular', 'Amiri', 'Cairo', serif;
    font-size: 0.88rem;
    padding: 0.8rem 0.75rem;
    border-radius: 0;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.12);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}
.toc-list .toc-item:last-child {
    border-bottom: none;
}
.toc-item::before {
    display: none;
}
.toc-title {
    flex: 1;
    margin-right: 0;
    transition: transform var(--transition-fast);
}
.toc-item:hover {
    background-color: rgba(var(--accent-rgb), 0.04);
    color: var(--text-primary);
}
.toc-item:hover .toc-title {
    transform: translateX(-4px);
    color: var(--accent-purple);
}
.toc-item:hover .toc-page-num {
    background-color: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #fff;
}
.toc-item.active {
    background-color: rgba(var(--accent-rgb), 0.08) !important;
    color: var(--text-primary) !important;
    font-weight: 700;
    border-right: 4px solid var(--accent-purple);
}
.toc-item.active .toc-title {
    color: var(--accent-purple) !important;
}
.toc-item.active .toc-page-num {
    background-color: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #fff;
}
.toc-page-num {
    font-family: 'Amiri', serif;
    font-size: 0.85rem;
    font-weight: 700;
    background-color: rgba(var(--accent-rgb), 0.05);
    border: 1px solid rgba(var(--accent-rgb), 0.15);
    color: var(--text-muted);
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.reader-main {
    perspective: 1500px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    flex: 1;
}
.reader-page-card {
    background-color: var(--reader-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    border-top: 3px solid var(--accent-purple);
    flex: 1;
}

/* Fade & Zoom Scale transitions */
.page-clone-fade {
    position: absolute !important;
    z-index: 10 !important;
    pointer-events: none !important;
    margin: 0 !important;
    background-color: var(--reader-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-md) !important;
    overflow: hidden !important;
    animation: fadeOutShrink 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.reader-page-card.fade-zoom-reveal {
    position: relative !important;
    z-index: 1 !important;
    animation: fadeInZoom 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes fadeOutShrink {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.96);
        opacity: 0;
    }
}

@keyframes fadeInZoom {
    0% {
        transform: scale(1.04);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
@media (max-width: 600px) {
    .reader-page-card {
        padding: 1.5rem;
    }
}
.reader-page-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
}
.page-actions {
    display: flex;
    gap: 0.5rem;
}
.page-action-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.page-action-btn:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
    background-color: rgba(212, 175, 55, 0.05);
}
.page-action-btn.bookmarked {
    background-color: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
}
.page-action-btn.bookmarked:hover {
    background-color: var(--accent-cyan);
    color: #fff;
    border-color: var(--accent-cyan);
}
.page-action-btn.bookmarked .lucide {
    fill: #fff;
}
.page-action-btn .lucide {
    width: 19px;
    height: 19px;
}
.page-indicator {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}
.reader-page-content {
    font-family: 'Abo-Thar-Brackets-ASCII', 'Abo-Thar', 'Abo-thar', 'Abo Thar', 'Abo thar', 'ABO-THAR', 'Abothar', 'Abo_Thar', 'Abo_thar', 'NewSymbolFont', 'New Symbol Font', 'Abo-Thar Regular', 'Abo-thar Regular', 'Abo Thar Regular', 'NewSymbolFont Regular', 'Amiri', 'Cairo', serif;
    font-size: 22px;
    line-height: 2.2;
    color: var(--reader-text);
    white-space: normal;
    flex: 1;
    text-align: justify;
    min-height: 200px;
}

.quran-bracket,
.reader-page-content .quran-bracket,
.reader-page-content span.quran-bracket,
.rich-editor .quran-bracket,
.rich-editor span.quran-bracket {
    font-family: 'Abo-Thar-Brackets' !important;
    color: var(--quran-color) !important;
}

.quran-text {
    color: var(--quran-color) !important;
    font-weight: 600;
}

/* Reset and clean up pasted rich-text inline styles to fit full container width */
.reader-page-content p, 
.reader-page-content div, 
.reader-page-content span,
.reader-page-content font,
.rich-editor p, 
.rich-editor div, 
.rich-editor span,
.rich-editor font {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    width: auto !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    text-indent: 0 !important;
}

/* Constrain heading sizes in reader content and editor to prevent oversized headings */
.reader-page-content h1, .rich-editor h1 { font-size: 1.4em !important; font-weight: bold !important; line-height: 1.4 !important; margin: 0.8rem 0 !important; }
.reader-page-content h2, .rich-editor h2 { font-size: 1.3em !important; font-weight: bold !important; line-height: 1.4 !important; margin: 0.7rem 0 !important; }
.reader-page-content h3, .rich-editor h3 { font-size: 1.2em !important; font-weight: bold !important; line-height: 1.4 !important; margin: 0.6rem 0 !important; }
.reader-page-content h4, .rich-editor h4 { font-size: 1.15em !important; font-weight: bold !important; line-height: 1.4 !important; margin: 0.5rem 0 !important; }
.reader-page-content h5, .rich-editor h5 { font-size: 1.1em !important; font-weight: bold !important; line-height: 1.4 !important; margin: 0.4rem 0 !important; }
.reader-page-content h6, .rich-editor h6 { font-size: 1.05em !important; font-weight: bold !important; line-height: 1.4 !important; margin: 0.3rem 0 !important; }

/* Preserve symbol fonts in pasted rich-text */
.reader-page-content [style*="Taher"],
.reader-page-content [style*="taher"],
.rich-editor [style*="Taher"],
.rich-editor [style*="taher"],
.reader-page-content [face*="Taher"],
.reader-page-content [face*="taher"],
.rich-editor [face*="Taher"],
.rich-editor [face*="taher"] {
    font-family: 'Abo-Thar-Brackets-ASCII', 'Abo-Thar', 'Abo-thar', 'Abo Thar', 'Abo thar', 'ABO-THAR', 'Abothar', 'Abo_Thar', 'Abo_thar', 'NewSymbolFont', 'New Symbol Font', 'Abo-Thar Regular', 'Abo-thar Regular', 'Abo Thar Regular', 'NewSymbolFont Regular', 'Amiri', 'Cairo', serif !important;
}
.reader-page-content [style*="Abo-Thar"],
.reader-page-content [style*="Abo-thar"],
.reader-page-content [style*="ABO-THAR"],
.reader-page-content [style*="Abo Thar"],
.reader-page-content [style*="Abo thar"],
.reader-page-content [style*="Abothar"],
.reader-page-content [style*="Abo_Thar"],
.reader-page-content [style*="Abo_thar"],
.reader-page-content [style*="NewSymbolFont"],
.reader-page-content [style*="New Symbol Font"],
.rich-editor [style*="Abo-Thar"],
.rich-editor [style*="Abo-thar"],
.rich-editor [style*="ABO-THAR"],
.rich-editor [style*="Abo Thar"],
.rich-editor [style*="Abo thar"],
.rich-editor [style*="Abothar"],
.rich-editor [style*="Abo_Thar"],
.rich-editor [style*="Abo_thar"],
.rich-editor [style*="NewSymbolFont"],
.rich-editor [style*="New Symbol Font"],
.reader-page-content [face*="Abo-Thar"],
.reader-page-content [face*="Abo-thar"],
.reader-page-content [face*="ABO-THAR"],
.reader-page-content [face*="Abo Thar"],
.reader-page-content [face*="Abo thar"],
.reader-page-content [face*="Abothar"],
.reader-page-content [face*="Abo_Thar"],
.reader-page-content [face*="Abo_thar"],
.reader-page-content [face*="NewSymbolFont"],
.reader-page-content [face*="New Symbol Font"],
.rich-editor [face*="Abo-Thar"],
.rich-editor [face*="Abo-thar"],
.rich-editor [face*="ABO-THAR"],
.rich-editor [face*="Abo Thar"],
.rich-editor [face*="Abo thar"],
.rich-editor [face*="Abothar"],
.rich-editor [face*="Abo_Thar"],
.rich-editor [face*="Abo_thar"],
.rich-editor [face*="NewSymbolFont"],
.rich-editor [face*="New Symbol Font"] {
    font-family: 'Abo-Thar-Brackets-ASCII', 'Abo-Thar', 'Abo-thar', 'Abo Thar', 'Abo thar', 'ABO-THAR', 'Abothar', 'Abo_Thar', 'Abo_thar', 'NewSymbolFont', 'New Symbol Font', 'Abo-Thar Regular', 'Abo-thar Regular', 'Abo Thar Regular', 'NewSymbolFont Regular', 'Amiri', 'Cairo', serif !important;
}



/* Footnotes */
.reader-footnotes {
    margin-top: 1.5rem;
}
.footnote-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}
.footnote-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-cyan);
    white-space: nowrap;
}
.footnote-line {
    flex: 1;
    height: 1px;
    background-color: var(--border-color);
    transform: translateY(2px);
}
.footnote-content {
    font-family: 'Abo-Thar-Brackets-ASCII', 'Abo-Thar', 'Abo-thar', 'Abo Thar', 'Abo thar', 'ABO-THAR', 'Abothar', 'Abo_Thar', 'Abo_thar', 'NewSymbolFont', 'New Symbol Font', 'Abo-Thar Regular', 'Abo-thar Regular', 'Abo Thar Regular', 'NewSymbolFont Regular', 'Amiri', 'Cairo', serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.footnote-popover {
    position: absolute;
    z-index: 1200;
    width: max-content;
    max-width: min(480px, 90vw);
    min-width: 140px;
    background-color: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.65rem 1rem;
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.55;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
    box-sizing: border-box;
}
body.light-theme .footnote-popover {
    background-color: var(--bg-primary);
    border: 1px solid #cbd5e1;
    color: #1e293b;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}
body.sepia-theme .footnote-popover {
    background-color: #f4ecd8;
    border: 1px solid #c59b27;
    color: #5b4636;
    box-shadow: 0 10px 25px rgba(91, 70, 54, 0.15);
}
body.dark-theme .footnote-popover {
    background-color: #121212;
    border: 1px solid #333333;
    color: #f7fafc;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}
.footnote-popover.visible {
    opacity: 1;
    transform: translateY(0);
}
.popover-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.5rem;
    direction: rtl;
}
.popover-num {
    font-weight: bold;
    color: var(--accent-purple);
    font-size: 1.05rem;
    font-family: 'Amiri', serif !important;
    white-space: nowrap;
}
.popover-text {
    flex: 1;
    color: var(--text-primary);
    font-family: 'Abo-Thar-Brackets-ASCII', 'Abo-Thar', 'Abo-thar', 'Abo Thar', 'Abo thar', 'ABO-THAR', 'Abothar', 'Abo_Thar', 'Abo_thar', 'NewSymbolFont', 'New Symbol Font', 'Abo-Thar Regular', 'Abo-thar Regular', 'Abo Thar Regular', 'NewSymbolFont Regular', 'Amiri', 'Cairo', serif !important;
    font-size: 1.05rem;
    white-space: pre-wrap;
}

/* Footnote Reference Styles */
.footnote-ref {
    display: inline;
    color: var(--accent-purple);
    font-weight: 700;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
    border: none;
    background: none;
    font-size: inherit;
    font-family: inherit;
    text-decoration: none;
}
.footnote-ref:hover {
    background-color: rgba(var(--accent-rgb), 0.15);
    color: var(--accent-pink);
}

.footnote-item {
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}


/* Reader Pagination */
.reader-pagination {
    position: sticky;
    bottom: 1rem;
    z-index: 100;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: var(--bg-card);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border: 1px solid rgba(var(--accent-rgb), 0.15);
    padding: 0;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: all var(--transition-normal), opacity 0.35s ease, transform 0.35s ease;
    opacity: 0;
    transform: translateY(30px);
    pointer-events: none;
}
.reader-pagination.pagination-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}


.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    width: 100%;
    box-sizing: border-box;
    gap: 0.75rem;
}
.pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--accent-purple);
    border: 1.5px solid var(--accent-purple);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}
.pag-btn svg, .pag-btn i {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
    transition: transform var(--transition-fast);
}
.pag-btn:hover {
    background-color: var(--accent-cyan);
    color: #fff;
    border-color: var(--accent-cyan);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.2);
}
.pag-btn:active {
    transform: translateY(0);
}
.pag-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    background-color: var(--accent-purple) !important;
    border-color: var(--accent-purple) !important;
    color: #fff !important;
}
#prev-page-btn,
#next-page-btn {
    background-color: var(--accent-purple);
    border-color: var(--accent-purple);
    color: #ffffff;
}
#prev-page-btn:hover,
#next-page-btn:hover {
    background-color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #ffffff;
}

body.light-theme #prev-page-btn,
body.light-theme #next-page-btn {
    background-color: #319795;
    border-color: #319795;
    color: #ffffff;
}
body.light-theme #prev-page-btn:hover,
body.light-theme #next-page-btn:hover {
    background-color: #2c7a7b;
    border-color: #2c7a7b;
    color: #ffffff;
}

body.sepia-theme #prev-page-btn,
body.sepia-theme #next-page-btn {
    background-color: #c59b27;
    border-color: #c59b27;
    color: #ffffff;
}
body.sepia-theme #prev-page-btn:hover,
body.sepia-theme #next-page-btn:hover {
    background-color: #a37c15;
    border-color: #a37c15;
    color: #ffffff;
}

#prev-page-btn:hover svg {
    transform: translateX(2px);
}
#next-page-btn:hover svg {
    transform: translateX(-2px);
}
.current-page-num-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: rgba(var(--accent-rgb), 0.04);
    border: 1px solid rgba(var(--accent-rgb), 0.12);
    padding: 0.35rem 0.9rem;
    border-radius: 10px;
    font-family: 'Amiri', serif;
    font-size: 1rem;
    color: var(--text-secondary);
    direction: rtl;
    transition: all var(--transition-fast);
}
.current-page-num-pill:hover {
    border-color: rgba(var(--accent-rgb), 0.3);
    background-color: rgba(var(--accent-rgb), 0.08);
}
.pill-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: 500;
}
.pill-total {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}
.goto-page-input {
    width: 45px !important;
    background-color: var(--bg-primary) !important;
    border: 1px solid rgba(var(--accent-rgb), 0.2) !important;
    color: var(--accent-pink) !important;
    font-family: 'Amiri', serif !important;
    font-weight: 700 !important;
    font-size: 1.05rem !important;
    padding: 0.15rem 0.35rem !important;
    border-radius: 8px !important;
    text-align: center !important;
    transition: all var(--transition-fast) !important;
    outline: none !important;
    -moz-appearance: textfield !important; /* Hide Firefox spinbox */
}
.goto-page-input::-webkit-outer-spin-button,
.goto-page-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important; /* Hide Chrome/Safari/Edge spinbox */
    margin: 0 !important;
}
.goto-page-input:focus {
    border-color: var(--accent-purple) !important;
    box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.2) !important;
    background-color: var(--bg-secondary) !important;
}

/* Admin Dashboard Styling */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.dashboard-title-area h1 {
    font-size: 1.8rem;
    font-weight: 800;
}
.dashboard-title-area p {
    color: var(--text-secondary);
}
.primary-btn {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    font-family: var(--font-sans);
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}
.primary-btn:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}
.secondary-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.secondary-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
body.light-theme .secondary-btn {
    background-color: #e2e8f0;
}

.btn-visit-site {
    background-color: rgba(var(--accent-rgb), 0.12);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    color: #34d399;
    font-family: var(--font-sans);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-visit-site:hover {
    background-color: rgba(var(--accent-rgb), 0.22);
    border-color: rgba(var(--accent-rgb), 0.35);
    transform: translateY(-1px);
}
body.light-theme .btn-visit-site {
    background-color: rgba(49, 151, 149, 0.1);
    border-color: rgba(49, 151, 149, 0.25);
    color: var(--accent-purple);
}
body.light-theme .btn-visit-site:hover {
    background-color: rgba(49, 151, 149, 0.18);
    border-color: rgba(49, 151, 149, 0.35);
    color: var(--accent-purple);
}

/* Dashboard Main Panel Container */
.dashboard-panel {
    background-color: var(--bg-secondary);
    background-image: none !important;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.stat-card {
    background-color: var(--bg-card);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
}
.stat-icon {
    font-size: 2.2rem;
}
.stat-info {
    display: flex;
    flex-direction: column;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.2;
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Dashboard Table */
.dashboard-content-card {
    background-color: var(--bg-card);
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.table-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}
.table-header input {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: var(--font-sans);
    outline: none;
    width: 280px;
    transition: border var(--transition-fast);
}
.table-header input:focus {
    border-color: var(--accent-cyan);
}

.table-responsive {
    overflow-x: auto;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    min-width: 600px;
}
.pages-table {
    min-width: 750px;
}
.admin-table th, .admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.admin-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
}
.admin-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}
body.light-theme .admin-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

.table-cover {
    width: 45px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    background-color: rgba(0,0,0,0.1);
}
.table-cover-placeholder {
    width: 45px;
    height: 60px;
    border-radius: 6px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Visibility toggles and badges */
.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}
.status-badge.visible {
    background-color: rgba(var(--accent-rgb), 0.1);
    color: #10b981;
}
.status-badge.hidden {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Table action buttons */
.action-group {
    display: flex;
    gap: 0.4rem;
}
.act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(var(--accent-rgb), 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
}
body.light-theme .act-btn {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}
.act-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.act-btn.btn-manage {
    color: var(--accent-purple);
    border-color: var(--accent-purple);
    background-color: rgba(147, 51, 234, 0.04);
}
.act-btn.btn-manage:hover {
    background-color: var(--accent-purple) !important;
    border-color: var(--accent-purple) !important;
    color: #ffffff !important;
}

.act-btn.btn-edit {
    color: #d97706;
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.04);
}
body.dark-theme .act-btn.btn-edit {
    color: #fbbf24;
    border-color: #d97706;
}
.act-btn.btn-edit:hover {
    background-color: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #ffffff !important;
}

.act-btn.btn-delete {
    color: #dc2626;
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.04);
}
.act-btn.btn-delete:hover {
    background-color: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
}

/* Modals & Popups styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(7, 10, 18, 0.85);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
    padding: calc(1rem + var(--safe-area-inset-top, env(safe-area-inset-top, 24px))) 1rem calc(1rem + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    animation: fadeInModal var(--transition-fast);
}
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-container {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 580px;
    max-height: calc(100vh - 2rem - var(--safe-area-inset-top, env(safe-area-inset-top, 24px)) - var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUpModal var(--transition-fast);
}
@keyframes slideUpModal {
    from { transform: translateY(20px); }
    to { transform: translateY(0); }
}

.modal-container form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.modal-large {
    max-width: 900px;
}
.modal-medium {
    max-width: 720px;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}
.modal-title-desc {
    display: flex;
    flex-direction: column;
}
.modal-title-desc p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}
.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-fast);
}
.close-modal-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Forms styling */
.form-group {
    margin-bottom: 1.25rem;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
@media (max-width: 560px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}
label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}
.required {
    color: #ef4444;
}
input[type="text"], input[type="email"], input[type="number"], input[type="url"], select, textarea {
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-fast);
}
input[type="text"]:focus, input[type="email"]:focus, input[type="number"]:focus, input[type="url"]:focus, select:focus, textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}
select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}
.select-wrapper {
    position: relative;
    width: 100%;
}
.select-wrapper select {
    padding: 0.5rem 0.9rem 0.5rem 2.5rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}
.select-wrapper .select-arrow {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    transition: transform var(--transition-fast), color var(--transition-fast);
}
.select-wrapper select:focus + .select-arrow {
    color: var(--accent-cyan);
    transform: translateY(-50%) rotate(180deg);
}
.select-wrapper .select-arrow svg {
    width: 16px;
    height: 16px;
}
input[readonly] {
    opacity: 0.75;
    cursor: not-allowed;
    background-color: rgba(255,255,255,0.02);
}
.input-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    display: block;
}

/* Custom Checkbox */
.checkbox-container {
    display: block;
    position: relative;
    padding-right: 32px;
    cursor: pointer;
    font-size: 0.95rem;
    user-select: none;
    color: var(--text-primary);
}
.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.checkmark {
    position: absolute;
    top: 2px;
    right: 0;
    height: 20px;
    width: 20px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all var(--transition-fast);
}
.checkbox-container:hover input ~ .checkmark {
    border-color: var(--accent-cyan);
}
.checkbox-container input:checked ~ .checkmark {
    background: var(--accent-gradient);
    border-color: transparent;
}
.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}
.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}
.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Rich Text Editor Styling in Modal */
.editor-toolbar {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.tool-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}
.tool-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}
body.light-theme .tool-btn:hover {
    background-color: rgba(0,0,0,0.06);
}
.font-size-btn {
    font-weight: 700;
}
.tool-separator {
    color: var(--border-color);
    margin: 0 0.25rem;
}
.tool-select {
    width: auto !important;
    background-color: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    font-family: var(--font-sans) !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    outline: none !important;
    
    /* Hide default browser arrow */
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    
    /* Custom SVG chevron arrow on the left for RTL layout */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239cb0a3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: left 10px center !important;
    padding: 0.35rem 0.75rem 0.35rem 1.85rem !important;
    transition: all var(--transition-fast) !important;
}

.tool-select:hover {
    border-color: var(--accent-purple) !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

body.light-theme .tool-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23655843' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
}

body.light-theme .tool-select:hover {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

.tool-select option {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}
.rich-editor {
    min-height: 200px;
    max-height: 350px;
    overflow-y: auto;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    padding: 1rem;
    outline: none;
    line-height: 1.7;
    font-size: 0.95rem;
    font-family: 'Abo-Thar-Brackets-ASCII', 'Abo-Thar', 'Abo-thar', 'Abo Thar', 'Abo thar', 'ABO-THAR', 'Abothar', 'Abo_Thar', 'Abo_thar', 'NewSymbolFont', 'New Symbol Font', 'Abo-Thar Regular', 'Abo-thar Regular', 'Abo Thar Regular', 'NewSymbolFont Regular', 'Amiri', 'Cairo', serif;
    text-align: justify;
}
.rich-editor:focus {
    border-color: var(--accent-cyan);
}
.rich-editor[placeholder]:empty:before {
    content: attr(placeholder);
    color: var(--text-muted);
}
.toc-anchor {
    display: inline-block;
    scroll-margin-top: 90px; /* Offset to prevent going under sticky navbar */
}
body.reader-fullscreen-active .toc-anchor {
    scroll-margin-top: 20px; /* Small offset when navbar is hidden in fullscreen */
}
.reader-page-content .toc-anchor {
    color: inherit !important;
    font-weight: inherit !important;
    border-bottom: none !important;
    padding-bottom: 0 !important;
}
.rich-editor .toc-anchor {
    font-weight: 700 !important;
    background-color: #fef08a !important;
    color: #1e293b !important;
    text-decoration: none !important;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline !important;
}
.rich-editor .toc-anchor * {
    font-weight: inherit !important;
    background-color: transparent !important;
    color: inherit !important;
    text-decoration: none !important;
    display: inline !important;
}
body.light-theme .rich-editor .toc-anchor {
    background-color: #fef08a !important;
    color: #1e293b !important;
}
body.light-theme .rich-editor .toc-anchor * {
    background-color: transparent !important;
    color: inherit !important;
}
/* TOC delete button in editor */
.toc-delete-btn {
    display: block;
    width: fit-content;
    margin: 6px 0 8px 0;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.2s ease;
    user-select: none;
}
.toc-delete-btn:hover {
    background: #c0392b;
}
.reader-page-content blockquote, .rich-editor blockquote {
    border-right: 4px solid var(--accent-purple);
    background-color: rgba(var(--accent-rgb), 0.05);
    margin: 1.25rem 0;
    padding: 0.75rem 1.25rem;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    font-family: 'Abo-Thar-Brackets-ASCII', 'Abo-Thar', 'Abo-thar', 'Abo Thar', 'Abo thar', 'ABO-THAR', 'Abothar', 'Abo_Thar', 'Abo_thar', 'NewSymbolFont', 'New Symbol Font', 'Abo-Thar Regular', 'Abo-thar Regular', 'Abo Thar Regular', 'NewSymbolFont Regular', 'Amiri', 'Cairo', serif;
    font-size: 1.1rem;
    line-height: 1.8;
}
body.light-theme .reader-page-content blockquote, body.light-theme .rich-editor blockquote {
    background-color: rgba(180, 145, 76, 0.06);
    border-right-color: var(--accent-purple);
}

/* Pages table styling inside modal */
.manage-pages-actions {
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
}
.pages-list-container {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-height: 50vh;
    overflow: auto;
}
.pages-table td {
    padding: 0.75rem 1rem;
}

/* Notifications Toast */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(254, 253, 250, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #2c2211;
    border: 1px solid rgba(197, 160, 89, 0.35);
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    z-index: 10000;
    font-weight: 700;
    font-size: 0.95rem;
    animation: slideInToast var(--transition-fast);
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    transition: all var(--transition-fast);
}

.toast.success {
    border: 1px solid rgba(16, 185, 129, 0.3);
    background-color: rgba(240, 253, 244, 0.98);
    color: #15803d;
}

.toast.error {
    border: 1px solid rgba(239, 68, 68, 0.3);
    background-color: rgba(254, 242, 242, 0.98);
    color: #b91c1c;
}

.toast.info {
    border: 1px solid rgba(197, 160, 89, 0.3);
    background-color: rgba(254, 253, 246, 0.98);
    color: #8d6e37;
}
@keyframes slideInToast {
    from { transform: translate(-50%, 40px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* Media Queries for Responsive Layouts */
@media (max-width: 992px) {
    .app-container {
        padding: 1.5rem;
    }
    .hero-title {
        font-size: 2.2rem;
    }
}
@media (max-width: 600px) {
    .navbar-container {
        padding: 0.8rem 1rem;
        gap: 0.5rem;
    }
    .logo-text {
        font-size: 1.25rem;
        white-space: nowrap;
    }
    .logo-icon {
        font-size: 1.5rem;
    }
    .nav-btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
        white-space: nowrap;
    }
    .nav-links {
        gap: 0.5rem;
    }
    .hero-title {
        font-size: 1.8rem;
    }
    .hero-section {
        padding: 1.25rem 0.5rem;
    }
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    .stats-bar .stat-card {
        padding: 1rem 0.8rem;
        gap: 0.8rem;
        border-radius: 12px;
    }
    .stats-bar .stat-icon {
        font-size: 1.8rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .stats-bar .stat-icon svg,
    .stats-bar .stat-icon i {
        width: 24px !important;
        height: 24px !important;
    }
    .stats-bar .stat-value {
        font-size: 1.3rem;
        font-weight: 850;
    }
    .stats-bar .stat-label {
        font-size: 0.78rem;
        white-space: nowrap;
    }
    /* Search box optimizations - mobile screens <= 600px */
    .search-box {
        padding: 0.4rem;
        flex-wrap: wrap;
        border-radius: 20px;
    }
    .search-icon {
        padding: 0 0.5rem;
    }
    .search-box input[type="text"],
    .search-box input {
        font-size: 0.95rem;
        padding: 0.4rem 0.25rem !important;
    }
    .search-btn {
        width: 100%;
        margin-top: 0.5rem;
        border-radius: 12px;
        padding: 0.6rem;
        font-size: 0.9rem;
        text-align: center;
    }
    .voice-search-btn {
        padding: 0 0.5rem;
    }
    /* Global search filter options - vertical layout <= 600px */
    .search-filter-group {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }
    .search-filter-options {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }
    .search-filters-container {
        padding: 0.75rem !important;
    }
    /* Reader pagination optimizations for <= 600px */
    .reader-pagination {
        border-radius: 12px !important;
        bottom: 0.5rem !important;
    }
    .pagination-controls {
        padding: 0.5rem 0.6rem !important;
        gap: 0.4rem !important;
    }
    .pag-btn {
        padding: 0.6rem !important;
        border-radius: 10px !important;
        aspect-ratio: 1 !important;
        gap: 0 !important;
    }
    .pag-btn .btn-text {
        display: none !important;
    }
    .current-page-num-pill {
        padding: 0.25rem 0.6rem !important;
        font-size: 0.9rem !important;
        gap: 0.3rem !important;
    }

    .goto-page-input {
        width: 38px !important;
        padding: 0.1rem 0.25rem !important;
        font-size: 0.95rem !important;
    }
}
@media (max-width: 480px) {
    .app-container {
        padding: 1rem 0.75rem 1.5rem 0.75rem;
    }
    .navbar-container {
        padding: 0.8rem 0.85rem;
    }
    /* Navbar optimizations */
    .logo-text {
        font-size: 1.05rem;
        white-space: nowrap;
    }
    .logo-icon {
        font-size: 1.3rem;
    }
    .nav-btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.6rem;
        white-space: nowrap;
    }
    .nav-action-btn, .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
        padding: 0.4rem;
    }
    /* Hero section optimizations */
    .hero-title {
        font-size: 1.4rem !important;
    }
    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    /* Book cards optimizations */
    .book-card {
        height: auto;
        min-height: 190px;
        padding: 1rem;
    }
    .book-card-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Lucide Vector Icons Styling */
.lucide {
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: 20px;
    stroke-width: 2px;
}
.btn-icon {
    width: 16px;
    height: 16px;
    margin-left: 6px;
    display: inline-block;
    vertical-align: -2px;
}
.logo-icon .lucide {
    width: 22px !important;
    height: 22px !important;
    stroke: var(--accent-purple);
}
.theme-toggle .lucide {
    width: 20px;
    height: 20px;
}
.stat-icon .lucide {
    width: 32px;
    height: 32px;
    stroke: var(--accent-purple);
}
.search-icon .lucide {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}
.act-btn .btn-icon {
    margin-left: 4px;
    vertical-align: -3px;
}

/* Bookmark Cards & Lists */
.bookmark-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: auto !important;
    overflow: visible !important;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.bookmark-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-purple);
    box-shadow: var(--shadow-sm);
}
.bookmark-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}
.bookmark-book-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--accent-purple);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bookmark-snippet {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: 'Abo-Thar-Brackets-ASCII', 'Abo-Thar', 'Abo-thar', 'Abo Thar', 'Abo thar', 'ABO-THAR', 'Abothar', 'Abo_Thar', 'Abo_thar', 'NewSymbolFont', 'New Symbol Font', 'Abo-Thar Regular', 'Abo-thar Regular', 'Abo Thar Regular', 'NewSymbolFont Regular', 'Amiri', 'Cairo', serif;
}
.bookmark-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
body.light-theme .bookmark-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.bookmark-page-badge {
    font-family: 'Amiri', serif;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.act-btn.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* Remove icon margin when no text label is present */
.act-btn.btn-icon-only .lucide,
.act-btn.btn-icon-only .btn-icon {
    margin-left: 0 !important;
    vertical-align: middle !important;
}

/* Floating Action Button (FAB) */
.fab-btn {
    position: fixed;
    bottom: 2rem;
    left: 2rem; /* Floating on bottom-left in RTL */
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 900;
    transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.fab-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.fab-btn .lucide {
    width: 24px;
    height: 24px;
    margin: 0 !important;
}

body.light-theme .fab-btn {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.fab-btn.open {
    transform: rotate(45deg);
    background: var(--accent-cyan);
}

.fab-btn.open:hover {
    transform: rotate(45deg) scale(1.05);
}

/* Floating Action Button Popover Menu (Speed Dial) */
.fab-menu {
    position: fixed;
    bottom: 6rem; /* Places it 0.5rem above the 56px FAB */
    left: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 901;
    min-width: 150px;
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    transform-origin: bottom left;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
}

.fab-menu.show {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: right;
    width: 100%;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.fab-menu-item:hover {
    background-color: rgba(var(--accent-rgb), 0.12);
    color: var(--accent-purple);
}

.fab-menu-item svg,
.fab-menu-item i {
    width: 18px;
    height: 18px;
    color: var(--accent-purple);
    stroke-width: 2.2px;
    margin: 0 !important;
}

body.light-theme .fab-menu {
    background-color: rgba(252, 248, 240, 0.9); /* Warm Sepia Cream with glass effect */
    border-color: rgba(197, 160, 89, 0.25);
    box-shadow: 0 10px 30px rgba(141, 110, 55, 0.15);
}


/* Skeleton Loading Shimmer Effect */
.skeleton-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-right: 4px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    height: 190px;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    position: relative;
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    padding: 1.2rem;
    box-sizing: border-box;
}

.skeleton-cover {
    display: none;
}

.skeleton-info {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.skeleton-title {
    height: 20px;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, rgba(255, 255, 255, 0.05) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
    width: 85%;
    margin-bottom: 0.75rem;
}

.skeleton-meta {
    height: 14px;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, rgba(255, 255, 255, 0.05) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
    width: 60%;
    margin-bottom: 0.5rem;
}

.skeleton-meta-small {
    height: 14px;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, rgba(255, 255, 255, 0.05) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
    width: 40%;
}

body.light-theme .skeleton-cover,
body.light-theme .skeleton-title,
body.light-theme .skeleton-meta,
body.light-theme .skeleton-meta-small {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, rgba(0, 0, 0, 0.03) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Login Page Card Design */
.login-card-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 1.5rem;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    width: 64px;
    height: 64px;
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--accent-purple);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.75rem;
    box-shadow: 0 4px 20px rgba(var(--accent-rgb), 0.1);
    border: 1px solid rgba(var(--accent-rgb), 0.15);
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.login-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

body.light-theme .login-input {
    background-color: rgba(255, 255, 255, 0.4);
}

.login-input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.password-input-wrapper input {
    width: 100%;
    padding: 0.8rem 1rem;
    padding-left: 3rem; /* Leave room for toggle button on the left (RTL end) */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

body.light-theme .password-input-wrapper input {
    background-color: rgba(255, 255, 255, 0.4);
}

.password-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.toggle-password-btn {
    position: absolute;
    left: 10px; /* Place on the left since text flows right-to-left in RTL */
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    transition: color var(--transition-fast);
}

.toggle-password-btn:hover {
    color: var(--text-primary);
}

/* Hide native browser password reveal buttons */
input::-ms-reveal,
input::-ms-clear {
    display: none !important;
}

/* Custom Checkbox for Login Options */
.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

#forgot-password-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

#forgot-password-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.checkbox-container {
    display: block;
    position: relative;
    padding-right: 28px;
    margin-bottom: 0;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    user-select: none;
    transition: color var(--transition-fast);
}

.checkbox-container:hover {
    color: var(--text-primary);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all var(--transition-fast);
}

body.light-theme .checkmark {
    background-color: rgba(255, 255, 255, 0.4);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-purple) !important;
    border-color: var(--accent-purple);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    right: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.login-submit-btn {
    width: 100%;
    justify-content: center;
    padding: 0.8rem;
    font-size: 1rem;
    margin-top: 1.5rem;
}

/* Light Theme Dashboard overrides - Pure High-Contrast Modern Slate Look */
body.light-theme .dashboard-layout {
    background-color: #f1f5f9;
}

body.light-theme .dashboard-sidebar {
    background-color: #ffffff;
    border-color: #cbd5e1;
}

body.light-theme .dashboard-topbar {
    background-color: #ffffff;
    border-color: #cbd5e1;
}

body.light-theme .dashboard-panel {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

body.light-theme .stat-card {
    background-color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #cbd5e1;
}

body.light-theme .dashboard-content-card {
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid #cbd5e1;
}

/* Dark Theme Dashboard contrast enhancements */
body.dark-theme .dashboard-panel,
body.dark-theme .stat-card,
body.dark-theme .dashboard-content-card,
body.dark-theme .admin-book-card {
    background-color: #1e1e1e !important;
    border: 1px solid #333333 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
}

/* Admin Books Grid Layout & Card Styles */
.admin-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}
.admin-book-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    height: 260px;
    position: relative;
    box-shadow: var(--shadow-sm);
}
body.light-theme .admin-book-card {
    background-color: #f8fafc;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    border-color: #cbd5e1;
}
.admin-book-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-purple);
    box-shadow: var(--shadow-md);
}
.admin-book-header {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}
.admin-book-category {
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent-pink);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(var(--accent-rgb), 0.2);
}
body.light-theme .admin-book-category {
    background: rgba(49, 151, 149, 0.08);
    color: var(--accent-purple);
    border: 1px solid rgba(49, 151, 149, 0.2);
}
.admin-book-meta-pages {
    margin-top: 0.5rem;
    color: var(--accent-pink);
    font-weight: 700;
    font-size: 0.85rem;
}
body.light-theme .admin-book-meta-pages {
    color: var(--accent-purple);
}
.admin-book-details {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.admin-book-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-primary);
}
.admin-book-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.admin-book-actions {
    display: flex;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.05);
}
body.light-theme .admin-book-actions {
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
}
body.dark-theme .admin-book-card {
    background-color: #161616 !important;
    border: 1px solid #333333 !important;
}
body.dark-theme .admin-book-actions {
    background-color: #242424 !important;
    border-top: 1px solid #383838 !important;
}
.admin-action-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}
.admin-action-btn:not(:last-child) {
    border-left: 1px solid var(--border-color);
}
.admin-action-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}
body.light-theme .admin-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Premium Table Action Buttons matching theme-toggle shape */
.table-action-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex: none !important;
    padding: 0 !important;
}
body.light-theme .table-action-btn {
    background: rgba(0, 0, 0, 0.02);
}
.table-action-btn:hover {
    transform: scale(1.05);
    color: var(--text-primary);
}
.table-action-btn.btn-edit:hover {
    border-color: var(--accent-purple);
    background-color: rgba(var(--accent-rgb), 0.08);
    color: var(--accent-purple);
}
body.light-theme .table-action-btn.btn-edit:hover {
    background-color: rgba(180, 145, 76, 0.08);
}
.table-action-btn.btn-delete:hover {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}
.table-action-btn.btn-visibility:hover {
    border-color: var(--accent-cyan);
    background-color: rgba(6, 182, 212, 0.08);
    color: var(--accent-cyan);
}

.admin-action-btn.btn-drag-handle {
    cursor: grab;
}
.admin-action-btn.btn-drag-handle:active {
    cursor: grabbing;
}
.admin-action-btn.btn-drag-handle:hover {
    color: #f59e0b; /* Golden hover style for grab handle */
}
.admin-book-card.dragging {
    opacity: 0.4;
    border: 2px dashed var(--accent-purple);
    transform: scale(0.98);
}
.admin-book-card.drag-over {
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4) !important;
}
.role-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
}
/* Admin / مدير (Sepia/Bronze Gold theme) */
.role-badge.role-admin {
    background-color: rgba(212, 175, 55, 0.15);
    color: #f3d078;
    border-color: rgba(212, 175, 55, 0.25);
}
body.light-theme .role-badge.role-admin {
    background-color: rgba(178, 141, 55, 0.1);
    color: #8d6e37;
    border-color: rgba(178, 141, 55, 0.15);
}
/* Editor / محرر (Emerald/Green theme) */
.role-badge.role-editor {
    background-color: rgba(var(--accent-rgb), 0.15);
    color: #34d399;
    border-color: rgba(var(--accent-rgb), 0.25);
}
body.light-theme .role-badge.role-editor {
    background-color: rgba(5, 150, 105, 0.08);
    color: #047857;
    border-color: rgba(5, 150, 105, 0.15);
}
/* Supervisor / مشرف (Cyan/Blue theme) */
.role-badge.role-supervisor {
    background-color: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border-color: rgba(6, 182, 212, 0.25);
}
body.light-theme .role-badge.role-supervisor {
    background-color: rgba(8, 145, 178, 0.08);
    color: #0e7490;
    border-color: rgba(8, 145, 178, 0.15);
}

body.light-theme .modal-container {
    background-color: #ffffff;
    border-color: rgba(197, 160, 89, 0.35);
    box-shadow: 0 10px 40px rgba(197, 160, 89, 0.15);
}

/* Custom Select Dropdown Components */
.custom-select {
    position: relative;
    width: 100%;
}
.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}
.custom-select-trigger:hover {
    border-color: var(--accent-cyan);
}
.custom-select.open .custom-select-trigger {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}
.custom-select-icon {
    display: flex;
    align-items: center;
    color: var(--accent-purple);
    margin-left: 0.75rem;
}
.custom-select-icon svg {
    width: 18px;
    height: 18px;
}
.custom-select-text {
    flex: 1;
    text-align: right;
}
.custom-select-arrow {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: transform var(--transition-fast), color var(--transition-fast);
}
.custom-select-arrow svg {
    width: 16px;
    height: 16px;
}
.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
    color: var(--accent-cyan);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    z-index: 1000;
    max-height: 200px; /* Reduced height as requested by user */
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.custom-select.open .custom-select-options {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.custom-option {
    display: flex;
    align-items: center;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    color: var(--text-secondary);
}
.custom-option:hover {
    background-color: rgba(var(--accent-rgb), 0.08);
    color: var(--text-primary);
}
body.light-theme .custom-option:hover {
    background-color: rgba(180, 145, 76, 0.08);
}
.custom-option.selected {
    background-color: rgba(var(--accent-rgb), 0.12);
    color: var(--accent-purple);
    font-weight: 600;
}
body.light-theme .custom-option.selected {
    background-color: rgba(180, 145, 76, 0.12);
}
.option-icon {
    display: flex;
    align-items: center;
    margin-left: 0.75rem;
    color: inherit;
}
.option-icon svg {
    width: 16px;
    height: 16px;
}
.option-text {
    flex: 1;
    text-align: right;
}

.custom-select-options::-webkit-scrollbar {
    width: 6px;
}
.custom-select-options::-webkit-scrollbar-track {
    background: transparent;
}
.custom-select-options::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
body.light-theme .custom-select-options::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

.clear-search-btn {
    transition: color var(--transition-fast);
}
.clear-search-btn:hover {
    color: #ef4444 !important;
}

/* Admin Unified Search Box */
.admin-search-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
    max-width: 360px;
    height: 40px;
    transition: all var(--transition-fast);
    overflow: hidden;
}
.admin-search-box:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}
.admin-search-box .search-icon {
    font-size: 1rem;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    color: var(--text-muted);
}
.admin-search-box .search-icon .lucide {
    width: 16px;
    height: 16px;
}
.admin-search-box input,
.admin-search-box input[type="text"] {
    flex: 1;
    background: none !important;
    border: none !important;
    outline: none !important;
    color: var(--text-primary) !important;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 0.5rem 0.25rem 0.5rem 0.5rem;
    width: 100%;
    box-shadow: none !important;
    border-radius: 0 !important;
    height: 100%;
}
.clear-search-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
}

/* Voice Search Button */
.voice-search-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.voice-search-btn:hover {
    color: var(--accent-purple);
    transform: scale(1.1);
}
.voice-search-btn.listening {
    color: #ef4444 !important;
    animation: voicePulse 1.5s infinite ease-in-out;
}

@keyframes voicePulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.8)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)); }
}

/* Custom Upload Zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}
body.light-theme .upload-zone {
    background-color: rgba(0, 0, 0, 0.01);
}
.upload-zone:hover {
    border-color: var(--accent-purple);
    background-color: rgba(var(--accent-rgb), 0.04);
}
.upload-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
}
.upload-icon .lucide {
    width: 32px;
    height: 32px;
    color: var(--accent-purple);
    margin-bottom: 0.25rem;
}
.upload-text {
    font-size: 0.9rem;
    font-weight: 600;
}
.upload-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.upload-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}
.upload-cover-preview {
    max-height: 140px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}
.remove-preview-btn {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition-fast);
}
.remove-preview-btn:hover {
    background-color: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* ==========================================================================
   MODERN DASHBOARD LAYOUT & COLLAPSIBLE SIDEBAR STYLE
   ========================================================================== */

/* View styling to prevent top gap in full-screen dashboard section */
#view-dashboard {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 995;
    background-color: var(--bg-primary);
    overflow: hidden;
}

/* Dashboard Layout Wrapper */
.dashboard-layout {
    display: flex;
    height: 100%;
    width: 100%;
    background-color: var(--bg-primary);
    position: relative;
    overflow-x: hidden;
}


/* Sidebar Structure */
.dashboard-sidebar {
    width: 240px;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: width var(--transition-normal);
    overflow: hidden;
    flex-shrink: 0;
}

/* Sidebar Collapse State */
.dashboard-sidebar.collapsed {
    width: 70px;
}

/* Sidebar Logo/Header with Perfect Baseline Alignment */
.dashboard-sidebar .sidebar-header {
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    height: 70px;
    box-sizing: border-box;
}

.dashboard-sidebar .sidebar-header .logo-area {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: 100%;
}

.dashboard-sidebar .sidebar-header .logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-purple);
    font-size: 1.4rem;
}

.dashboard-sidebar .sidebar-header .logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    margin: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.dashboard-sidebar.collapsed .logo-area {
    justify-content: center;
    margin: 0 auto;
}

.dashboard-sidebar.collapsed .logo-text {
    display: none;
}

.dashboard-sidebar .btn-collapse-link .lucide {
    transition: transform var(--transition-normal);
}

.dashboard-sidebar.collapsed .btn-collapse-link .lucide {
    transform: rotate(180deg);
}

/* Navigation Links */
.dashboard-sidebar .sidebar-nav {
    padding: 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    justify-content: flex-start;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 1rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    width: 100%;
    text-align: right;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.sidebar-link:hover {
    color: var(--text-primary);
    background-color: rgba(var(--accent-rgb), 0.08);
}

body.light-theme .sidebar-link:hover {
    color: var(--text-primary);
    background-color: rgba(49, 151, 149, 0.08);
}

.sidebar-link.active {
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.2);
}

.sidebar-link.active:hover {
    color: #ffffff !important;
    background: var(--accent-hover-gradient, var(--accent-cyan)) !important;
    box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.35) !important;
}

body.light-theme .sidebar-link.active:hover {
    color: #ffffff !important;
    background: var(--accent-hover-gradient, var(--accent-cyan)) !important;
    box-shadow: 0 4px 14px rgba(49, 151, 149, 0.25) !important;
}

.dashboard-sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 0.55rem 0.8rem;
    gap: 0;
}

.dashboard-sidebar.collapsed .sidebar-link .link-text {
    display: none;
}

/* Sidebar Footer */
.dashboard-sidebar .sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Main content frame */
.dashboard-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevents flex items from overflowing */
}

/* Dashboard Topbar */
.dashboard-topbar {
    height: 70px;
    box-sizing: border-box;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 990;
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
}

#dashboard-view-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    color: var(--text-primary);
}

/* Topbar content styling */
.dashboard-body {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

/* Tab display toggles */
.db-tab-content {
    animation: fadeIn var(--transition-normal);
}

/* Responsive sidebar drawers for mobile */
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }
    
    .dashboard-main {
        max-width: 100% !important;
    }
    
    .dashboard-sidebar {
        position: fixed;
        right: -240px;
        transition: right var(--transition-normal);
        height: 100vh;
    }
    
    .dashboard-sidebar.open {
        right: 0;
    }
    
    .dashboard-sidebar.collapsed {
        width: 240px; /* Disable collapsed state width on mobile, draw full size */
    }
    
    .dashboard-sidebar.collapsed .logo-text,
    .dashboard-sidebar.collapsed .sidebar-link .link-text {
        display: block !important;
    }
    
    .dashboard-sidebar .btn-collapse-link {
        display: none !important; /* Hide collapse toggle button on mobile */
    }
    
    .dashboard-topbar {
        padding: 0 1rem;
    }
    
    .dashboard-body {
        padding: 1.25rem 1rem;
    }
    
    .btn-visit-text {
        display: none;
    }
    
    .btn-visit-site {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        padding: 0;
        gap: 0;
        justify-content: center;
    }
    
    .btn-visit-site .lucide {
        width: 20px !important;
        height: 20px !important;
    }
    
    #dashboard-view-title {
        max-width: 150px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    #dashboard-view-title {
        max-width: 100px;
    }
}

/* Welcome Card Premium Styling */
.welcome-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}
.welcome-icon-wrapper {
    background-color: rgba(var(--accent-rgb), 0.12);
    color: var(--accent-purple);
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}
body.light-theme .welcome-icon-wrapper {
    background-color: rgba(49, 151, 149, 0.1);
    border-color: rgba(49, 151, 149, 0.2);
}
.welcome-card:hover .welcome-icon-wrapper {
    transform: scale(1.08) rotate(5deg);
    background-color: rgba(var(--accent-rgb), 0.18);
}
body.light-theme .welcome-card:hover .welcome-icon-wrapper {
    background-color: rgba(49, 151, 149, 0.18);
}

/* Layout and Responsiveness fixes to prevent horizontal clipping in RTL dashboard */
.dashboard-layout {
    overflow-x: hidden;
    max-width: 100%;
}
.dashboard-main {
    max-width: calc(100% - 240px);
    width: 100%;
}
.dashboard-sidebar.collapsed + .dashboard-main {
    max-width: calc(100% - 70px);
}
@media (max-width: 768px) {
    .dashboard-main {
        max-width: 100%;
    }
}
.dashboard-body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Premium themed scroll-margin-top shadow fix */
body.light-theme .sidebar-link.active {
    box-shadow: 0 4px 12px rgba(49, 151, 149, 0.2);
}

/* Pages Table Drag & Drop Styling */
.page-drag-handle[draggable="true"] {
    cursor: move;
    cursor: -webkit-grab;
    cursor: grab;
}
.pages-table tr.dragging {
    opacity: 0.5;
    background-color: rgba(var(--accent-rgb), 0.08) !important;
    border: 2px dashed var(--accent-purple);
}
.pages-table tr.drag-over {
    border-bottom: 2px solid var(--accent-purple) !important;
    background-color: rgba(6, 182, 212, 0.08) !important;
}
.page-drag-handle {
    color: var(--text-muted);
    font-size: 1.1rem;
    text-align: center;
    cursor: grab;
    user-select: none;
}
.page-drag-handle:active {
    cursor: grabbing;
}
.page-drag-handle svg {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
}

/* --- Advanced Search System Styles --- */

.search-highlight {
    background: #fde047 !important; /* Bright highlighter yellow */
    color: #000000 !important; /* High contrast black text */
    border-radius: 4px;
    padding: 0 4px;
    box-shadow: 0 0 8px rgba(253, 224, 71, 0.3);
    display: inline;
    animation: highlightPulse 1.5s infinite alternate;
}
body.light-theme .search-highlight {
    background: #fef08a !important; /* Slightly softer highlighter yellow */
    color: #000000 !important;
    box-shadow: 0 0 8px rgba(254, 240, 138, 0.25);
}

.search-highlight-active {
    background: linear-gradient(120deg, #ef4444 0%, #ff6b6b 100%) !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4) !important;
    color: #fff !important;
}

@keyframes highlightPulse {
    from { box-shadow: 0 0 4px rgba(253, 224, 71, 0.2); }
    to { box-shadow: 0 0 10px rgba(253, 224, 71, 0.5); }
}

/* Global search snippet cards */
.search-result-snippet-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-right: 4px solid var(--accent-purple);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.search-result-snippet-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-cyan);
    background-color: rgba(255, 255, 255, 0.01);
    box-shadow: var(--shadow-sm);
}
body.light-theme .search-result-snippet-card:hover {
    background-color: rgba(0, 0, 0, 0.015);
}

.search-result-snippet-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.search-result-page-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent-purple);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Amiri', 'Cairo', serif !important;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(var(--accent-rgb), 0.08);
}
body.light-theme .search-result-page-badge {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent-purple);
    border-color: rgba(var(--accent-rgb), 0.22);
}
#global-search-status,
#reader-search-status {
    text-align: center !important;
}
.search-result-num,
.search-result-page-num,
.num-bannoor {
    font-family: 'Amiri', 'Cairo', serif !important;
    font-weight: 700 !important;
    color: var(--accent-purple);
    margin: 0 0.15rem;
}
.search-result-snippet-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-family: 'Amiri', 'Cairo', serif;
    line-height: 1.6;
}

/* Scrollbar customization for search wrapper inside modal */
.search-results-wrapper::-webkit-scrollbar,
.reader-search-results-wrapper::-webkit-scrollbar {
    width: 6px;
}
.search-results-wrapper::-webkit-scrollbar-track,
.reader-search-results-wrapper::-webkit-scrollbar-track {
    background: transparent;
}
.search-results-wrapper::-webkit-scrollbar-thumb,
.reader-search-results-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}
body.light-theme .search-results-wrapper::-webkit-scrollbar-thumb,
body.light-theme .reader-search-results-wrapper::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 89, 0.25);
}

/* Voice search input specific overrides inside modals */
.modal-body .search-box {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
}
.modal-body .search-box:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}

/* Reading Progress System */
.book-progress-wrapper {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
}
.book-progress-bar-bg {
    height: 6px;
    background-color: rgba(var(--accent-rgb), 0.12);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    width: 100%;
}
body.light-theme .book-progress-bar-bg {
    background-color: rgba(180, 145, 76, 0.12);
}
.book-progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: width 0.4s ease-out;
}
.book-progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    font-weight: 500;
}

.reader-resume-banner {
    font-family: 'Cairo', 'Segoe UI', Roboto, Tahoma, sans-serif;
    background-color: var(--bg-secondary);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    border-right: 4px solid var(--accent-purple);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    margin-bottom: 1rem;
    transition: all var(--transition-normal);
    animation: slideDown 0.3s ease-out;
    width: 100%;
    box-shadow: var(--shadow-sm);
}
body.light-theme .reader-resume-banner {
    background-color: #fef2f2; /* Soft red alert background */
    border-color: #fee2e2;
    border-right-color: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.05);
}
body.light-theme .resume-banner-text {
    color: #991b1b;
}
body.light-theme .resume-banner-icon {
    color: #dc2626;
}
body.light-theme .resume-banner-reset-btn {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
}
body.light-theme .resume-banner-reset-btn:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}
body.light-theme .resume-banner-close-btn {
    color: #dc2626;
    opacity: 0.7;
}
body.light-theme .resume-banner-close-btn:hover {
    color: #7f1d1d;
    opacity: 1;
}

/* Sepia Theme Resume Banner (Identical to light theme red alert banner) */
body.sepia-theme .reader-resume-banner {
    background-color: #fef2f2;
    border-color: #fee2e2;
    border-right-color: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.05);
}
body.sepia-theme .resume-banner-text {
    color: #991b1b;
}
body.sepia-theme .resume-banner-icon {
    color: #dc2626;
}
body.sepia-theme .resume-banner-reset-btn {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2);
}
body.sepia-theme .resume-banner-reset-btn:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}
body.sepia-theme .resume-banner-close-btn {
    color: #dc2626;
    opacity: 0.7;
}
body.sepia-theme .resume-banner-close-btn:hover {
    color: #7f1d1d;
    opacity: 1;
}

body.dark-theme .reader-resume-banner {
    background-color: #2d1a1a; /* Dark red alert background */
    border-color: #451e1e;
    border-right-color: #ef4444;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
body.dark-theme .resume-banner-text {
    color: #fca5a5;
}
body.dark-theme .resume-banner-icon {
    color: #ef4444;
}
body.dark-theme .resume-banner-reset-btn {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
}
body.dark-theme .resume-banner-reset-btn:hover {
    background: #f87171;
    border-color: #f87171;
}
body.dark-theme .resume-banner-close-btn {
    color: #fca5a5;
    opacity: 0.7;
}
body.dark-theme .resume-banner-close-btn:hover {
    color: #ffffff;
    opacity: 1;
}
.resume-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-sans);
}
.resume-banner-icon {
    display: flex;
    align-items: center;
    color: var(--accent-purple);
    flex-shrink: 0;
}
.resume-banner-icon svg {
    width: 16px;
    height: 16px;
}
.resume-banner-text {
    font-family: 'Cairo', 'Segoe UI', Roboto, Tahoma, sans-serif !important;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.resume-page-num {
    font-family: 'Amiri', serif !important;
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0 4px;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}
.resume-banner-reset-btn {
    background: var(--accent-gradient);
    color: #fff;
    border: 1px solid var(--accent-purple);
    padding: 0.25rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Cairo', 'Segoe UI', Roboto, Tahoma, sans-serif;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 6px rgba(var(--accent-rgb), 0.15);
    flex-shrink: 0;
    white-space: nowrap;
}
body.dark-theme .resume-banner-reset-btn {
    color: #ffffff;
}
.resume-banner-reset-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(var(--accent-rgb), 0.25);
    opacity: 0.9;
}
.resume-banner-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    transition: color var(--transition-fast);
    flex-shrink: 0;
}
.resume-banner-close-btn:hover {
    color: var(--text-primary);
}
.resume-banner-close-btn svg {
    width: 16px;
    height: 16px;
}

/* Responsive design for resume banner */
@media (max-width: 576px) {
    .reader-resume-banner {
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
        margin-bottom: 0.75rem;
    }
    .resume-banner-content {
        gap: 0.5rem;
    }
    .resume-banner-text {
        font-size: 0.8rem;
    }
    .resume-banner-reset-btn {
        padding: 0.3rem 0.65rem;
        font-size: 0.75rem;
        border-radius: 5px;
    }
    .resume-banner-icon svg {
        width: 14px;
        height: 14px;
    }
    .resume-banner-close-btn svg {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 420px) {
    .reader-resume-banner {
        padding: 0.4rem 0.5rem;
    }
    .resume-banner-content {
        gap: 0.35rem;
    }
    .resume-banner-icon {
        display: none; /* Hide icon on very small viewports to save space */
    }
    .resume-banner-text {
        font-size: 0.72rem;
    }
    .resume-banner-reset-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 360px) {
    .logo-text {
        font-size: 0.92rem;
    }
    .navbar-container {
        padding: 0.8rem 0.75rem;
    }
}

@media (max-width: 330px) {
    .logo-text {
        font-size: 0.85rem;
    }
    .navbar-container {
        padding: 0.8rem 0.6rem;
        gap: 0.35rem;
    }
    .nav-btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.5rem;
    }
}

/* Media Library styles */
.media-breadcrumbs span {
    cursor: pointer;
    transition: color 0.2s ease;
}
.media-breadcrumbs span:hover {
    color: var(--accent-purple);
}
.media-breadcrumbs .breadcrumb-sep {
    color: var(--text-muted);
    cursor: default !important;
}

.folder-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(var(--accent-rgb), 0.02) 100%);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.85rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.folder-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-purple);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.folder-card:hover {
    transform: translateY(-3px);
    border-color: rgba(var(--accent-rgb), 0.4);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(var(--accent-rgb), 0.07) 100%);
}

.folder-card:hover::before {
    opacity: 1;
}

.folder-icon-wrapper {
    background-color: rgba(var(--accent-rgb), 0.1);
    border: 1px solid rgba(var(--accent-rgb), 0.15);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-purple);
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.folder-card:hover .folder-icon-wrapper {
    transform: scale(1.08);
    background-color: rgba(var(--accent-rgb), 0.18);
    color: var(--accent-pink);
    border-color: rgba(var(--accent-rgb), 0.3);
}

body.light-theme .folder-icon-wrapper {
    background-color: rgba(49, 151, 149, 0.08);
    border-color: rgba(49, 151, 149, 0.15);
}

body.light-theme .folder-card:hover .folder-icon-wrapper {
    background-color: rgba(49, 151, 149, 0.15);
}

.folder-name-text {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
    flex: 1;
    text-align: right;
}

.folder-card:hover .folder-name-text {
    color: var(--accent-purple);
}

/* File icons coloring */
.file-icon-folder {
    color: var(--accent-purple);
}
.file-icon-pdf {
    color: #ef4444; /* Red */
}
.file-icon-word {
    color: #3b82f6; /* Blue */
}
.file-icon-image {
    color: var(--accent-purple); /* Gold/Sepia */
}
.file-icon-audio {
    color: #10b981; /* Green */
}
.file-icon-video {
    color: #8b5cf6; /* Purple */
}
.file-icon-other {
    color: var(--text-muted);
}

.media-thumbnail-preview {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.media-selector-layout {
    padding-right: 0.5rem;
}

/* Image selection card in modal */
.media-select-image-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    aspect-ratio: 3/4;
    display: flex;
    flex-direction: column;
}
.media-select-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.media-select-image-card:hover {
    transform: scale(1.03);
    border-color: var(--accent-purple);
    box-shadow: 0 8px 20px rgba(200, 160, 89, 0.2);
}
.media-select-image-card:hover img {
    transform: scale(1.05);
}
.media-select-image-card .image-card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(4px);
    padding: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid var(--border-color);
}

.empty-state-media {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
}
.empty-state-media i {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

/* Cover Upload Container & Button Overlays */
.cover-upload-container {
    position: relative;
    width: 140px;
    height: 185px;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.02);
}
.cover-upload-container #book-cover-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cover-upload-container .upload-cover-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    background: rgba(10, 14, 23, 0.75);
    backdrop-filter: blur(4px);
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: background 0.2s ease;
}
.cover-upload-container .upload-cover-btn:hover {
    background: var(--accent-purple);
    color: #fff;
}
.select-from-media-icon-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(10, 14, 23, 0.75);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}
.select-from-media-icon-btn:hover {
    background: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
    transform: scale(1.1);
}
.select-from-media-icon-btn i {
    width: 14px;
    height: 14px;
}

/* Book Modal 2-Column Layout styles */
.book-modal-layout {
    display: flex;
    flex-direction: row-reverse; /* RTL layout: fields right, cover left */
    gap: 1.75rem;
    align-items: center; /* Center vertically to align shorter cover card perfectly */
    margin-bottom: 0.5rem;
}

.book-modal-fields-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.book-modal-fields-column .form-group {
    margin-bottom: 0 !important; /* Reset margins inside column to let flex gap control spacing equally */
}

.book-modal-cover-column {
    width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.book-modal-cover-column .form-group {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.book-cover-selection-card {
    position: relative;
    aspect-ratio: 3/4.2;
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
    border-radius: 14px;
    overflow: hidden;
    border: 2px dashed rgba(var(--accent-rgb), 0.4);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.book-cover-selection-card.compact {
    max-width: 130px; /* Reduced from 140px */
    height: 175px; /* Reduced from 185px for a compact layout */
    aspect-ratio: auto;
    flex: none;
}

body.light-theme .book-cover-selection-card {
    background: rgba(49, 151, 149, 0.05);
    border-color: rgba(49, 151, 149, 0.3);
}

.book-cover-selection-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
    display: block;
}

.book-cover-selection-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-purple);
    box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.2);
}

.cover-selection-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 23, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: #ffffff;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
    text-align: center;
}

.book-cover-selection-card:hover .cover-selection-overlay {
    opacity: 1;
}

.book-cover-selection-card:hover img {
    filter: blur(2px) brightness(0.6);
}

.cover-selection-overlay i {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
    display: block;
}

.cover-selection-overlay i svg,
.cover-selection-overlay svg {
    width: 36px !important;
    height: 36px !important;
    stroke: var(--accent-purple) !important;
    stroke-width: 2.2px !important; /* Bold visible stroke */
    margin: 0 auto;
}

body.light-theme .cover-selection-overlay i svg,
body.light-theme .cover-selection-overlay svg {
    stroke: var(--accent-cyan) !important;
}

.cover-selection-overlay span {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-purple) !important;
    display: block;
}

body.light-theme .cover-selection-overlay span {
    color: var(--accent-cyan) !important;
}

/* Styles for when there is no cover image assigned */
.book-cover-selection-card.no-cover .cover-selection-overlay {
    opacity: 1;
    background: rgba(255, 255, 255, 0.01);
}

body.light-theme .book-cover-selection-card.no-cover .cover-selection-overlay {
    background: rgba(197, 160, 89, 0.01);
}

.book-cover-selection-card.no-cover img {
    opacity: 0;
}

/* Delete cover image button in top right corner */
.remove-cover-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 20;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.book-cover-selection-card:not(.no-cover) .remove-cover-btn {
    opacity: 1;
    pointer-events: auto;
}

.remove-cover-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.remove-cover-btn i,
.remove-cover-btn svg {
    width: 14px !important;
    height: 14px !important;
    stroke: currentColor !important;
    stroke-width: 3px !important;
    margin: 0 !important;
}

/* Responsive adjust for mobile screens */
@media (max-width: 620px) {
    .book-modal-layout {
        flex-direction: column !important;
        gap: 1.5rem;
        align-items: stretch;
    }
    .book-modal-cover-column {
        width: 100%;
        order: -1; /* Display cover preview above fields on mobile */
        margin-bottom: 0.5rem;
        align-items: center;
    }
    .book-cover-selection-card {
        max-width: 180px;
    }
    .book-cover-selection-card.compact {
        max-width: 140px;
        aspect-ratio: 3/4.2; /* restore aspect-ratio on mobile so it does not collapse or stretch weirdly */
    }
}

.ext-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    background-color: rgba(var(--accent-rgb), 0.1);
    color: var(--accent-purple);
    border: 1px solid rgba(var(--accent-rgb), 0.15);
    text-transform: uppercase;
    font-family: monospace;
}
body.light-theme .ext-badge {
    background-color: rgba(197, 160, 89, 0.08);
    border-color: rgba(197, 160, 89, 0.15);
    color: #8d6e37;
}

.type-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
}

/* Folder / مجلد */
.type-badge.type-folder {
    background-color: rgba(var(--accent-rgb), 0.15);
    color: var(--accent-pink);
    border-color: rgba(var(--accent-rgb), 0.25);
}
body.light-theme .type-badge.type-folder {
    background-color: #e6fffa;
    color: #2c7a7b;
    border-color: #b2f5ea;
}

/* Image / صورة */
.type-badge.type-image {
    background-color: rgba(234, 179, 8, 0.15);
    color: #fef08a;
    border-color: rgba(234, 179, 8, 0.25);
}
body.light-theme .type-badge.type-image {
    background-color: rgba(202, 138, 4, 0.08);
    color: #854d0e;
    border-color: rgba(202, 138, 4, 0.15);
}

/* PDF / PDF */
.type-badge.type-pdf {
    background-color: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.25);
}
body.light-theme .type-badge.type-pdf {
    background-color: rgba(220, 38, 38, 0.08);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.15);
}

/* Word / Word */
.type-badge.type-word {
    background-color: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.25);
}
body.light-theme .type-badge.type-word {
    background-color: rgba(37, 99, 235, 0.08);
    color: #1e40af;
    border-color: rgba(37, 99, 235, 0.15);
}

/* Audio / صوت */
.type-badge.type-audio {
    background-color: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.25);
}
body.light-theme .type-badge.type-audio {
    background-color: rgba(5, 150, 105, 0.08);
    color: #065f46;
    border-color: rgba(5, 150, 105, 0.15);
}

/* Video / فيديو */
.type-badge.type-video {
    background-color: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    border-color: rgba(139, 92, 246, 0.25);
}
body.light-theme .type-badge.type-video {
    background-color: rgba(124, 58, 237, 0.08);
    color: #5b21b6;
    border-color: rgba(124, 58, 237, 0.15);
}

/* Other / أخرى */
.type-badge.type-other {
    background-color: rgba(107, 114, 128, 0.15);
    color: #d1d5db;
    border-color: rgba(107, 114, 128, 0.25);
}
body.light-theme .type-badge.type-other {
    background-color: rgba(75, 85, 99, 0.08);
    color: #374151;
    border-color: rgba(75, 85, 99, 0.15);
}

/* Loading Overlay for Auth State Checks */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-spinner {
    width: 55px;
    height: 55px;
    border: 3.5px solid rgba(var(--accent-rgb), 0.15);
    border-radius: 50%;
    border-top-color: var(--accent-purple);
    animation: spinLoader 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spinLoader {
    to { transform: rotate(360deg); }
}

/* Selector Modal Two-Pane Table Styles */
.admin-table.select-table tbody tr {
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.admin-table.select-table tbody tr:hover {
    background-color: rgba(var(--accent-rgb), 0.04) !important;
}

.admin-table.select-table tbody tr.selected {
    background-color: rgba(var(--accent-rgb), 0.1) !important;
    box-shadow: inset -4px 0 0 var(--accent-purple);
}

body.light-theme .admin-table.select-table tbody tr.selected {
    background-color: rgba(180, 145, 76, 0.1) !important;
    box-shadow: inset -4px 0 0 var(--accent-purple);
}

/* Image preview container hover card shadow detail */
.preview-card {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.preview-card:hover {
    transform: scale(1.03) translateY(-2px);
    box-shadow: var(--shadow-lg) !important;
}

/* === EDITOR INLINE IMAGES === */
.editor-inline-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: outline var(--transition-fast), box-shadow var(--transition-fast);
}

.editor-inline-image:hover,
.editor-inline-image.selected {
    outline: 2px solid var(--accent-purple);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.2), var(--shadow-md);
}

/* Alignments */
.img-align-center {
    display: block;
    margin: 1.5rem auto;
    clear: both;
}

.img-align-right {
    float: right;
    margin: 0.5rem 0 1rem 1.5rem;
}

.img-align-left {
    float: left;
    margin: 0.5rem 1.5rem 1rem 0;
}

/* Sizes */
.img-size-small {
    width: 25%;
    min-width: 140px;
}

.img-size-medium {
    width: 50%;
    min-width: 260px;
}

.img-size-full {
    width: 100%;
    display: block;
    clear: both;
    margin: 1.5rem 0;
}

/* Clearfix for rich editor to prevent layout breaks when using float */
.rich-editor::after,
.reader-page-content::after {
    content: "";
    display: table;
    clear: both;
}

/* === IMAGE FLOATING TOOLBAR === */
.image-floating-toolbar {
    position: absolute;
    z-index: 2000;
    background: rgba(16, 21, 36, 0.95);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 0.3rem;
    align-items: center;
    direction: rtl;
    animation: fadeInFloating 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

body.light-theme .image-floating-toolbar {
    background: rgba(252, 251, 247, 0.98);
}

.image-floating-toolbar.hidden {
    display: none !important;
}

.image-floating-toolbar .img-tool-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    font-size: 0.82rem;
    font-family: var(--font-sans);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: all var(--transition-fast);
}

.image-floating-toolbar .img-tool-btn:hover {
    color: var(--accent-purple);
    background-color: rgba(var(--accent-rgb), 0.1);
}

.image-floating-toolbar .img-tool-btn.active {
    background-color: var(--accent-purple);
    color: #fff !important;
}

.image-floating-toolbar .tool-separator {
    color: var(--border-color);
    margin: 0 0.15rem;
    font-size: 0.75rem;
    user-select: none;
}

.image-floating-toolbar .btn-delete {
    color: #ef4444;
}

.image-floating-toolbar .btn-delete:hover {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444 !important;
}

.image-floating-toolbar .btn-replace:hover {
    background-color: rgba(var(--accent-rgb), 0.15);
}

@keyframes fadeInFloating {
    from { opacity: 0; transform: translateY(4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* === SIDEBAR AND STATS ICON TWEAKS === */
.sidebar-link i,
.sidebar-link svg,
.sidebar-link .lucide {
    width: 22px !important;
    height: 22px !important;
}

.stat-icon svg,
.stat-icon i,
.stat-icon .lucide {
    width: 38px !important;
    height: 38px !important;
}

/* === MOBILE SIDEBAR OVERLAY === */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 999;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.sidebar-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* === APP SPLASH SCREEN === */
.splash-dismissed #app-splash-screen {
    display: none !important;
}

.splash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-primary);
    background-image: var(--bg-pattern);
    background-repeat: repeat;
    background-size: 40px 40px;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.splash-overlay.dismissed {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    max-width: 600px;
    width: 90%;
    padding: 2rem;
    box-sizing: border-box;
}

.splash-emblem {
    background: rgba(var(--accent-rgb), 0.08);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent-purple);
    margin-bottom: 0.5rem;
    box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.15);
    animation: splashEmblemPulse 2.4s ease-in-out infinite, splashFadeSlideIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
    position: relative;
}

/* Outer ripple ring effect */
.splash-emblem::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1.5px solid var(--accent-purple);
    opacity: 0;
    animation: splashRipple 2.4s ease-in-out infinite;
}

body.light-theme .splash-emblem {
    background: rgba(var(--accent-rgb), 0.06);
}

.splash-icon {
    color: var(--accent-purple);
    width: 36px;
    height: 36px;
    animation: splashIconFloat 3s ease-in-out infinite;
}

.splash-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.splash-title-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-left: 0.5rem;
    color: var(--accent-purple);
    display: inline-block;
}

/* Pulse: gentle scale + glowing shadow breathe */
@keyframes splashEmblemPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.15);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 35px rgba(var(--accent-rgb), 0.35), 0 0 60px rgba(var(--accent-rgb), 0.1);
    }
}

/* Ripple ring expanding outward */
@keyframes splashRipple {
    0% {
        inset: -4px;
        opacity: 0.6;
    }
    70% {
        inset: -18px;
        opacity: 0;
    }
    100% {
        inset: -18px;
        opacity: 0;
    }
}

/* Icon subtle float up/down */
@keyframes splashIconFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.splash-title {
    font-family: var(--font-sans);
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin: 0;
    animation: splashFadeSlideIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.splash-subtitle {
    font-family: var(--font-sans);
    font-size: clamp(1.6rem, 7vw, 2.6rem);
    font-weight: 700;
    color: var(--accent-purple);
    margin: 0;
    white-space: nowrap;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    animation: splashFadeSlideIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both;
}

body:not(.light-theme) .splash-subtitle {
    text-shadow: 0 2px 15px rgba(var(--accent-rgb), 0.25);
}

.splash-divider {
    margin: 0.15rem 0;
    display: flex;
    justify-content: center;
    width: 100%;
    animation: splashFadeSlideIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.65s both;
}

.splash-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0 0 0.25rem 0;
    max-width: 440px;
    animation: splashFadeSlideIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.8s both;
}

/* Splash Supervision Credit Section */
.splash-supervision {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    max-width: 400px;
    animation: splashFadeSlideIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.88s both;
}

.splash-supervision-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 280px;
}

.supervision-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to var(--dir, left), rgba(var(--accent-rgb), 0.5), rgba(var(--accent-rgb), 0.03));
    border-radius: 1px;
}

.supervision-line:first-child {
    --dir: left;
    background: linear-gradient(to left, rgba(var(--accent-rgb), 0.5), rgba(var(--accent-rgb), 0.03));
}

.supervision-line:last-child {
    --dir: right;
    background: linear-gradient(to right, rgba(var(--accent-rgb), 0.5), rgba(var(--accent-rgb), 0.03));
}

.supervision-ornament {
    color: var(--accent-purple);
    font-size: 0.85rem;
    opacity: 0.7;
    line-height: 1;
    flex-shrink: 0;
}

.splash-supervision-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.splash-honorific {
    color: var(--accent-purple);
    font-weight: 600;
}

.splash-enter-btn {
    position: relative;
    z-index: 10;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-cyan) 100%);
    color: #fff !important;
    border: none;
    padding: 0.9rem 2.2rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-sans);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.3);
    transition: all var(--transition-normal);
    animation: splashFadeSlideIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.95s both;
    pointer-events: auto !important;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.splash-enter-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.35) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    animation: shimmerSweep 3.5s infinite ease-in-out;
    pointer-events: none !important;
}

@keyframes shimmerSweep {
    0% {
        left: -150%;
    }
    100% {
        left: 150%;
    }
}

.splash-enter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.5);
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
}

.splash-enter-btn:hover .lucide {
    transform: translateX(-4px);
}

.splash-enter-btn .lucide {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-fast);
}

/* Entrance animation: fade + slide up */
@keyframes splashFadeSlideIn {
    0% {
        opacity: 0;
        transform: translateY(25px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   TEXT HIGHLIGHTING & NOTES STYLES
   ========================================================================== */

/* Highlighted Text Node Styles */
.highlight-node {
    padding: 2px 0;
    border-radius: 3px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

/* Light Theme Highlights */
body.light-theme .highlight-yellow {
    background-color: rgba(250, 204, 21, 0.45);
    border-bottom: 2px solid rgba(217, 119, 6, 0.4);
}
body.light-theme .highlight-green {
    background-color: rgba(16, 185, 129, 0.3);
    border-bottom: 2px solid rgba(5, 150, 105, 0.45);
}
body.light-theme .highlight-blue {
    background-color: rgba(59, 130, 246, 0.3);
    border-bottom: 2px solid rgba(37, 99, 235, 0.45);
}

/* Dark Theme Highlights */
body.dark-theme .highlight-yellow {
    background-color: rgba(250, 204, 21, 0.45) !important;
    border-bottom: 2px solid rgba(250, 204, 21, 0.7);
    color: #ffffff !important;
}
body.dark-theme .highlight-green {
    background-color: rgba(34, 197, 94, 0.38) !important;
    border-bottom: 2px solid rgba(34, 197, 94, 0.65);
    color: #ffffff !important;
}
body.dark-theme .highlight-blue {
    background-color: rgba(59, 130, 246, 0.4) !important;
    border-bottom: 2px solid rgba(59, 130, 246, 0.65);
    color: #ffffff !important;
}

/* Temporary Selection Highlight style */
body.light-theme .highlight-temp {
    background-color: rgba(180, 145, 76, 0.35) !important;
    border-bottom: 2px dashed rgba(180, 145, 76, 0.85);
}
body.dark-theme .highlight-temp {
    background-color: rgba(197, 160, 89, 0.45) !important;
    border-bottom: 2px dashed rgba(197, 160, 89, 0.9);
    color: #ffffff !important;
}

/* Note indicator inside page */
.highlight-node.has-note {
    position: relative;
}
.highlight-node.has-note::after {
    content: " 📝";
    font-size: 0.7rem;
    vertical-align: super;
    margin-right: 2px;
    opacity: 0.85;
}

/* Floating Highlight Tooltip Bar */
.highlight-tooltip-bar {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.8rem;
    border-radius: 30px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    direction: rtl;
}

.highlight-tooltip-bar.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Color select buttons */
.hl-color-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    cursor: pointer;
    box-shadow: 0 0 0 1px var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hl-color-btn:hover {
    transform: scale(1.2);
}
.hl-color-btn.color-yellow {
    background-color: #facc15;
}
.hl-color-btn.color-green {
    background-color: #10b981;
}
.hl-color-btn.color-blue {
    background-color: #3b82f6;
}

.hl-divider {
    color: var(--border-color);
    margin: 0 0.2rem;
    font-weight: 300;
}

/* Action buttons */
.hl-action-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 0.3rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.hl-action-btn:hover {
    background-color: rgba(var(--accent-rgb), 0.08);
    color: var(--accent-purple);
}
.hl-delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444 !important;
}

/* Bookmarks tabs styling */
.bookmarks-tabs-header {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    direction: rtl;
    width: 100%;
    border-bottom: none;
}

.bookmarks-tabs-header .tab-btn {
    flex: 1;
    justify-content: center;
    background-color: rgba(var(--accent-rgb), 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.65rem 1.25rem;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    outline: none;
    position: relative;
    bottom: 0;
    white-space: nowrap;
}

.bookmarks-tabs-header .tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(var(--accent-rgb), 0.1);
    border-color: rgba(var(--accent-rgb), 0.3);
}

.bookmarks-tabs-header .tab-btn.active {
    background-color: var(--accent-purple) !important;
    color: #ffffff !important;
    border-color: var(--accent-purple) !important;
    font-weight: 700;
}

.bookmarks-tabs-header .tab-btn.active svg,
.bookmarks-tabs-header .tab-btn.active i {
    stroke: #ffffff !important;
}

/* Responsive tabs for small screens */
@media (max-width: 560px) {
    .bookmarks-tabs-header {
        gap: 0.5rem;
    }
    .bookmarks-tabs-header .tab-btn {
        font-size: 0.8rem;
        padding: 0.6rem 0.5rem;
        gap: 0.25rem;
        border-radius: 8px;
    }
    .bookmarks-tabs-header .tab-btn .lucide {
        width: 14px !important;
        height: 14px !important;
    }
}

@media (max-width: 400px) {
    .bookmarks-tabs-header {
        gap: 0.4rem;
    }
    .bookmarks-tabs-header .tab-btn {
        font-size: 0.72rem;
        padding: 0.5rem 0.3rem;
        gap: 0.2rem;
        border-radius: 6px;
    }
    .bookmarks-tabs-header .tab-btn svg,
    .bookmarks-tabs-header .tab-btn i {
        display: none !important;
    }
}

/* Highlights list cards in bookmarks modal */
.highlight-card {
    background: rgba(var(--accent-rgb), 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease;
    cursor: pointer;
    position: relative;
    overflow: visible !important;
    height: auto !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Card background tints based on highlight colors */
body.light-theme .highlight-card.tint-yellow {
    background-color: rgba(250, 204, 21, 0.05);
    border-color: rgba(250, 204, 21, 0.2);
}
body.light-theme .highlight-card.tint-green {
    background-color: rgba(16, 185, 129, 0.035);
    border-color: rgba(16, 185, 129, 0.2);
}
body.light-theme .highlight-card.tint-blue {
    background-color: rgba(59, 130, 246, 0.035);
    border-color: rgba(59, 130, 246, 0.2);
}

body.dark-theme .highlight-card.tint-yellow {
    background-color: rgba(250, 204, 21, 0.02);
    border-color: rgba(250, 204, 21, 0.15);
}
body.dark-theme .highlight-card.tint-green {
    background-color: rgba(16, 185, 129, 0.015);
    border-color: rgba(16, 185, 129, 0.15);
}
body.dark-theme .highlight-card.tint-blue {
    background-color: rgba(59, 130, 246, 0.015);
    border-color: rgba(59, 130, 246, 0.15);
}

.highlight-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}
body.light-theme .highlight-card:hover {
    background-color: rgba(var(--accent-rgb), 0.03);
}
body.light-theme .highlight-card.tint-yellow:hover {
    background-color: rgba(250, 204, 21, 0.08);
}
body.light-theme .highlight-card.tint-green:hover {
    background-color: rgba(16, 185, 129, 0.07);
}
body.light-theme .highlight-card.tint-blue:hover {
    background-color: rgba(59, 130, 246, 0.07);
}

body.dark-theme .highlight-card:hover {
    background-color: rgba(var(--accent-rgb), 0.05);
}

.highlight-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.highlight-card-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.05rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.highlight-card-text {
    font-family: 'Amiri', serif;
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-right: 4px solid;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 4px 0 0 4px;
    margin: 0;
    direction: rtl;
    text-align: right;
}
body.dark-theme .highlight-card-text {
    background: rgba(0, 0, 0, 0.2);
}
.highlight-card-text.color-yellow {
    border-right-color: #facc15;
}
.highlight-card-text.color-green {
    border-right-color: #10b981;
}
.highlight-card-text.color-blue {
    border-right-color: #3b82f6;
}
.highlight-card-note {
    background: rgba(var(--accent-rgb), 0.04);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    border: 1px dashed var(--border-color);
    margin: 0;
    direction: rtl;
    text-align: right;
}
.highlight-card-note-label {
    font-weight: 700;
    color: var(--accent-purple);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    display: block;
}
.highlight-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

/* --- AI Welcome Intro Card --- */
.ai-welcome-card {
    background: rgba(var(--accent-rgb), 0.06);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 8px;
}
.ai-welcome-header {
    margin-bottom: 6px;
}
.ai-welcome-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}
.ai-welcome-body p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* Avoid double scrollbars in bookmarks modal */
#modal-bookmarks .modal-body {
    overflow: hidden !important;
}

/* Dedicated Custom Scrollbars for Bookmarks, Highlights & TOC Lists */
.bookmarks-list::-webkit-scrollbar,
.highlights-list::-webkit-scrollbar,
.toc-list::-webkit-scrollbar,
.toc-drawer::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.search-results-wrapper::-webkit-scrollbar {
    display: block !important;
    width: 6px !important;
    height: 6px !important;
}

.bookmarks-list::-webkit-scrollbar-track,
.highlights-list::-webkit-scrollbar-track,
.toc-list::-webkit-scrollbar-track,
.toc-drawer::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.search-results-wrapper::-webkit-scrollbar-track {
    background: transparent !important;
    border-radius: 4px !important;
}

.bookmarks-list::-webkit-scrollbar-thumb,
.highlights-list::-webkit-scrollbar-thumb,
.toc-list::-webkit-scrollbar-thumb,
.toc-drawer::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.search-results-wrapper::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb), 0.35) !important;
    border-radius: 4px !important;
    border: none !important;
}

.bookmarks-list::-webkit-scrollbar-thumb:hover,
.highlights-list::-webkit-scrollbar-thumb:hover,
.toc-list::-webkit-scrollbar-thumb:hover,
.toc-drawer::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.search-results-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple) !important;
}

/* Light Theme Bookmarks & TOC Scrollbar */
body.light-theme .bookmarks-list::-webkit-scrollbar-thumb,
body.light-theme .highlights-list::-webkit-scrollbar-thumb,
body.light-theme .toc-list::-webkit-scrollbar-thumb,
body.light-theme .toc-drawer::-webkit-scrollbar-thumb {
    background: rgba(49, 151, 149, 0.35) !important;
}

/* Sepia Theme Bookmarks & TOC Scrollbar */
body.sepia-theme .bookmarks-list::-webkit-scrollbar-thumb,
body.sepia-theme .highlights-list::-webkit-scrollbar-thumb,
body.sepia-theme .toc-list::-webkit-scrollbar-thumb,
body.sepia-theme .toc-drawer::-webkit-scrollbar-thumb {
    background: rgba(197, 155, 39, 0.45) !important;
}

/* Dark Theme Bookmarks & TOC Scrollbar */
body.dark-theme .bookmarks-list::-webkit-scrollbar-thumb,
body.dark-theme .highlights-list::-webkit-scrollbar-thumb,
body.dark-theme .toc-list::-webkit-scrollbar-thumb,
body.dark-theme .toc-drawer::-webkit-scrollbar-thumb {
    background: rgba(49, 151, 149, 0.35) !important;
}

/* Tooltip for notes in reader */
.highlight-note-tooltip {
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    z-index: 10500;
    max-width: 250px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(5px);
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
}
.highlight-note-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.highlight-note-tooltip-title {
    font-weight: 700;
    color: var(--accent-purple);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

/* Pulse animation for targeted highlight */
@keyframes highlight-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(147, 51, 234, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(147, 51, 234, 0);
        transform: scale(1.03);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(147, 51, 234, 0);
        transform: scale(1);
    }
}
.highlight-pulse-active {
    animation: highlight-pulse 1.5s ease-in-out 2;
    display: inline-block;
    border-radius: 4px;
    z-index: 10;
}

.export-book-row:hover {
    background-color: rgba(var(--accent-rgb), 0.05);
}
body.light-theme .export-book-row:hover {
    background-color: rgba(49, 151, 149, 0.06);
}

/* ==========================================================================
   Update Notification UI
   ==========================================================================
   Unified Full-Screen Update Overlay (All Platforms)
   ========================================================================== */

@keyframes update-emblem-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.mobile-update-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10050;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    direction: rtl;
    overflow-y: auto;
}
.mobile-update-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.mobile-update-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.03;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(var(--accent-rgb), 0.4) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(var(--accent-rgb), 0.3) 0%, transparent 50%);
    pointer-events: none;
}
body.light-theme .mobile-update-bg-pattern {
    opacity: 0.05;
}
.mobile-update-content-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    flex: 1;
}
.mobile-update-emblem {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    color: var(--accent-purple);
    animation: update-emblem-pulse 2s ease-in-out infinite;
}
.mobile-update-overlay.force-update .mobile-update-emblem {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}
.mobile-update-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.mobile-update-overlay.force-update .mobile-update-title {
    color: #dc2626;
}
.mobile-update-desc {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 360px;
}
.mobile-update-notes-section {
    width: 100%;
    margin-bottom: 2rem;
}
.mobile-update-notes-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 0.75rem;
}
.mobile-update-overlay.force-update .mobile-update-notes-title {
    color: #dc2626;
}
.mobile-update-notes-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: right;
    white-space: pre-line;
}
body.light-theme .mobile-update-notes-content {
    background: rgba(0, 0, 0, 0.03);
}
.mobile-update-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    margin-top: auto;
    padding-top: 1rem;
}
.mobile-update-btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    padding: 0.9rem;
    border-radius: 14px;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(var(--accent-rgb), 0.3);
    transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.mobile-update-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(var(--accent-rgb), 0.4);
}
.mobile-update-btn-primary:active {
    transform: translateY(0);
}
.mobile-update-btn-secondary {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.8rem;
    border-radius: 14px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.mobile-update-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
body.light-theme .mobile-update-btn-secondary:hover {
    background: rgba(0, 0, 0, 0.04);
}


/* ==========================================================================
   Footer & Visitor Counter UI
   ========================================================================== */
.app-footer {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 1rem;
    margin-top: 1rem;
    width: 100%;
    color: var(--text-secondary);
}
.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.footer-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.8;
    pointer-events: none;
}

/* Visitor Counter Card */
.visitor-counter-card {
    background: var(--bg-card);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}
.visitor-counter-card:hover {
    border-color: rgba(var(--accent-rgb), 0.3);
    box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.08);
}
.visitor-counter-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}
.status-dot-pulse {
    width: 7px;
    height: 7px;
    background-color: #10b981;
    border-radius: 50%;
    position: relative;
    margin-left: 4px;
}
.status-dot-pulse::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #10b981;
    border-radius: 50%;
    animation: pulseDot 1.6s infinite ease-in-out;
}
@keyframes pulseDot {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.8); opacity: 0; }
}
.visitor-counter-num-wrapper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-right: 1px solid var(--border-color);
    padding-right: 1.25rem;
}
.visitor-counter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}
.visitor-counter-val {
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--accent-purple);
    letter-spacing: 0.5px;
}


/* Custom class for wrapping isolated symbol characters */
.abo-thar-symbol {
    font-family: 'Abo-Thar-Brackets-ASCII', 'Abo-Thar', 'Abo-thar', 'Abo Thar', 'Abo thar', 'ABO-THAR', 'Abothar', 'Abo_Thar', 'Abo_thar', 'NewSymbolFont', 'New Symbol Font', 'Abo-Thar Regular', 'Abo-thar Regular', 'Abo Thar Regular', 'NewSymbolFont Regular' !important;
}

/* Styling the page footnotes textarea in control panel to render symbol shortcuts natively */
#page-footnotes {
    font-family: 'Abo-Thar-Textarea', 'Amiri', 'Cairo', serif !important;
    font-size: 1.1rem !important;
    line-height: 1.7 !important;
}

/* Editor Symbols Modal */
.symbol-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(7, 10, 18, 0.85);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000 !important;
    padding: calc(1rem + var(--safe-area-inset-top, env(safe-area-inset-top, 24px))) 1rem calc(1rem + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.symbol-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}
.symbol-modal {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 720px;
    height: calc(100vh - 2rem - var(--safe-area-inset-top, env(safe-area-inset-top, 24px)) - var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    max-height: calc(100vh - 2rem - var(--safe-area-inset-top, env(safe-area-inset-top, 24px)) - var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.25s ease;
    overflow: hidden;
}
body.light-theme .symbol-modal {
    background-color: #ffffff;
    border-color: rgba(197, 160, 89, 0.35);
    box-shadow: 0 10px 40px rgba(197, 160, 89, 0.15);
}
.symbol-modal-overlay.show .symbol-modal {
    transform: translateY(0);
}
.symbol-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.symbol-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}
.symbol-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0 0.25rem;
    border-radius: 6px;
    transition: color 0.2s, background-color 0.2s;
}
.symbol-modal-close:hover {
    color: var(--accent-red, #ef4444);
    background-color: rgba(239, 68, 68, 0.1);
}
.symbol-modal-hint {
    margin: 0;
    padding: 0.75rem 1.5rem 0.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}
.symbol-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 10px;
    padding: 1rem 1.5rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}
.symbol-modal-item {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    cursor: pointer;
    border-radius: 10px;
    transition: background-color 0.2s, border-color 0.2s, transform 0.15s;
    padding: 0;
}
.symbol-modal-item:hover {
    background-color: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.4);
    transform: scale(1.08);
}
.symbol-modal-item:active {
    transform: scale(0.95);
}
.symbol-modal-item .abo-thar-symbol {
    font-size: 2.8rem;
    color: var(--text-primary);
    line-height: 1;
}
.symbol-modal-item:hover .abo-thar-symbol {
    color: var(--accent-cyan);
}

/* === FONT SETTINGS DROPDOWN AND COLORS === */
.font-size-wrapper {
    position: relative;
    display: inline-block;
}

.font-size-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1000;
    width: 260px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    direction: rtl;
    text-align: right;
    animation: fontDropdownSlideFade 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme .font-size-dropdown {
    background-color: #fff;
    border-color: rgba(197, 160, 89, 0.25);
    box-shadow: var(--shadow-md);
}

@keyframes fontDropdownSlideFade {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.font-size-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

#font-size-val {
    color: var(--accent-purple);
    font-weight: 700;
}

.font-size-slider-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slider-adjust-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.slider-adjust-btn:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
    background-color: rgba(197, 160, 89, 0.08);
}

/* Custom Slider Styling */
.font-size-slider-container input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(var(--accent-rgb), 0.15);
    outline: none;
    cursor: pointer;
    transition: background 0.3s;
}

.font-size-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-purple);
    transition: transform var(--transition-fast), background-color var(--transition-fast);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.font-size-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: var(--accent-cyan);
}

.font-size-slider-container input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--accent-purple);
    transition: transform var(--transition-fast), background-color var(--transition-fast);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
}

.font-size-slider-container input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
    background: var(--accent-cyan);
}

/* Color customization styles */
.font-color-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.6rem;
}

.font-color-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
}

.color-dot-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.color-dot-btn:hover {
    transform: scale(1.15);
}

.color-dot-btn.active {
    border-color: var(--accent-purple);
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

/* Reset Button */
.font-size-reset-btn {
    background-color: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    color: var(--accent-purple);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.font-size-reset-btn:hover {
    background-color: var(--accent-purple);
    color: #fff;
    border-color: var(--accent-purple);
}

/* CSS Theme Color Variable Overrides */
body.font-color-purple {
    --reader-text: #581c87;
}
body.dark-theme.font-color-purple {
    --reader-text: #c084fc;
}
body.font-color-red {
    --reader-text: #b91c1c;
}
body.dark-theme.font-color-red {
    --reader-text: #f87171;
}
body.font-color-green {
    --reader-text: #15803d;
}
body.dark-theme.font-color-green {
    --reader-text: #4ade80;
}
body.font-color-blue {
    --reader-text: #1d4ed8;
}
body.dark-theme.font-color-blue {
    --reader-text: #60a5fa;
}
body.font-color-yellow {
    --reader-text: #a16207;
}
body.dark-theme.font-color-yellow {
    --reader-text: #fbbf24;
}

/* Color Dot Button Variables and Mappings */
:root {
    --color-dot-default: #f3f4f6;
    --color-dot-purple: #c084fc;
    --color-dot-red: #f87171;
    --color-dot-green: #4ade80;
    --color-dot-blue: #60a5fa;
    --color-dot-yellow: #fbbf24;
}

body.light-theme {
    --color-dot-default: #2c2211;
    --color-dot-purple: #581c87;
    --color-dot-red: #b91c1c;
    --color-dot-green: #15803d;
    --color-dot-blue: #1d4ed8;
    --color-dot-yellow: #a16207;
}

.color-dot-btn[data-color="default"] { background-color: var(--color-dot-default); border-color: rgba(var(--accent-rgb), 0.3); }
.color-dot-btn[data-color="purple"] { background-color: var(--color-dot-purple); border-color: rgba(var(--accent-rgb), 0.3); }
.color-dot-btn[data-color="red"] { background-color: var(--color-dot-red); border-color: rgba(var(--accent-rgb), 0.3); }
.color-dot-btn[data-color="green"] { background-color: var(--color-dot-green); border-color: rgba(var(--accent-rgb), 0.3); }
.color-dot-btn[data-color="blue"] { background-color: var(--color-dot-blue); border-color: rgba(var(--accent-rgb), 0.3); }
.color-dot-btn[data-color="yellow"] { background-color: var(--color-dot-yellow); border-color: rgba(var(--accent-rgb), 0.3); }

/* Ensure borders stand out visually */
body.light-theme .color-dot-btn[data-color="purple"] {
    border-color: rgba(0, 0, 0, 0.1);
}
body:not(.light-theme) .color-dot-btn[data-color="default"] {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Page Number Ornament styles */
.page-indicator-wrapper {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    direction: rtl;
}

.page-indicator-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
}

.page-number-ornament {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-purple); /* Draw SVG lines with gold accent color */
    flex-shrink: 0;
}

.ornament-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.3; /* Subtle transparency for visual comfort */
}

.page-indicator-num {
    position: relative;
    z-index: 1;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Amiri', serif !important;
    line-height: 1;
    margin-top: 1px; /* Visual center tuning */
}

/* ============================================= */
/* ======= AI ASSISTANT STYLES ================= */
/* ============================================= */

/* --- Floating Action Button --- */
.ai-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50% !important;
    border: none;
    cursor: pointer;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 6px 24px rgba(var(--accent-rgb), 0.45);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-fab:hover {
    transform: scale(1.1);
    background: var(--accent-hover-gradient);
    box-shadow: 0 8px 32px rgba(var(--accent-rgb), 0.6);
}
.ai-fab:active {
    transform: scale(0.95);
}
.ai-fab.hidden,
.ai-fab.chat-open {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Pulse ring animation disabled */
.ai-fab-pulse {
    display: none !important;
    animation: none !important;
}

/* --- Chat Dialog --- */
.ai-chat-dialog {
    position: fixed;
    bottom: 16px;
    left: 16px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 570px;
    max-height: calc(100vh - 32px);
    background: var(--bg-primary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    z-index: 9995;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    direction: rtl;
    text-align: right;
    animation: aiChatOpen 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom left;
}
.ai-chat-dialog.hidden {
    display: none !important;
}
@keyframes aiChatOpen {
    from { opacity: 0; transform: scale(0.7) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Chat Header --- */
.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--accent-gradient);
    color: #fff;
    flex-shrink: 0;
}
.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ai-fab-icon-text {
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    font-weight: 800 !important;
    font-size: 1.4rem !important;
    letter-spacing: -0.5px;
    color: #ffffff !important;
    line-height: 1;
    display: inline-block;
    user-select: none;
}
.ai-avatar-icon-text {
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    font-weight: 800 !important;
    font-size: 1.15rem !important;
    letter-spacing: -0.5px;
    color: #ffffff !important;
    line-height: 1;
    display: inline-block;
    user-select: none;
}
.ai-chat-header-info h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}
.ai-chat-header-info p {
    font-size: 0.72rem;
    margin: 0;
    opacity: 0.85;
    line-height: 1.3;
}
.ai-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ai-chat-clear-btn,
.ai-chat-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.ai-chat-clear-btn:hover,
.ai-chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- Messages Area --- */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* --- Message Bubbles --- */
.ai-msg {
    display: flex;
    max-width: 88%;
}
.ai-msg-user {
    align-self: flex-start;
}
.ai-msg-bot {
    align-self: flex-end;
}
.ai-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.65;
    word-break: break-word;
}
.ai-msg-user .ai-msg-bubble {
    background: var(--accent-gradient);
    color: #fff;
    border-bottom-right-radius: 6px;
}
.ai-msg-bot .ai-msg-bubble {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 6px;
}
.ai-msg-bubble p {
    margin: 0 0 6px 0;
}
.ai-msg-bubble p:last-child {
    margin-bottom: 0;
}
.ai-msg-bubble strong {
    font-weight: 700;
}
.ai-msg-hint {
    font-size: 0.78rem;
    opacity: 0.7;
    margin-top: 8px !important;
    border-top: 1px solid rgba(128, 128, 128, 0.2);
    padding-top: 8px;
}

/* Source cards container */
.ai-sources-container {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(128, 128, 128, 0.15);
}
.ai-sources-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 6px;
}
/* Source tags */
.ai-source-tag {
    display: inline-block;
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent-purple);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 600;
    margin: 3px 4px 3px 0;
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    transition: background 0.2s, transform 0.15s;
    cursor: default;
    line-height: 1.4;
}
.ai-source-tag:hover {
    background: rgba(var(--accent-rgb), 0.2);
    transform: translateY(-1px);
}

/* Typing indicator */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
}
.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-purple);
    animation: aiTypingBounce 1.4s ease-in-out infinite;
}
@keyframes aiTypingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* --- Chat Footer --- */
.ai-chat-footer {
    padding: 8px 12px 10px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-primary);
}
.ai-chat-counter {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    opacity: 0.8;
}
.ai-chat-input-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 28px !important;
    padding: 4px 6px !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    width: 100% !important;
    height: 46px !important;
}
.ai-chat-input-row:focus-within {
    border-color: var(--accent-purple) !important;
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.15) !important;
}
#ai-chat-input {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 36px !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    color: var(--text-primary) !important;
    font-size: 0.95rem !important;
    font-family: inherit !important;
    padding: 0 8px !important;
    direction: rtl !important;
    text-align: right !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
}
#ai-chat-input:focus {
    outline: none !important;
    box-shadow: none !important;
}
#ai-chat-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
    text-align: right;
}
.ai-send-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50% !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(var(--accent-rgb), 0.16) !important;
    color: var(--accent-purple) !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
}
.ai-send-btn svg {
    margin: 0 !important;
    width: 18px !important;
    height: 18px !important;
}
.ai-send-btn:hover {
    transform: scale(1.06) !important;
    background: rgba(var(--accent-rgb), 0.28) !important;
    color: var(--accent-hover-gradient) !important;
}
.ai-send-btn:disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    transform: none !important;
}
.ai-voice-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50% !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
}
.ai-voice-btn:hover {
    color: var(--accent-purple) !important;
    background: rgba(128, 128, 128, 0.1) !important;
}
.ai-voice-btn.listening {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.15) !important;
    animation: voicePulse 1.5s infinite ease-in-out !important;
}
body.dark-theme .ai-send-btn {
    background: rgba(var(--accent-rgb), 0.25) !important;
    color: var(--accent-pink) !important;
}
body.dark-theme .ai-send-btn:hover {
    background: rgba(var(--accent-rgb), 0.38) !important;
}

/* --- Error message in chat --- */
.ai-msg-error .ai-msg-bubble {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #dc2626;
}

/* --- Dark Theme source tag enhancement --- */
body.dark-theme .ai-source-tag {
    background: rgba(var(--accent-rgb), 0.2);
    color: var(--accent-pink);
    border-color: rgba(var(--accent-rgb), 0.3);
}

/* --- Lift FAB when scrolled to footer / visitor stats bar --- */
.ai-fab.fab-above-footer {
    transform: translateY(-64px);
}
.ai-fab.fab-above-footer:hover {
    transform: translateY(-64px) scale(1.1);
}
.ai-fab.fab-above-footer:active {
    transform: translateY(-64px) scale(0.95);
}

/* --- Mobile Responsive & Safe Area Insets --- */
@media (max-width: 640px) {
    .ai-chat-dialog {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
        top: max(10px, calc(env(safe-area-inset-top, 0px) + 6px)) !important;
        width: calc(100vw - 20px) !important;
        max-width: none !important;
        height: auto !important;
        max-height: calc(100dvh - max(24px, calc(env(safe-area-inset-top, 0px) + 18px))) !important;
        border-radius: 20px !important;
        box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4) !important;
        z-index: 99995 !important;
    }
    .ai-chat-header {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
    .ai-chat-footer {
        padding-bottom: 10px !important;
    }
    .ai-fab {
        bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 16px));
        left: max(18px, calc(env(safe-area-inset-left, 0px) + 16px));
        width: 52px;
        height: 52px;
        border-radius: 50% !important;
    }
    .ai-fab.fab-above-footer {
        transform: translateY(-56px);
    }
}

/* --- Clean Text List Sources (No Pills/Cards) --- */
.ai-sources-container {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    direction: rtl;
    text-align: right;
}

.ai-sources-header {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-sources-text-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.ai-source-text-item {
    font-size: 0.88rem;
    line-height: 1.5;
}

.ai-source-link {
    color: var(--accent-purple);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-block;
    padding: 2px 0;
    text-decoration: underline;
    text-decoration-color: rgba(var(--accent-rgb), 0.3);
    text-underline-offset: 3px;
}

.ai-source-link:hover {
    color: var(--accent-pink);
    text-decoration-color: var(--accent-pink);
}

body.dark-theme .ai-source-link {
    color: var(--accent-cyan);
    text-decoration-color: rgba(var(--accent-cyan-rgb), 0.3);
}

body.dark-theme .ai-source-link:hover {
    color: var(--accent-pink);
    text-decoration-color: var(--accent-pink);
}

/* AI Quick Prompts Section (Centered Stacked Buttons) */
.ai-prompts-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed rgba(var(--accent-rgb), 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.ai-prompts-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-purple);
    margin-bottom: 12px;
    text-align: center;
}

.ai-prompts-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 380px;
}

.ai-prompt-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: rgba(var(--accent-rgb), 0.06);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    text-align: center;
}

.ai-prompt-btn:hover {
    background: rgba(var(--accent-rgb), 0.15);
    border-color: var(--accent-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.18);
    color: var(--accent-purple);
}

.ai-prompt-btn:active {
    transform: translateY(0);
}

.ai-prompt-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
}

.ai-prompt-text {
    line-height: 1.4;
}

/* === SEARCH RESULT COUNTER & LOADER STYLES === */
.search-result-num {
    font-family: var(--font-sans), system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-weight: 700;
    color: var(--accent-purple, #cba86a);
    display: inline-block;
    padding: 0 4px;
    font-size: 1.05rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}
