/* ==========================
   FONTS
========================== */
/* Self-hosted (not Google Fonts) so the Arabic text font is available
   offline and never flashes a fallback while a remote stylesheet loads --
   only the Arabic-range subset is bundled since this font is never used
   for Latin text in the app. font-display: block (not swap) so a slow load
   leaves Arabic text briefly invisible instead of flashing a fallback serif
   that renders Uthmani diacritics wrong. */
@font-face {
  font-family: 'Scheherazade New';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('/fonts/scheherazade-new-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Scheherazade New';
  font-style: normal;
  font-weight: 500;
  font-display: block;
  src: url('/fonts/scheherazade-new-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Scheherazade New';
  font-style: normal;
  font-weight: 600;
  font-display: block;
  src: url('/fonts/scheherazade-new-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Scheherazade New';
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url('/fonts/scheherazade-new-700.woff2') format('woff2');
}

/* ==========================
   APP LAYOUT
========================== */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.base-container {
  height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #f0f2f5;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    /* touch-action: none; */
    user-select: none;
    /* padding: 1rem; */
    box-sizing: border-box;
}

/* Main content below topbar */
#app-container {
  flex: 1;                   /* fills remaining space below topbar */
  display: flex;             /* left / middle / right columns */
  gap: 1rem;
  padding: 1rem;
  box-sizing: border-box;
  background: #f0f2f5;
  overflow-y: auto;           /* scrollable content */
}

/* ==========================
   TOPBAR
========================== */
.topbar {
  position: sticky;           /* stays on top */
  top: 0;
  z-index: 1000;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background-color: #fff7dd;
  color: rgb(31, 17, 3);
}

/* Topbar logo */
.topbar img {
  height: 40px;
  width: auto;
  object-fit: contain;
  cursor: pointer;
}

/* User Avatar */
.user-avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.placeholder-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #ebdfb1;
}

.head-buffer {
  margin-top:50px;
}

/* ==========================
   SECTIONS (CARD, MIDDLE, DICTIONARY)
========================== */
.section {
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Desktop column widths */
.left { flex: 1; max-width: 25%; }
.middle { flex: 2; max-width: 50%; display: flex; flex-direction: column; gap: 1rem; align-items: center; position: relative; }
.right { flex: 1; max-width: 25%; }


/* ==========================
   CARD SENTENCE / FLASHCARD
========================== */
.card-header { font-size: 1.5rem; font-weight: bold; margin-bottom: 10px; }

.card-sentence {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.card-word {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.card-word:hover {
  background-color: #e1f5fe;
  border: 1.5px solid #82ffa5;
}

#card-sentence-translation { min-height: 36px; }
#card-word-translation { min-height: 24px; }

/* Flashcard container */
#flashcard {
  position: relative;
  margin: 20px auto;
  max-width: 90%;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  text-align: center;
}

/* Close button for flashcard */
.close-card-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background-color: #f44336;
  color: #fff;
  font-weight: bold;
  font-size: 16px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  z-index: 10;
  padding: 0;
  transition: background 0.2s;
}
.close-card-btn:hover { background-color: #d32f2f; }

/* ==========================
   BUTTONS
========================== */
.action-btn,
.get-btn,
.controls button {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background-color: #000000;
  color: #fff;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.2s;
}
.action-btn:hover,
.get-btn:hover,
.controls button:hover { background-color: #1565c0; }

.save-btn {
  margin-top: 15px;
  padding: 8px 16px;
  border-radius: 6px;
  background-color: #4caf50;
  color: white;
  border: none;
  cursor: pointer;
  align-self: center;
}
.save-btn:hover { background-color: #45a049; }

/* ==========================
   CONTROLS
========================== */
.controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}



/* ==========================
   DRAWER OVERLAY
========================== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 50;
}

/* ==========================
   MOBILE RESPONSIVE
========================== */
@media (max-width: 900px) {
  #app-container {
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem;
  }

  .middle { max-width: 100%; width: 100%; }
  .left, .right {
    position: fixed;
    top: 0;
    height: 100vh;
    width: 100%;
    background: #fff;
    z-index: 100;
    transition: transform 0.3s ease;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
  }

  .left { left: 0; transform: translateX(-100%); }
  .right { right: 0; transform: translateX(100%); }
  .left.open, .right.open { transform: translateX(0); }
}

/* ==========================
   SHIMMER PLACEHOLDERS
========================== */
.shimmer-line {
  height: 18px;
  width: 80%;
  max-width: 300px;
  background: linear-gradient(90deg, #eee 25%, #ddd 50%, #eee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  margin: 8px auto;
  border-radius: 4px;
}
.shimmer-small { width: 150px; height: 16px; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ==========================
   SPLASH / LOADING
========================== */
.splash {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: white;
}
.pulse { width: 80px; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity:0.6; transform: scale(1.03);} }




/* ==========================
   MOBILE CONTROL WRAPPER
========================== */
.mobile-control-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Each row */
.btn-row {
  width: 100%;
  display: flex;
  align-items: center;
}

.btn-row:first-child {
  gap: 2px;
}



/* ==========================
   MOBILE ONLY
========================== */
@media (min-width: 901px) {
  .mobile-control-buttons {
    display: none;
  }
}

.fade-top {
  z-index: -1;
  position: absolute;
  bottom: 0px;
  opacity: 0.5;

mask-image: linear-gradient(
  to bottom,
  transparent 0%,
  black 50%
);

-webkit-mask-image: linear-gradient(
  to bottom,
  transparent 0%,
  black 90%
);
}