/* ============================================================
   قاموس قبطي ناطق — التصميم الفاخر (v3.0 - cPanel Ready)
   ألوان مستوحاة من Lovable (بنفسجي/ذهبي على خلفية داكنة)
   مع Glassmorphism + Micro-animations + Responsive Layout
   ============================================================ */

:root,
body:not(.light-theme) {
  /* Dark Theme Variables (Coptic Premium Dark) */
  --bg: #0A1325;
  --bg-2: #0F1E38;
  --bg-3: #152A4E;
  --bg-card: #0E1B33;
  --bg-glass: rgba(14, 27, 51, 0.85);
  
  --sidebar: linear-gradient(180deg, #071022 0%, #0C1B36 100%);
  --sidebar-border: #C79B45;
  --sidebar-accent: rgba(199, 155, 69, 0.15);
  --sidebar-accent-foreground: #F5D78E;
  
  --primary: #C79B45;
  --primary-glow: rgba(199, 155, 69, 0.25);
  --primary-foreground: #071022;
  
  --accent: #C79B45;
  --accent-foreground: #FFFFFF;
  
  --gold: #C79B45;
  --gold-soft: #E5C478;
  --gold-dim: #99752A;
  --gold-glow: rgba(199, 155, 69, 0.25);
  
  --red: #E53E3E;
  --red-glow: rgba(229, 62, 62, 0.2);
  --green: #38A169;
  --green-glow: rgba(56, 161, 105, 0.2);
  --blue: #3182CE;
  --blue-glow: rgba(49, 130, 206, 0.2);
  
  --border: rgba(199, 155, 69, 0.25);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-gold: #C79B45;
  
  --text: #F7FAFC;
  --text-dim: #CBD5E0;
  --text-muted: #94A3B8;
  
  --radius: 18px;
  --radius-sm: 14px;
  --radius-xs: 8px;
  
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-gold: 0 4px 20px rgba(199, 155, 69, 0.25);
  
  --font: "Cairo", "Inter", system-ui, -apple-system, sans-serif;
  --coptic-font: "Noto Sans Coptic", "Cairo", sans-serif;
  
  --sidebar-w: 260px;
  --transition: all 220ms ease-in-out;
}

/* Light Theme Variables (Coptic Premium Light) */
body.light-theme {
  --bg: #F8F5EE;
  --bg-2: #F0EAE0;
  --bg-3: #E7DECE;
  --bg-card: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.92);
  
  --sidebar: linear-gradient(180deg, #0A2247 0%, #123A6B 100%);
  --sidebar-border: #C79B45;
  --sidebar-accent: rgba(199, 155, 69, 0.18);
  --sidebar-accent-foreground: #F5D78E;
  
  --primary: #0F2D5C;
  --primary-glow: rgba(15, 45, 92, 0.15);
  --primary-foreground: #FFFFFF;
  
  --accent: #C79B45;
  --accent-foreground: #1A283E;
  
  --gold: #B58528;
  --gold-soft: #966A17;
  --gold-dim: #704D09;
  --gold-glow: rgba(181, 133, 40, 0.15);
  
  --red: #C53030;
  --red-glow: rgba(197, 48, 48, 0.15);
  --green: #2F855A;
  --green-glow: rgba(47, 133, 90, 0.15);
  --blue: #2B6CB0;
  --blue-glow: rgba(43, 108, 176, 0.15);
  
  --border: #E2D5BD;
  --border-light: rgba(226, 213, 189, 0.6);
  --border-gold: #C79B45;
  
  --text: #1A283E;
  --text-dim: #4B5E78;
  --text-muted: #64748B;
  
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.03);
  --shadow-gold: 0 4px 16px rgba(199, 155, 69, 0.15);
}

/* Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
[hidden] {
  display: none !important;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image: none;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  direction: rtl;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
  position: relative;
}

/* Parchment texture */
body::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' opacity='0.03'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -2;
}

/* Coptic Ornaments in corners */
body::after {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' fill='none' stroke='%23B88A2A' stroke-width='1'%3E%3Cpath d='M10 10h10v10H10zM15 5v20M5 15h20'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' fill='none' stroke='%23B88A2A' stroke-width='1'%3E%3Cpath d='M10 10h10v10H10zM15 5v20M5 15h20'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' fill='none' stroke='%23B88A2A' stroke-width='1'%3E%3Cpath d='M10 10h10v10H10zM15 5v20M5 15h20'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' fill='none' stroke='%23B88A2A' stroke-width='1'%3E%3Cpath d='M10 10h10v10H10zM15 5v20M5 15h20'/%3E%3C/svg%3E");
  background-position: top 20px left 20px, top 20px right 20px, bottom 20px left 20px, bottom 20px right 20px;
  background-size: 40px;
  background-repeat: no-repeat;
  opacity: 0.05;
  pointer-events: none;
  z-index: -1;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================================================
   LAYOUT SYSTEM (Desktop Sidebar, Mobile Top Header)
   ============================================================ */
.app-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar (Desktop) */
.app-sidebar {
  display: none; /* Default hidden on mobile */
}

@keyframes sidebarFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 768px) {
  .app-sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    background: var(--sidebar);
    border-left: 1px solid var(--sidebar-border);
    height: 100vh;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    z-index: 100;
    overflow: hidden; /* For watermark */
    animation: sidebarFadeIn 0.8s ease-in-out;
  }
  .app-sidebar::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B88A2A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2v20M5 8h14'/%3E%3C/svg%3E");
    background-size: 200px;
    background-position: center 30%;
    background-repeat: no-repeat;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
  }
  /* Coptic Church Illustration at the bottom of the sidebar */
  .app-sidebar::after {
    content: "";
    position: absolute;
    bottom: 0; left: 0; right: 0; height: 300px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23F8F5EE' stroke-width='1'%3E%3Cpath d='M50 10v40M45 15h10M20 50h60v40H20zM50 50v40M35 50v40M65 50v40'/%3E%3Ccircle cx='50' cy='35' r='10'/%3E%3Cpath d='M20 50L50 30l30 20'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: bottom center;
    background-repeat: no-repeat;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
  }
  .app-sidebar > * {
    position: relative;
    z-index: 1;
  }
}

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar-brand-name {
  font-family: var(--font);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 99px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 56px;
  border-radius: 16px;
  color: #F8F4EA;
  font-size: 0.95rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  text-align: right;
  font-family: var(--font);
  transition: all 250ms ease-in-out;
  margin-bottom: 4px;
}

.sidebar-item:hover {
  background: rgba(184, 138, 42, 0.12); /* Soft gold 12% opacity */
  color: #F8F4EA;
}

.sidebar-item.active {
  background: var(--gold);
  color: var(--primary-foreground);
  font-weight: 700;
  border: none;
  box-shadow: 0 8px 24px var(--shadow-gold);
}

.sidebar-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--gold);
  transition: all 250ms ease-in-out;
}

.sidebar-item.active svg {
  color: var(--primary-foreground);
}

.sidebar-item-label-en {
  margin-right: auto;
  font-size: 0.75rem;
  color: rgba(248, 244, 234, 0.6);
  font-weight: 500;
  transition: all 250ms ease-in-out;
}
.sidebar-item.active .sidebar-item-label-en {
  color: rgba(13, 35, 69, 0.7);
}

.sidebar-footer {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar-footer-card {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Pronunciation Selector widget */
.pron-widget {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  gap: 2px;
}

.pron-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
}

.pron-btn.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  color: var(--gold);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 250ms ease-in-out;
  position: relative;
  z-index: 2;
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
  background: var(--gold);
  color: var(--primary-foreground);
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
}

/* Content Area */
.content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
}

/* Mobile Header */
.mobile-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  padding: 10px 16px;
}

@media (min-width: 768px) {
  .mobile-header {
    display: none; /* Hidden on desktop */
  }
}

.mobile-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

/* Gold Coptic Cross background illustration */
.mobile-header-top::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -20px; /* Right in RTL */
  transform: translateY(-50%);
  width: 80px;
  height: 80px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23B88A2A' stroke-width='1.5'%3E%3Cpath d='M12 2v20M5 8h14'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: left center;
  opacity: 0.85;
  pointer-events: none;
}

.mobile-logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.mobile-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
  object-fit: cover;
}

.mobile-title {
  font-family: "Cairo", sans-serif;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--text);
  line-height: 1.2;
}

.mobile-title-sub {
  font-family: "Cairo", sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Horizontal scrolling mobile navigation bar */
.mobile-nav-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 4px 8px;
  scrollbar-width: none; /* Firefox */
  position: relative;
  z-index: 1;
}

.mobile-nav-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.mobile-nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 30px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 250ms ease-in-out;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.mobile-nav-btn svg {
  color: var(--gold);
}

.mobile-nav-btn:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
}

.mobile-nav-btn.active {
  background: var(--gold);
  color: var(--primary-foreground);
  border-color: transparent;
  font-weight: 700;
}
.mobile-nav-btn.active svg {
  color: var(--primary-foreground);
}

/* Main tab panels spacing */
.tab-panel {
  padding: 24px 0 60px;
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-panel:not(.active) {
  display: none;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   ELEGANT CARDS & GLASSMORPHISM
   ============================================================ */
.card-elegant {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: all 220ms ease-in-out;
  position: relative;
}

/* Light manuscript corner ornaments for large cards */
.card-elegant::before {
  content: "";
  position: absolute;
  top: 4px; left: 4px; right: 4px; bottom: 4px;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid rgba(184, 138, 42, 0.05); /* very faint inner line */
  pointer-events: none;
  z-index: 0;
}

.card-elegant > * {
  position: relative;
  z-index: 1;
}

.card-elegant::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card-elegant:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(184, 138, 42, 0.3);
}

/* ============================================================
   1. DASHBOARD & HOMEPAGE WIDGETS
   ============================================================ */
/* Welcome Header banner */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.welcome-banner-bg {
  position: absolute;
  inset: 0;
  opacity: 0.15;
  background-image: radial-gradient(circle at 10% 20%, var(--gold-soft), transparent 50%);
}

.welcome-banner-content {
  position: relative;
  padding: 30px;
  display: grid;
  md-grid-cols: auto 1fr;
  gap: 24px;
  align-items: center;
}

.welcome-logo-large {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid rgba(250, 204, 21, 0.8);
  object-fit: cover;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  margin: 0 auto md:margin-0;
}

.welcome-text {
  text-align: center;
  md-text-align: right;
}

.welcome-tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold-soft);
  text-transform: uppercase;
}

.welcome-title {
  font-weight: 900;
  font-size: 1.8rem;
  color: #fff;
  margin-top: 4px;
}

.welcome-desc {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 8px;
  max-width: 500px;
}

/* Dashboard Widgets Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 24px;
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* Word of the day card */
.wotd-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
}

.wotd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wotd-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--gold-soft);
  background: var(--gold-glow);
  border: 1px solid var(--border-gold);
  padding: 4px 12px;
  border-radius: 99px;
}

.wotd-listen-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--gold-soft);
  padding: 6px 14px;
  border-radius: 99px;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.wotd-listen-btn:hover {
  background: var(--gold);
  color: #000;
}

.wotd-listen-btn.speaking {
  background: var(--gold);
  color: #000;
  animation: pulse 0.8s infinite alternate;
}

.wotd-coptic {
  font-family: var(--coptic-font);
  font-size: 2.8rem;
  color: var(--gold-soft);
  line-height: 1.2;
  margin-top: 16px;
}

.wotd-translit {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.wotd-meanings {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
}

.wotd-link {
  font-size: 0.95rem;
  color: #FFFFFF;
  background: #154A91; /* Royal Blue */
  padding: 12px 24px;
  border-radius: 18px; /* Luxury radius */
  text-decoration: none;
  align-self: flex-start;
  margin-top: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 220ms ease-in-out;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08); /* Smooth shadow */
  border: none;
}

.wotd-link:hover {
  transform: translateY(-4px) scale(1.02);
  background: #B88A2A;
  color: #0D2345;
  box-shadow: 0 12px 30px rgba(184,138,42,0.2);
}

/* Home Progress Stats Card */
.progress-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.progress-header {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.stats-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-item-premium {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.stat-item-premium:hover {
  background: rgba(255, 255, 255, 0.04);
}

.stat-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Progress bar */
.progress-bar-wrap {
  margin-top: 20px;
}

.progress-bar-bg {
  height: 6px;
  background: var(--bg-3);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.5s ease-out;
}

.progress-bar-lbl {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Dashboard Lower Grid (Weekly Chart, Strong/Weak) */
.dashboard-lower-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (min-width: 768px) {
  .dashboard-lower-grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* Weekly Chart Widget */
.chart-card {
  padding: 24px;
}

.chart-bars-wrap {
  display: flex;
  justify-content: space-between;
  align-items: end;
  height: 140px;
  gap: 8px;
  margin-top: 24px;
}

.chart-bar-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: end;
}

.chart-bar-val {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.chart-bar-body {
  width: 100%;
  max-width: 24px;
  background: var(--primary-glow);
  border: 1px solid var(--border);
  border-radius: 4px 4px 0 0;
  transition: height 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s;
  cursor: pointer;
}

.chart-bar-body:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.chart-bar-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Strong / Weak Card widget */
.analysis-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.analysis-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.analysis-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.analysis-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.analysis-item-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.analysis-item-val {
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 2px;
}

.analysis-item-val.strong {
  color: var(--green);
}

.analysis-item-val.weak {
  color: #f59e0b; /* Amber */
}

/* Recently Searched / Favorites List Cards */
.recent-fav-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (min-width: 768px) {
  .recent-fav-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.list-card {
  padding: 24px;
}

.list-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.list-card-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.list-card-see-all {
  font-size: 0.75rem;
  color: var(--primary-foreground);
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  padding: 4px 12px;
  border-radius: 99px;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.list-card-see-all:hover {
  opacity: 0.95;
}

.list-card-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 16px 0;
  text-align: center;
}

.list-card-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-card-item-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  text-decoration: none;
  color: var(--text-dim);
  transition: var(--transition);
}

.list-card-item-link:hover {
  background: rgba(255, 255, 255, 0.02);
  color: var(--primary);
}

.list-card-coptic {
  font-family: var(--coptic-font);
  font-size: 1.15rem;
  color: var(--gold-soft);
}

.list-card-meaning {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================================
   2. DICTIONARY TAB & WORD GRID
   ============================================================ */
.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field {
  width: 100%;
  height: 58px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 0 60px 0 16px; /* Right padding for the icon in RTL */
  color: var(--text);
  font-size: 1.05rem;
  font-family: var(--font);
  outline: none;
  transition: all 250ms ease-in-out;
  box-shadow: var(--shadow-sm);
}

.search-field::placeholder {
  color: var(--text-muted);
}

.search-field:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.search-icon-svg {
  position: absolute;
  right: 6px;
  width: 46px;
  height: 46px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-foreground);
  transition: all 250ms ease-in-out;
  pointer-events: none;
}

.search-field:focus + .search-icon-svg {
  background: var(--gold);
  color: #071022;
}

.clear-btn-svg {
  position: absolute;
  left: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.clear-btn-svg:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.filters-row-flex {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-picker-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-picker-lbl {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.filter-picker-select {
  height: 58px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 30px;
  padding: 0 16px;
  font-family: var(--font);
  font-size: 0.95rem;
  cursor: pointer;
  outline: none;
  transition: all 250ms ease-in-out;
  box-shadow: var(--shadow-sm);
}

.filter-picker-select:hover {
  background: var(--bg-3);
  border-color: var(--gold);
}

/* Category tag pills row */
.category-tags-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.category-tags-scroll::-webkit-scrollbar {
  display: none;
}

.category-tag-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 18px; /* Luxury radius */
  white-space: nowrap;
  cursor: pointer;
  transition: all 250ms ease-in-out;
  box-shadow: var(--shadow-sm);
}

.category-tag-btn:hover {
  transform: translateY(-2px);
  background: var(--bg-3);
  border-color: var(--gold);
}

.category-tag-btn.active {
  background: var(--gold);
  color: var(--primary-foreground);
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

/* Results header metadata */
.results-header-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 14px;
}

/* Words Cards Grid */
.words-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

@media (min-width: 640px) {
  .words-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .words-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.word-card-elegant {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 150px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.word-card-elegant:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow);
}

.word-card-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.word-card-coptic {
  font-family: var(--coptic-font);
  font-size: 1.6rem;
  color: var(--gold-soft);
  line-height: 1.25;
}

.word-card-translit {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

.word-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.word-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.word-action-btn:hover {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.word-action-btn.speaking {
  background: var(--primary);
  color: var(--primary-foreground);
  animation: pulse 0.7s infinite alternate;
}

.word-action-btn.favorite {
  color: #eab308;
}

.word-card-bottom {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  padding-top: 10px;
}

.word-card-meaning-ar {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.word-card-meaning-en {
  font-size: 0.78rem;
  color: var(--text-muted);
  direction: ltr;
  text-align: right;
  margin-top: 1px;
}

.word-card-tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 99px;
  display: inline-block;
  margin-top: 6px;
}

/* Load more wrapper */
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.load-more-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 32px;
  border-radius: 18px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 220ms ease-in-out;
  box-shadow: var(--shadow-sm);
}

.load-more-btn:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: var(--shadow-gold);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon {
  font-size: 2.5rem;
  opacity: 0.6;
}

.empty-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dim);
}

.empty-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 320px;
}

/* ============================================================
   3. ALPHABET TAB
   ============================================================ */
.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

@media (min-width: 480px) {
  .alphabet-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 640px) {
  .alphabet-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (min-width: 1024px) {
  .alphabet-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

.letter-card-elegant {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  padding: 24px 16px;
  text-align: center;
  transition: all 220ms ease-in-out;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.letter-card-elegant:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-gold);
  border-color: var(--gold);
}

.letter-card-elegant.active {
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.letter-card-coptic {
  font-family: var(--coptic-font);
  font-size: 2.5rem;
  color: var(--gold);
  line-height: 1.1;
  margin-bottom: 8px;
}

.letter-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

.letter-card-sound {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

.audio-btn {
  background: var(--primary);
  color: var(--primary-foreground);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 250ms ease-in-out;
  margin-top: 16px;
}
.audio-btn:hover {
  background: var(--gold);
  color: var(--primary-foreground);
  transform: scale(1.1);
}

/* Detail Panel */
.letter-detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 24px;
  padding: 32px;
  margin-top: 32px;
  display: flex;
  gap: 32px;
  box-shadow: var(--shadow); /* Elegant spacing and luxury shadow */
  position: relative;
  overflow: hidden;
  align-items: center;
  transition: all 220ms ease-in-out;
}

.letter-detail-panel::before,
.letter-detail-panel::after {
  content: "";
  position: absolute;
  width: 100px; height: 100px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' fill='none' stroke='%23C79B45' stroke-width='1'%3E%3Cpath d='M10 10h10v10H10zM15 5v20M5 15h20'/%3E%3C/svg%3E");
  background-size: 50px;
  background-repeat: no-repeat;
  opacity: 0.1;
  pointer-events: none;
}
.letter-detail-panel::before { top: 10px; right: 10px; background-position: top right; }
.letter-detail-panel::after { bottom: 10px; left: 10px; background-position: bottom left; }

.detail-large-letter {
  font-family: var(--coptic-font);
  font-size: 6rem;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  border-left: 2px solid var(--border-light);
  padding-left: 32px;
}

.detail-info-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.detail-mini-card {
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-mini-card-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.detail-mini-card-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.detail-mini-card-audio {
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; transition: all 250ms ease-in-out;
}
.detail-mini-card-audio:hover {
  background: var(--gold); color: var(--primary-foreground); transform: scale(1.1);
}
.detail-mini-card-full {
  grid-column: 1 / -1;
}

/* ============================================================
   4. TRANSLATOR & VIRTUAL KEYBOARD
   ============================================================ */
.translator-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 14px;
}

@media (min-width: 768px) {
  .translator-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.trans-box-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.trans-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.trans-box-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.trans-textarea {
  width: 100%;
  min-height: 140px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.15rem;
  line-height: 1.6;
  resize: vertical;
}

.trans-textarea.coptic-style, .trans-output.coptic-style {
  font-family: var(--coptic-font) !important;
  font-size: 1.7rem !important;
  line-height: 1.4;
}

.trans-output {
  min-height: 140px;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--gold-soft);
  font-family: var(--coptic-font), var(--font);
}

.trans-output-empty {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 1rem;
  font-family: var(--font);
}

/* Translator Language Selector Bar */
.tr-lang-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.tr-lang-select-wrap {
  flex: 1;
  max-width: 220px;
  position: relative;
}

.tr-lang-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.tr-lang-select:hover, .tr-lang-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.tr-swap-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.tr-swap-btn:hover {
  background: var(--primary);
  color: var(--primary-foreground);
  transform: rotate(180deg);
}

/* Translator API Status Banner */
.tr-api-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(199, 155, 69, 0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.tr-api-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 6px;
}

.tr-api-dot.online {
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* Word Breakdown Cards (تفصيل الكلمات الفاخر) */
.tr-breakdown-wrap {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

#trBreakdown {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.tr-bd-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.tr-bd-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

.tr-bd-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dashed var(--border-light);
  padding-bottom: 5px;
}

.tr-bd-orig-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 6px;
}

.tr-bd-source-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
}

.tr-bd-source-badge.source-phrase {
  background: rgba(199, 155, 69, 0.2);
  color: var(--gold-soft);
  border: 1px solid var(--gold);
}

.tr-bd-source-badge.source-local {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tr-bd-source-badge.source-api {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.tr-bd-source-badge.source-bridge {
  background: rgba(139, 92, 246, 0.15);
  color: #A78BFA;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.tr-bd-source-badge.source-translit {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.tr-bd-source-badge.source-pending {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  animation: pulse 1.2s infinite;
}

.tr-bd-card-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tr-bd-coptic {
  font-family: var(--coptic-font);
  font-size: 1.35rem;
  color: var(--gold-soft);
  font-weight: 700;
  line-height: 1.2;
}

.tr-bd-phon {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  font-family: 'Inter', sans-serif;
  direction: ltr;
}

.tr-bd-meaning {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
  line-height: 1.4;
}

.tr-bd-speak-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.tr-bd-speak-btn:hover {
  background: var(--primary);
  color: var(--primary-foreground);
  transform: scale(1.1);
}

.tr-bd-sug-wrap {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tr-suggestions-wrap {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  margin-top: 8px;
}

.tr-suggestion-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 99px;
  cursor: pointer;
  transition: var(--transition);
}

.tr-suggestion-chip:hover {
  background: var(--primary);
  color: var(--primary-foreground);
}

.tr-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.tr-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
}

.tr-history-item:hover {
  background: var(--bg-3);
  border-color: var(--primary);
}

.tr-history-orig {
  font-weight: 700;
  color: var(--text);
}

.tr-history-trans {
  color: var(--gold-soft);
  font-size: 0.8rem;
  font-family: var(--coptic-font);
}

.keyboard-keys-wrap {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 20px;
}

@media (min-width: 480px) {
  .keyboard-keys-wrap {
    grid-template-columns: repeat(8, 1fr);
  }
}

@media (min-width: 768px) {
  .keyboard-keys-wrap {
    grid-template-columns: repeat(11, 1fr);
  }
}

.kb-key-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--coptic-font);
  font-size: 1.4rem;
  padding: 10px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.kb-key-btn:hover {
  background: var(--primary-glow);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.kb-space-btn {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 10px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.kb-space-btn:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ============================================================
   5. CHURCH MODE (Liturgical Prayers & Vocabulary)
   ============================================================ */
/* Sub tabs */
.sub-tabs {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}

.sub-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
  transition: var(--transition);
}

.sub-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Prayers List */
.prayers-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.prayer-accordion-card {
  border-radius: var(--radius-sm);
}

.prayer-trigger-btn {
  width: 100%;
  background: transparent;
  border: none;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  font-weight: 700;
  text-align: right;
  transition: var(--transition);
}

.prayer-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.01);
}

.prayer-trigger-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prayer-icon-shield {
  width: 32px;
  height: 32px;
  background: var(--primary-glow);
  color: var(--primary);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.prayer-cat-badge {
  font-size: 0.65rem;
  background: var(--primary-glow);
  color: var(--primary);
  padding: 1px 8px;
  border-radius: 4px;
  margin-right: 8px;
}

.prayer-body-collapse {
  padding: 20px;
  background: rgba(255, 255, 255, 0.01);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.prayer-coptic-text {
  font-family: var(--coptic-font);
  font-size: 1.8rem;
  color: var(--gold-soft);
  line-height: 1.5;
  white-space: pre-line;
  margin-bottom: 8px;
  text-align: right;
}

.prayer-translit-text {
  font-size: 0.83rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: pre-line;
  margin-bottom: 20px;
}

.prayer-translations-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 16px;
}

@media (min-width: 768px) {
  .prayer-translations-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.prayer-trans-col-ar {
  text-align: right;
}

.prayer-trans-col-en {
  text-align: left;
  direction: ltr;
}

.prayer-trans-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}

.prayer-trans-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-dim);
  white-space: pre-wrap;
}

/* ============================================================
   6. PRACTICE TAB (Quiz, Flashcards, Match Game, Word Builder)
   ============================================================ */
.practice-hub-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Quiz UI elements */
.quiz-choices-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

@media (min-width: 540px) {
  .quiz-choices-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.quiz-choice-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 14px;
  cursor: pointer;
  text-align: right;
  transition: var(--transition);
}

.quiz-choice-btn:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border-light);
}

.quiz-choice-btn.selected {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
}

.quiz-choice-btn.correct {
  background: var(--green-glow);
  border-color: var(--green);
  color: var(--green);
}

.quiz-choice-btn.wrong {
  background: var(--red-glow);
  border-color: var(--red);
  color: var(--red);
}

/* Flashcard Styles */
.flashcard-wrapper {
  perspective: 1000px;
  width: 100%;
  max-width: 360px;
  height: 240px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard-wrapper.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.fc-side {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.fc-front {
  background: var(--bg-card);
}

.fc-back {
  background: var(--bg-3);
  transform: rotateY(180deg);
  border-color: var(--primary-glow);
}

.fc-coptic {
  font-family: var(--coptic-font);
  font-size: 2.2rem;
  color: var(--gold-soft);
}

/* Match Game elements */
.match-grid-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.match-card-compact {
  height: 70px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  font-size: 0.9rem;
}

.match-card-compact:hover {
  background: rgba(255, 255, 255, 0.02);
}

.match-card-compact.selected {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: var(--primary);
}

.match-card-compact.matched {
  border-color: var(--green);
  background: var(--green-glow);
  color: var(--green);
  opacity: 0.4;
  cursor: default;
}

.match-card-compact.coptic-text {
  font-family: var(--coptic-font);
  font-size: 1.3rem;
  color: var(--gold-soft);
}

/* Word Builder elements */
.builder-slots-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
  min-height: 46px;
  flex-wrap: wrap;
}

.builder-slot-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--coptic-font);
  font-size: 1.4rem;
  color: var(--gold-soft);
  cursor: pointer;
  transition: var(--transition);
}

.builder-slot-box.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.builder-slot-box.empty {
  border-style: dashed;
  background: transparent;
  cursor: default;
}

.builder-pool-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.01);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.builder-letter-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--coptic-font);
  font-size: 1.4rem;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}

.builder-letter-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* ============================================================
   7. MODAL OVERLAYS & DIALOGS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content-elegant {
  background: var(--bg-2);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.modal-body-pad {
  padding: 30px 24px 24px;
}

.modal-coptic-hero {
  font-family: var(--coptic-font);
  font-size: 2.6rem;
  color: var(--gold-soft);
  text-align: center;
  margin-top: 10px;
  line-height: 1.2;
}

.modal-translit-hero {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

.modal-actions-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  margin-bottom: 24px;
}

.modal-hero-speak-btn {
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 99px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.modal-hero-speak-btn:hover {
  opacity: 0.9;
}

.modal-hero-speak-btn.speaking,
.audio-btn.speaking,
.tr-bd-speak-btn.speaking,
.wotd-listen-btn.speaking,
.speaking-wave,
button.speaking {
  animation: speakingWave 1s infinite alternate !important;
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
  border-color: var(--gold) !important;
  box-shadow: 0 0 16px var(--gold-glow) !important;
}

@keyframes speakingWave {
  0% {
    transform: scale(1);
    box-shadow: 0 0 4px var(--gold-glow);
  }
  100% {
    transform: scale(1.08);
    box-shadow: 0 0 20px var(--gold-glow), 0 0 8px rgba(199, 155, 69, 0.6);
  }
}

.modal-hero-fav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.modal-hero-fav-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.modal-hero-fav-btn.favorite {
  color: #eab308;
  border-color: rgba(234, 179, 8, 0.3);
  background: var(--gold-glow);
}

.modal-detail-rows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.modal-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
}

.modal-detail-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.modal-detail-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dim);
}

.modal-detail-val.gr-font {
  font-family: var(--coptic-font);
}

.modal-tip-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
}

/* ============================================================
   8. TOAST NOTIFICATION
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 50%;
  transform: translateX(50%) translateY(100px);
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
  pointer-events: none;
  opacity: 0;
}

.toast.show {
  transform: translateX(50%) translateY(0);
  opacity: 1;
}

/* Animations */
@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
  }
}

/* Helper flex utilities */
.flex-row-flex {
  display: flex;
  align-items: center;
}

.justify-between-flex {
  justify-content: space-between;
}

.gap-flex-4 {
  gap: 16px;
}

.mt-6-margin {
  margin-top: 24px;
}

.text-right-align {
  text-align: right;
}

.perspective-1000 {
  perspective: 1000px;
}

.rotate-y-180 {
  transform: rotateY(180deg);
}

.style-preserve-3d {
  transform-style: preserve-3d;
}

.backface-hidden {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Virtual Keyboard Styling */
.keyboard-keys-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 8px;
  direction: ltr;
  margin-top: 10px;
}

.keyboard-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--coptic-font);
  font-size: 1.4rem;
  padding: 12px 6px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.keyboard-btn:hover {
  background: var(--primary);
  color: var(--primary-foreground);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.keyboard-btn.action-btn {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
}

.keyboard-btn.space-btn {
  grid-column: span 3;
}

/* Match Game Styling */
.match-grid-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
  direction: rtl;
}

.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 16px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70px;
  box-shadow: var(--shadow-sm);
}

.match-card.coptic-type {
  font-family: var(--coptic-font);
  font-size: 1.3rem;
  color: var(--gold-soft);
}

.match-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: var(--bg-3);
}

.match-card.selected {
  border-color: var(--primary);
  background: var(--primary-glow);
  box-shadow: 0 0 10px var(--primary-glow);
}

.match-card.matched {
  background: var(--green-glow) !important;
  border-color: var(--green) !important;
  color: var(--green) !important;
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
  transform: none !important;
}

.match-card.incorrect {
  background: var(--red-glow) !important;
  border-color: var(--red) !important;
  color: var(--red) !important;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Word Builder Styling */
.builder-slots-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px 0;
  flex-wrap: wrap;
  direction: ltr;
}

.builder-slot {
  width: 44px;
  height: 44px;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--coptic-font);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.01);
  transition: var(--transition);
}

.builder-slot.active {
  border-color: var(--primary);
  border-style: solid;
  background: var(--primary-glow);
}

.builder-slot.success {
  border-color: var(--green) !important;
  border-style: solid !important;
  background: var(--green-glow) !important;
  color: var(--green) !important;
}

.builder-slot.error {
  border-color: var(--red) !important;
  border-style: solid !important;
  background: var(--red-glow) !important;
  color: var(--red) !important;
  animation: shake 0.4s ease-in-out;
}

.builder-pool-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px 0;
  flex-wrap: wrap;
  direction: ltr;
}

.builder-letter-btn {
  width: 44px;
  height: 44px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--coptic-font);
  font-size: 1.4rem;
  font-weight: 700;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.builder-letter-btn:hover:not(:disabled) {
  background: var(--primary);
  color: var(--primary-foreground);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.builder-letter-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Flashcard Styling */
.flashcard-wrapper {
  width: 320px;
  height: 200px;
  perspective: 1000px;
  cursor: pointer;
  margin: 10px auto;
}

.flashcard-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard-wrapper.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.fc-side {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

.fc-side::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.fc-front {
  z-index: 2;
  transform: rotateY(0deg);
}

.fc-back {
  transform: rotateY(180deg);
  background: rgba(26, 21, 38, 0.85);
  border-color: rgba(234, 179, 8, 0.2);
}

.fc-coptic {
  font-family: var(--coptic-font);
  font-size: 2.5rem;
  color: var(--gold-soft);
  line-height: 1.2;
}

/* ============================================================
   Redesign CSS - Modern Elegant Coptic Heritage (Variables-based)
   ============================================================ */
body {
  background-color: var(--bg) !important;
  color: var(--text) !important;
  font-family: var(--font) !important;
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6, .welcome-title, .mobile-title, .trans-box-title {
  font-family: "Cairo", sans-serif !important;
  font-weight: 700 !important;
}
p, span, div, .welcome-desc, .welcome-subtitle {
  font-family: "Cairo", sans-serif !important;
  font-weight: 500 !important;
}
.sidebar-item-label-en, .wotd-en {
  font-family: "Inter", sans-serif !important;
}
.wotd-coptic, .detail-large-letter, .fc-coptic, #quizQWord {
  font-family: "Noto Sans Coptic", sans-serif !important;
}

/* Ornaments - Background */
body::after {
  background-image: 
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' fill='none' stroke='%23C79B45' stroke-width='1'%3E%3Cpath d='M10 10h10v10H10zM15 5v20M5 15h20'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' fill='none' stroke='%23C79B45' stroke-width='1'%3E%3Cpath d='M10 10h10v10H10zM15 5v20M5 15h20'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' fill='none' stroke='%23C79B45' stroke-width='1'%3E%3Cpath d='M10 10h10v10H10zM15 5v20M5 15h20'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' fill='none' stroke='%23C79B45' stroke-width='1'%3E%3Cpath d='M10 10h10v10H10zM15 5v20M5 15h20'/%3E%3C/svg%3E") !important;
  opacity: 0.05 !important;
}

/* Header */
.mobile-header {
  background: var(--bg-card) !important;
  border-bottom: 2px solid var(--gold) !important;
}
.mobile-header-top {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 8px 0 !important;
}
.mobile-header-top::before {
  display: none !important;
}
.mobile-logo-wrap {
  flex-shrink: 0 !important;
}
.mobile-logo {
  border-color: var(--gold) !important;
  width: 48px !important;
  height: 48px !important;
}
.mobile-title-wrap {
  text-align: center !important;
  flex: 1 !important;
}
.mobile-title {
  color: var(--text) !important;
  font-size: 1.2rem !important;
}
.mobile-title-sub {
  color: var(--text-muted) !important;
  font-size: 0.8rem !important;
}
.mobile-header-cross {
  width: auto !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 8px !important;
}
.mobile-header-cross svg {
  width: 24px !important;
  height: 24px !important;
  color: var(--gold) !important;
}

/* Hero Card (Welcome Banner) */
.welcome-banner {
  background: linear-gradient(135deg, #0F2D5C 0%, #163E72 100%) !important;
  border-radius: 20px !important;
  box-shadow: var(--shadow) !important;
  border: 1px solid var(--border-gold) !important;
  position: relative !important;
  overflow: hidden !important;
}
.welcome-banner-bg {
  opacity: 0.06 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' fill='none' stroke='%23C79B45' stroke-width='1'%3E%3Cpath d='M10 10h10v10H10zM15 5v20M5 15h20'/%3E%3C/svg%3E") !important;
  background-size: 60px !important;
}
.welcome-banner-content {
  display: flex !important;
  flex-direction: row-reverse !important;
}
.welcome-logo-wrapper {
  position: absolute !important;
  top: 20px !important;
  right: 20px !important;
  width: 70px !important;
  height: 70px !important;
  border-radius: 50% !important;
  border: 2px solid var(--gold) !important;
  background: var(--gold) !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 2px !important;
}
.welcome-logo-large {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  box-shadow: none !important;
}
.welcome-text {
  text-align: right !important;
  width: 100% !important;
  padding-right: 80px !important;
}
.welcome-title {
  color: #FFFFFF !important;
  font-size: 1.8rem !important;
}
.welcome-subtitle {
  color: #E6D7B8 !important;
  font-size: 1rem !important;
  margin-top: 5px !important;
}
.welcome-desc {
  color: #F8F5EE !important;
  font-size: 0.95rem !important;
  margin-top: 10px !important;
  max-width: 80% !important;
}

.header-theme-btn {
  position: absolute !important;
  top: 16px !important;
  left: 16px !important;
  z-index: 10 !important;
  width: 42px !important;
  height: 42px !important;
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  color: #FFFFFF !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
}
.header-theme-btn:hover {
  background: var(--gold) !important;
  color: #071022 !important;
  transform: translateY(-2px) scale(1.05) !important;
}

/* General Cards */
.card-elegant {
  background: var(--bg-card) !important;
  border-radius: 18px !important;
  border: 1px solid var(--border-light) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: var(--transition) !important;
  color: var(--text) !important;
}
.card-elegant::after, .card-elegant::before {
  display: none !important;
}
.card-elegant:hover {
  transform: translateY(-4px) !important;
  box-shadow: var(--shadow) !important;
  border-color: var(--gold) !important;
}

/* Stats Mini Cards */
.stat-item-premium {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 12px !important;
  padding: 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}
.stat-icon-wrap {
  background: var(--bg-3) !important;
  color: var(--gold) !important;
  border-radius: 8px !important;
  width: 40px !important;
  height: 40px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  font-size: 1.2rem !important;
}
.stat-value {
  color: var(--text) !important;
  font-weight: 700 !important;
}
.stat-label {
  color: var(--text-muted) !important;
  font-size: 0.8rem !important;
}

/* Buttons */
.wotd-link, .btn-primary {
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
  border-radius: 12px !important;
  border: none !important;
  transition: all 200ms ease-in-out !important;
  font-weight: 700 !important;
}
.wotd-link:hover, .btn-primary:hover {
  filter: brightness(1.1) !important;
  transform: translateY(-2px) !important;
  box-shadow: var(--shadow-gold) !important;
}

.secondary-btn {
  background: var(--gold) !important;
  color: #071022 !important;
  border-radius: 12px !important;
  transition: all 200ms ease-in-out !important;
  font-weight: 700 !important;
}
.secondary-btn:hover {
  filter: brightness(1.1) !important;
}

/* Word of the Day */
.wotd-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
}
.wotd-coptic {
  color: var(--gold) !important;
  font-size: 3rem !important;
}
.wotd-listen-btn {
  background: var(--primary) !important;
  color: var(--primary-foreground) !important;
  border-radius: 50px !important;
  width: 40px !important;
  height: 40px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 0 !important;
}
.wotd-listen-btn span {
  display: none !important;
}
.wotd-listen-btn svg {
  margin: 0 !important;
  color: var(--primary-foreground) !important;
}
.wotd-listen-btn:hover {
  filter: brightness(1.15) !important;
}

/* Progress Card */
.progress-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
}
.progress-bar-bg {
  background: var(--bg-3) !important;
  border-radius: 10px !important;
  height: 10px !important;
}
.progress-bar-fill {
  background: var(--gold) !important;
  border-radius: 10px !important;
}

/* Assistant / Analysis Card */
.analysis-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
}
.analysis-item-val {
  color: var(--text) !important;
  font-weight: 700 !important;
}
.analysis-item-title {
  color: var(--text-muted) !important;
}

/* Sidebar */
.app-sidebar {
  background: var(--sidebar) !important;
  border-left: 1px solid var(--sidebar-border) !important;
}
.sidebar-item {
  border-radius: 14px !important;
  color: #FFFFFF !important;
  opacity: 0.8 !important;
}
.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  opacity: 1 !important;
  color: #FFFFFF !important;
}
.sidebar-item.active {
  background: var(--gold) !important;
  color: #071022 !important;
  opacity: 1 !important;
  box-shadow: 0 4px 12px rgba(199, 155, 69, 0.35) !important;
  font-weight: 700 !important;
}
.sidebar-item.active svg {
  color: #071022 !important;
}
.sidebar-item svg {
  color: var(--gold) !important;
}
.sidebar-brand-name {
  color: var(--gold) !important;
}
.sidebar-brand-sub {
  color: rgba(255, 255, 255, 0.7) !important;
}
.sidebar-brand-name {
  color: #C79B45 !important;
}
.sidebar-brand-sub {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Icons Global */
svg {
  color: #C79B45;
}

/* Layout Spacing (Responsive) */
@media (max-width: 768px) {
  .welcome-text {
    padding-right: 0 !important;
    text-align: center !important;
    margin-top: 70px !important;
  }
  .welcome-logo-wrapper {
    top: 15px !important;
    right: 50% !important;
    transform: translateX(50%) !important;
  }
  .dashboard-grid {
    gap: 16px !important;
  }
}

/* ============================================================
   Translator & Keyboard Redesign
   ============================================================ */
.tr-lang-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.tr-lang-select-wrap {
  flex: 1;
}

.tr-lang-select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-3);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
}

.tr-swap-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tr-swap-btn:hover {
  background: var(--primary);
  color: white;
  transform: rotate(180deg);
}

.trans-input-wrapper {
  position: relative;
}

.large-textarea {
  min-height: 120px !important;
  font-size: 1.1rem;
  padding-bottom: 40px;
}

.tr-mic-btn {
  position: absolute;
  bottom: 12px;
  left: 12px; /* For RTL, it's the bottom-left corner */
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.tr-mic-btn:hover {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: var(--primary);
}

.tr-mic-btn.recording {
  background: var(--red);
  color: white;
  border-color: var(--red);
  animation: pulse 1s infinite alternate;
}

.tr-suggestions-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  min-height: 32px;
}

.tr-suggestion-chip {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tr-suggestion-chip:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.tr-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.tr-action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tr-action-btn:hover {
  background: var(--bg-3);
  color: var(--text);
}

.tr-main-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.tr-main-btn:hover {
  background: #163E72;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 45, 92, 0.2);
}

.tr-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.tr-result-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.tr-result-actions {
  display: flex;
  gap: 8px;
}

.tr-icon-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.tr-icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: var(--text-dim);
}

.tr-fav-btn.favorite {
  color: #FACC15;
  border-color: #FACC15;
  background: rgba(250, 204, 21, 0.1);
}
.tr-fav-btn.favorite svg {
  fill: #FACC15;
}

.tr-result-content {
  min-height: 80px;
}

.tr-smart-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tr-smart-btn:hover {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: var(--primary);
}

.tr-smart-card {
  margin-top: 12px;
  padding: 14px;
  background: rgba(199, 155, 69, 0.05);
  border-right: 4px solid #C79B45;
  border-radius: 8px;
}

.tr-smart-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.tr-smart-card-text {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
}

.tr-analysis-card {
  margin-top: 24px;
  padding: 20px;
}

.tr-analysis-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.tr-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.tr-analysis-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tr-analysis-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tr-analysis-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dim);
}

.tr-history-card {
  margin-top: 24px;
  padding: 20px;
}

.tr-history-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.tr-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tr-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.tr-history-item:hover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.02);
}

.tr-history-orig {
  font-weight: 700;
  color: var(--text);
  font-size: 0.9rem;
}

.tr-history-trans {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Modern Keyboard Refinements */
.modern-keyboard .keyboard-btn {
  border-radius: 8px;
  box-shadow: 0 2px 0 var(--border);
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 2px;
  transition: all 0.1s;
}

.modern-keyboard .keyboard-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--border);
}

.modern-keyboard .keyboard-btn.golden-press {
  background: #FACC15 !important;
  color: #1A1A1A !important;
  border-color: #FACC15 !important;
  box-shadow: 0 0 0 #FACC15 !important;
  transform: translateY(2px) !important;
}

/* ============================================================
   PREMIUM DICTIONARY UPGRADE (v4.0)
   ============================================================ */

/* Top Stats Bar */
.dict-stats-top {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.dict-stat-item {
  flex: 1;
  min-width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}
.dict-stat-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}
.dict-stat-icon {
  font-size: 24px;
}
.dict-stat-text {
  display: flex;
  flex-direction: column;
}
.dict-stat-val {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.dict-stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Recent Words */
.recent-words-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(181, 138, 51, 0.05);
  border-radius: 99px;
  padding: 8px 16px;
  overflow-x: auto;
  white-space: nowrap;
}
.recent-words-wrap::-webkit-scrollbar { display: none; }
.recent-words-lbl {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
}
.recent-words-list {
  display: flex;
  gap: 8px;
}
.recent-word-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 4px 12px;
  border-radius: 99px;
  font-family: var(--coptic-font);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}
.recent-word-chip:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Premium Search */
.premium-search-container {
  position: relative;
  z-index: 20;
}
.premium-search {
  padding-right: 48px !important;
  font-size: 1.1rem;
  height: 54px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s;
}
.premium-search:focus {
  box-shadow: 0 0 0 4px rgba(21, 74, 145, 0.15);
  transform: scale(1.01);
}
.search-autocomplete {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 8px;
}
.search-autocomplete-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  text-align: right;
  border: none;
  background: transparent;
  width: 100%;
}
.search-autocomplete-item:hover, .search-autocomplete-item.active-item {
  background: rgba(181, 138, 51, 0.1);
}
.ac-coptic {
  font-family: var(--coptic-font);
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--primary);
}
.ac-ar {
  font-size: 0.9rem;
  color: var(--text-dim);
}
.ac-match {
  background: rgba(181, 138, 51, 0.3);
  color: var(--gold);
  border-radius: 2px;
  padding: 0 2px;
}

/* Modern Chips */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text);
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
.chip-btn:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.chip-btn.active {
  background: var(--gold);
  color: var(--primary-foreground);
  border-color: transparent;
  box-shadow: var(--shadow-gold);
}

/* Advanced Filters */
.advanced-filters-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}
.premium-select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}
.premium-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(181, 138, 51, 0.2);
}
.filters-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  border-top: 1px dashed var(--border-light);
  padding-top: 16px;
}
.toggle-lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
}
.toggle-lbl input[type="checkbox"] {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Premium Word Card */
.premium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.premium-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.premium-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: var(--gold-soft);
}
.card-bg-letter {
  position: absolute;
  top: -10px;
  left: -10px;
  font-family: var(--coptic-font);
  font-size: 8rem;
  color: var(--text);
  opacity: 0.03;
  pointer-events: none;
  line-height: 1;
  z-index: 0;
  transition: all 0.5s ease;
}
.premium-card:hover .card-bg-letter {
  opacity: 0.06;
  transform: scale(1.1) rotate(-5deg);
  color: var(--gold);
}
.card-content {
  position: relative;
  z-index: 1;
}
.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.card-coptic-wrap {
  display: flex;
  flex-direction: column;
}
.p-coptic {
  font-family: var(--coptic-font);
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--primary);
  line-height: 1.2;
}
.p-phon {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  font-family: 'Inter', sans-serif;
}
.p-meanings {
  margin-bottom: 16px;
}
.p-ar {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.p-en {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  margin-top: 2px;
}
.p-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.p-tag {
  background: var(--bg);
  border: 1px solid var(--border-light);
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 600;
}
.card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}
.card-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.card-btn:hover {
  background: var(--bg);
  color: var(--primary);
}
.card-btn.fav-btn:hover, .card-btn.fav-btn.active {
  color: #ef4444;
}
.card-btn.active svg {
  fill: #ef4444;
}
.card-btn.audio-btn:active svg {
  animation: pulse 0.3s cubic-bezier(0.4, 0, 0.6, 1);
}

/* Pagination */
.premium-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.page-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.page-numbers {
  display: flex;
  gap: 4px;
}
.page-btn.active-page {
  background: var(--gold);
  color: #111;
  border-color: var(--gold);
}
.pagination-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.mini-select {
  padding: 4px 8px;
  border-radius: 6px;
}

/* Premium Modal Overlay */
.modal-content-premium {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  width: 90%;
  max-width: 600px;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  transform: scale(0.95);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.show .modal-content-premium {
  transform: scale(1);
  opacity: 1;
}
.premium-close {
  position: absolute;
  top: 16px;
  left: 16px; /* RTL layout */
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}
.premium-close:hover {
  background: #ef4444;
  color: #fff;
  transform: rotate(90deg);
}
.modal-premium-header {
  background: linear-gradient(135deg, var(--bg-2), var(--bg));
  padding: 40px 32px 24px;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
}
.modal-coptic-hero {
  font-family: var(--coptic-font);
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1.1;
  text-shadow: 0 4px 12px rgba(181, 138, 51, 0.2);
}
.modal-translit-hero {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 1px;
}
.modal-actions-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}
.modal-hero-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 99px;
  border: 1px solid var(--border-light);
  background: var(--bg-3);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-hero-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.modal-hero-btn.btn-audio {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.modal-hero-btn.btn-audio:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: #111;
}
.modal-hero-fav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-3);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-hero-fav-btn:hover, .modal-hero-fav-btn.active {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}
.modal-hero-fav-btn.active svg {
  fill: #ef4444;
  animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}
.modal-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 12px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}
.modal-tab:hover {
  color: var(--text);
}
.modal-tab.active {
  color: var(--gold);
}
.modal-tab.active::after {
  content: "";
  position: absolute;
  bottom: -9px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
  border-radius: 2px 2px 0 0;
}

/* Modal Tab Content */
.modal-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-detail-card {
  background: var(--bg-3);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}
.modal-detail-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.modal-detail-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-suggested-wrap {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-light);
}
.modal-suggested-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 12px;
}
.modal-suggested-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.modal-suggested-list::-webkit-scrollbar { height: 4px; }
.modal-suggested-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.suggested-card {
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 16px;
  min-width: 120px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.suggested-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}
.sg-coptic {
  font-family: var(--coptic-font);
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 2px;
}
.sg-ar {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.empty-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.ripple {
  position: absolute;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: scale(0);
  animation: ripple-effect 0.6s linear;
  pointer-events: none;
}
@keyframes ripple-effect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ============================================================
   Search Mode Tabs & API Badges (Online Coptic Dictionary)
   ============================================================ */
.search-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.search-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.search-mode-btn:hover {
  background: var(--bg-3);
  border-color: var(--primary);
  color: var(--text);
}

.search-mode-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 4px 14px rgba(199, 155, 69, 0.25);
}

.search-mode-badge {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
}

.search-mode-btn.active .search-mode-badge {
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
}

.online-badge {
  background: rgba(72, 187, 120, 0.2);
  color: #48bb78;
}

.search-mode-btn.active .online-badge {
  background: rgba(0, 0, 0, 0.25);
  color: #e6fffa;
}

/* API Entry Card Styles */
.api-entry-card {
  border-right: 3px solid #38b2ac !important;
}

.p-api-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 178, 172, 0.15);
  color: #38b2ac;
  border: 1px solid rgba(56, 178, 172, 0.3);
}

.p-dialect-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(199, 155, 69, 0.15);
  color: var(--gold-soft);
  border: 1px solid rgba(199, 155, 69, 0.3);
}

.card-badges-wrap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.p-pos-tag {
  background: rgba(66, 153, 225, 0.15) !important;
  color: #4299e1 !important;
  border: 1px solid rgba(66, 153, 225, 0.25) !important;
}

.p-tag-greek {
  font-size: 0.8rem;
  direction: ltr;
}

/* API Loading State */
.api-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(199, 155, 69, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.api-lookup-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================================
   أنماط التقويم القبطي المباشر (Coptic Date Card)
   ============================================================ */
.coptic-date-card {
  background: linear-gradient(135deg, rgba(199, 155, 69, 0.08) 0%, rgba(20, 22, 33, 0.95) 100%);
  border: 1px solid rgba(199, 155, 69, 0.25);
  position: relative;
  overflow: hidden;
}

.coptic-date-card::before {
  content: "✝";
  position: absolute;
  left: -10px;
  bottom: -15px;
  font-size: 6rem;
  color: rgba(199, 155, 69, 0.04);
  pointer-events: none;
  font-family: serif;
}

.coptic-date-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.coptic-date-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(199, 155, 69, 0.12);
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid rgba(199, 155, 69, 0.2);
}

.coptic-date-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.coptic-date-day-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.coptic-date-day-num {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--gold-soft);
  line-height: 1;
  font-family: 'Cairo', sans-serif;
}

.coptic-date-month-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
}

.coptic-date-coptic-text {
  font-size: 1.3rem;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.coptic-date-year {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.coptic-date-proverb {
  margin-top: 6px;
  font-size: 0.82rem;
  color: rgba(248, 244, 234, 0.85);
  font-style: italic;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border-right: 3px solid var(--gold);
}

/* ============================================================
   أنماط قسم القواعد وتصريف الأفعال (Grammar & Conjugation)
   ============================================================ */
.verb-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 0;
}

.verb-preset-chip {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.verb-preset-chip:hover, .verb-preset-chip.active {
  background: rgba(199, 155, 69, 0.18);
  border-color: var(--gold);
  color: var(--gold-soft);
}

.conjugator-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  align-items: flex-end;
}

.conjugation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.conjugation-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: var(--transition);
}

.conjugation-card:hover {
  border-color: rgba(199, 155, 69, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.conj-person-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(199, 155, 69, 0.1);
  padding: 2px 8px;
  border-radius: 99px;
  align-self: flex-start;
}

.conj-coptic-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.conj-coptic-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.conj-coptic-prefix {
  color: var(--gold);
  font-weight: 800;
}

.conj-phonetic {
  font-size: 0.82rem;
  color: var(--text-dim);
  font-style: italic;
  font-family: 'Inter', sans-serif;
  direction: ltr;
  text-align: right;
}

.conj-meanings {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 6px;
  margin-top: 4px;
}

/* جدول القواعد */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.grammar-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.88rem;
}

.grammar-table th {
  background: rgba(199, 155, 69, 0.12);
  color: var(--gold-soft);
  padding: 12px 14px;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
}

.grammar-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.grammar-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* كروت الأدوات والجنكم */
.gram-rule-item {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.gram-rule-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 6px;
}

.gram-rule-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.6;
}

.gram-rule-example-box {
  background: rgba(0, 0, 0, 0.25);
  border-right: 3px solid var(--primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ============================================================
   أنماط حاسبة الأرقام القبطية (Numerals Converter)
   ============================================================ */
.num-converter-result-card {
  background: linear-gradient(135deg, rgba(20, 24, 38, 0.95), rgba(12, 14, 22, 0.95));
  border: 1px solid rgba(199, 155, 69, 0.3);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  max-width: 480px;
  margin: 20px auto 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.num-symbol-big {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--gold-soft);
  line-height: 1.1;
  text-shadow: 0 0 20px rgba(199, 155, 69, 0.3);
}

.num-written-cop {
  font-size: 1.4rem;
  color: var(--text);
  font-weight: 700;
  margin-top: 8px;
}

.num-phon {
  font-size: 0.95rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 2px;
}

.num-meanings {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 600;
}

/* ============================================================
   أنماط تحدي الاستماع الصوتي (Audio Quiz Challenge)
   ============================================================ */
.audio-quiz-play-btn {
  background: linear-gradient(135deg, rgba(199, 155, 69, 0.2), rgba(199, 155, 69, 0.05));
  border: 2px solid var(--gold);
  color: var(--gold-soft);
  padding: 16px 32px;
  border-radius: 99px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
  box-shadow: 0 0 25px rgba(199, 155, 69, 0.2);
}

.audio-quiz-play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 35px rgba(199, 155, 69, 0.4);
  background: rgba(199, 155, 69, 0.3);
}

.audio-quiz-choices-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 600px) {
  .audio-quiz-choices-grid {
    grid-template-columns: 1fr;
  }
}

.audio-quiz-opt-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  transition: var(--transition);
}

.audio-quiz-opt-btn:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(199, 155, 69, 0.08);
  transform: translateY(-2px);
}

.audio-quiz-opt-btn.correct {
  background: rgba(34, 197, 94, 0.2) !important;
  border-color: #22c55e !important;
  color: #22c55e !important;
}

.audio-quiz-opt-btn.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

.audio-revealed-inner {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(199, 155, 69, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}

.audio-revealed-cop {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-soft);
}

.audio-revealed-phon {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
}

.audio-revealed-speak {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ============================================================
   أنماط الطباعة للبطاقات التعليمية (@media print)
   ============================================================ */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .app-sidebar,
  .mobile-header,
  .sidebar-nav,
  .theme-toggle-btn,
  .filters-row-flex,
  .btn-print-favs,
  .search-wrapper,
  .load-more-wrap,
  .modal-overlay,
  .toast {
    display: none !important;
  }

  .content-area {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .tab-panel {
    display: block !important;
  }

  .words-cards-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
    page-break-inside: auto;
  }

  .word-card {
    border: 1px solid #ccc !important;
    background: #fafafa !important;
    color: #000 !important;
    page-break-inside: avoid;
    box-shadow: none !important;
    padding: 10px !important;
  }

  .word-card-coptic {
    color: #000 !important;
    font-size: 1.3rem !important;
  }

  .word-card-meaning-ar {
    color: #333 !important;
  }
}



