/*
 * Quran Recitation Helper - Enhanced Stylesheet
 * Creative, Responsive, Accessible Design
 */

/*----------------------------------------------------------------------------*\
 *  :: Root Variables & Base Styles
\*----------------------------------------------------------------------------*/
:root {
  --primary-hue: 150; /* Green Hue */
  --secondary-hue: 45; /* Gold Hue */

  /* Light Mode */
  --primary-color-light: hsl(var(--primary-hue), 50%, 45%); /* #3a9d74 */
  --primary-dark-light: hsl(var(--primary-hue), 55%, 35%); /* #2a7a58 */
  --secondary-color-light: hsl(var(--secondary-hue), 65%, 55%); /* #d4af37 */
  --accent-color-light: hsl(var(--primary-hue), 40%, 60%);
  --bg-color-light: #f7f9f9; /* Off-white */
  --card-bg-light: #ffffff;
  --text-color-light: #333;
  --muted-text-light: #666;
  --border-color-light: #e0e5e8;
  --shadow-color-light: rgba(40, 60, 50, 0.1);
  --highlight-bg-light: hsla(var(--primary-hue), 50%, 45%, 0.08);
  --pending-bg-light: #f0f0f0;
  --pending-text-light: #a0a0a0;

  /* Dark Mode */
  --primary-color-dark: hsl(var(--primary-hue), 45%, 55%); /* #5dc299 */
  --primary-dark-dark: hsl(var(--primary-hue), 50%, 65%); /* #75cca5 */
  --secondary-color-dark: hsl(var(--secondary-hue), 55%, 65%); /* #e1c468 */
  --accent-color-dark: hsl(var(--primary-hue), 35%, 45%);
  --bg-color-dark: #1a1d1c; /* Dark Gray-Green */
  --card-bg-dark: #252a28;
  --text-color-dark: #e8f0ec;
  --muted-text-dark: #a0b0a8;
  --border-color-dark: #353d3a;
  --shadow-color-dark: rgba(0, 0, 0, 0.3);
  --highlight-bg-dark: hsla(var(--primary-hue), 45%, 55%, 0.15);
  --pending-bg-dark: #303533;
  --pending-text-dark: #889;


  /* Assign Light Mode by default */
  --primary-color: var(--primary-color-light);
  --primary-dark: var(--primary-dark-light);
  --secondary-color: var(--secondary-color-light);
  --accent-color: var(--accent-color-light);
  --bg-color: var(--bg-color-light);
  --card-bg: var(--card-bg-light);
  --text-color: var(--text-color-light);
  --muted-text: var(--muted-text-light);
  --border-color: var(--border-color-light);
  --shadow-color: var(--shadow-color-light);
  --highlight-bg: var(--highlight-bg-light);
  --pending-bg: var(--pending-bg-light);
  --pending-text: var(--pending-text-light);

  /* Typography */
  --ui-font: 'Readex Pro', 'Segoe UI', 'Roboto', sans-serif;
  --arabic-font: 'Amiri', 'Noto Naskh Arabic', serif;
  --base-font-size: 16px;

  /* Layout & Effects */
  --border-radius: 12px;
  --card-padding: 20px;
  --transition-speed: 0.3s;
  --box-shadow: 0 4px 15px var(--shadow-color);
  --box-shadow-hover: 0 6px 20px var(--shadow-color);
}

/* Apply Dark Mode Variables */
body.dark-mode {
  --primary-color: var(--primary-color-dark);
  --primary-dark: var(--primary-dark-dark);
  --secondary-color: var(--secondary-color-dark);
  --accent-color: var(--accent-color-dark);
  --bg-color: var(--bg-color-dark);
  --card-bg: var(--card-bg-dark);
  --text-color: var(--text-color-dark);
  --muted-text: var(--muted-text-dark);
  --border-color: var(--border-color-dark);
  --shadow-color: var(--shadow-color-dark);
  --highlight-bg: var(--highlight-bg-dark);
  --pending-bg: var(--pending-bg-dark);
  --pending-text: var(--pending-text-dark);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--base-font-size);
  scroll-behavior: smooth;
}

body {
  font-family: var(--ui-font);
  line-height: 1.6;
  background-color: var(--bg-color);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  min-height: 100vh;
}

/* Add transitions only after load */
body.transitions-enabled *,
body.transitions-enabled *::before,
body.transitions-enabled *::after {
   transition: background-color var(--transition-speed) ease,
               color var(--transition-speed) ease,
               border-color var(--transition-speed) ease,
               box-shadow var(--transition-speed) ease,
               opacity var(--transition-speed) ease,
               transform var(--transition-speed) ease;
}


/* Background Pattern */
.page-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  transition: opacity var(--transition-speed) ease; /* Fade slightly in dark mode */
}

body.dark-mode .page-background {
  opacity: 0.03;
}

/* Main Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/*----------------------------------------------------------------------------*\
*  :: Typography & Common Elements
\*----------------------------------------------------------------------------*/
h1, h2, h3, h4, h5, h6 {
  color: var(--primary-dark);
  font-weight: 600;
  line-height: 1.3;
}

.app-header {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 20px;
}

/* Header top layout for language switch */
.app-header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}

/* Settings Floating Action Button */
.settings-menu-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
  z-index: 998;
  font-size: 1.3rem;
}

.settings-menu-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2), 0 4px 8px rgba(0,0,0,0.15);
  width: auto;
  padding: 0 20px;
  border-radius: 28px;
}

.settings-menu-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px hsla(var(--primary-hue), 50%, 45%, 0.3), 0 6px 20px rgba(0,0,0,0.2);
}

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

/* Settings button text */
.settings-menu-btn .fa-gear {
  transition: margin-right 0.3s ease;
}

.settings-menu-btn .settings-text {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.3s ease, margin-left 0.3s ease;
  margin-left: 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: white;
}

.settings-menu-btn:hover .settings-text {
  max-width: 80px;
  margin-left: 8px;
}

/* Home/Return Button - Icon Only, Static Top-Left */
.home-button {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: white;
  text-decoration: none;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
  z-index: 1000;
}

.home-button:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2), 0 4px 8px rgba(0,0,0,0.15);
  text-decoration: none;
}

.home-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px hsla(var(--primary-hue), 50%, 45%, 0.3), 0 6px 20px rgba(0,0,0,0.2);
}

.home-button:active {
  transform: translateY(-1px) scale(0.98);
}

.home-button i {
  font-size: 1.2rem;
}

/* Profile/User Button - Icon Only, Static Top-Right */
.user-profile-btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border: none;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.user-profile-btn-icon:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2), 0 4px 8px rgba(0,0,0,0.15);
}

.user-profile-btn-icon:focus {
  outline: none;
  box-shadow: 0 0 0 3px hsla(var(--primary-hue), 50%, 45%, 0.3), 0 6px 20px rgba(0,0,0,0.2);
}

.user-profile-btn-icon:active {
  transform: translateY(-1px) scale(0.98);
}

.user-profile-btn-icon .user-avatar {
  background: transparent;
  color: white;
  font-size: 1.2rem;
  width: auto;
  height: auto;
}

.user-profile-btn-icon .user-avatar i {
  color: white;
  transition: color 0.2s ease;
}

/* Support initial-letter avatar */
.user-profile-btn-icon .avatar-initial {
  color: white;
  transition: color 0.2s ease;
  font-weight: 700;
}

/* Ensure icon-only variant overrides base auth button styles */
.user-profile-btn.user-profile-btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border: none;
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
}

/* Keep gradient on hover and swap icon color to dark green */
.user-profile-btn.user-profile-btn-icon:hover {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border: none;
}

.user-profile-btn-icon:hover .user-avatar i,
.user-profile-btn-icon:hover .avatar-initial {
  color: var(--primary-dark);
}

/* Settings Modal */
.settings-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Responsive adjustments for corner buttons (match profile/settings behavior) */
@media (max-width: 768px) {
  .home-button {
    top: calc(16px + env(safe-area-inset-top, 0px));
    left: calc(16px + env(safe-area-inset-left, 0px));
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 480px) {
  .home-button {
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: calc(12px + env(safe-area-inset-left, 0px));
    width: 48px;
    height: 48px;
  }
}

.settings-content {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: 0 10px 40px var(--shadow-color);
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.settings-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--highlight-bg);
}

.settings-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0;
}

.settings-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted-text);
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.settings-close-btn:hover {
  background: var(--border-color);
  color: var(--text-color);
}

.settings-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Language Options */
.lang-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lang-option {
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  color: var(--text-color);
  font-size: 0.9rem;
}

.lang-option:hover {
  background: var(--highlight-bg);
}

.lang-option.active {
  background: var(--primary-color);
  color: white;
}

.lang-option .lang-code {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-color);
  background: var(--highlight-bg);
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 24px;
  text-align: center;
  transition: all 0.2s ease;
}

.lang-option.active .lang-code {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.lang-option .lang-name {
  font-weight: 500;
}

/* Setting Items */
.setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.setting-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 24px;
  transition: .2s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: .2s;
}

.setting-toggle input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

.setting-toggle input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.setting-label {
  font-size: 0.9rem;
  color: var(--text-color);
  line-height: 1.4;
}

/* Font switching by language */
html[lang="ar"] body { font-family: var(--arabic-font); }
html[lang="en"] body { font-family: var(--ui-font); }

/* RTL friendly icon spacing and select caret */
html[dir="rtl"] .icon { margin-left: 8px; margin-right: 0; }
html[dir="rtl"] .select-wrapper::after { right: auto; left: 12px; }

.app-title {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.subtitle {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--muted-text);
  font-weight: 400;
}

.subtitle .fa-microphone-lines {
  color: var(--accent-color);
  margin-left: 5px;
}

.icon {
  margin-right: 8px;
  color: var(--accent-color);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/*----------------------------------------------------------------------------*\
*  :: Cards
\*----------------------------------------------------------------------------*/
.card {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  margin-bottom: 25px;
  box-shadow: var(--box-shadow);
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.card:hover {
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-2px);
}

.card-header {
  padding: 15px var(--card-padding);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  background-color: hsla(var(--primary-hue), 50%, 95%, 0.3); /* Very light tint */
}

.card-header .card-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* RTL Support - Move actions to the left side in RTL languages */
html[dir="rtl"] .card-header .card-actions,
body.rtl-mode .card-header .card-actions {
  margin-left: 0;
  margin-right: auto;
}

body.dark-mode .card-header {
   background-color: rgba(0,0,0,0.1);
}

.card-title {
  font-size: 1.25rem;
  color: var(--primary-dark);
  margin: 0;
}

.card-title .icon {
   color: var(--primary-color);
}


.card-body {
  padding: var(--card-padding);
}

.card-divider {
  border: none;
  height: 1px;
  background-color: var(--border-color);
  margin: 0;
}

/* Specific Card Styling */
.selection-card .form-group:last-child {
  margin-bottom: 0;
}

.display-feedback-card .ayah-display-container {
  margin-bottom: 0; /* Remove margin as divider handles spacing */
}

/*----------------------------------------------------------------------------*\
*  :: Forms & Controls
\*----------------------------------------------------------------------------*/
.selection-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  align-items: end;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 5px;
  color: var(--muted-text);
}

/* Select Wrapper for custom arrow */
.select-wrapper {
  position: relative;
  width: 100%;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: calc(var(--border-radius) / 1.5);
  padding: 10px 30px 10px 12px;
  font-size: 1rem;
  font-family: var(--ui-font);
  color: var(--text-color);
  cursor: pointer;
  width: 100%;
  height: 44px; /* Ensure good tap target size */
  transition: border-color var(--transition-speed) ease;
}

select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px hsla(var(--primary-hue), 50%, 50%, 0.2);
}

.select-wrapper::after {
  content: '\f078'; /* Font Awesome caret-down */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--muted-text);
  pointer-events: none;
  transition: color var(--transition-speed) ease;
}

select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: rgba(128, 128, 128, 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: calc(var(--border-radius) / 1.5);
  cursor: pointer;
  text-align: center;
  min-height: 44px; /* Tap target size */
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* Icon buttons in card actions */
.card-header .card-actions .btn {
  padding: 8px 10px;
  min-height: 36px;
}
.card-header .card-actions .btn .icon { margin-right: 0; }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,0.04); }
body.dark-mode .btn-ghost:hover { background: rgba(255,255,255,0.06); }

/* Reveal button: no click highlight/active transform */
.card-header .card-actions .btn-reveal::before { content: none; }
.card-header .card-actions .btn-reveal:hover::before { opacity: 0; }
.card-header .card-actions .btn-reveal:active { transform: none; }
.card-header .card-actions .btn-reveal { background: transparent; }

.btn .icon {
  margin-right: 8px;
}

/* RTL Support for button icons */
html[dir="rtl"] .btn .icon,
body.rtl-mode .btn .icon {
  margin-right: 0;
  margin-left: 8px;
}

.btn::before { /* For hover effect */
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity var(--transition-speed) ease;
  z-index: -1;
}

.btn:hover::before {
  opacity: 1;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  background-color: #bdc3c7; /* Neutral disabled color */
}
body.dark-mode .btn:disabled {
   background-color: #555;
   color: #999;
}


.btn-primary {
  background-color: var(--primary-color);
  color: white;
}
.btn-primary:hover:not(:disabled) { background-color: var(--primary-dark); }

.btn-warning {
  background-color: var(--secondary-color);
  color: var(--bg-color); /* Adjust text color for gold */
}
body.dark-mode .btn-warning { color: #333; }
.btn-warning:hover:not(:disabled) { background-color: hsl(var(--secondary-hue), 65%, 45%); }

.btn-secondary {
  background-color: var(--accent-color);
  color: white;
}
.btn-secondary:hover:not(:disabled) { background-color: hsl(var(--primary-hue), 40%, 50%); }

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}


/* Debug Controls Styling */
.debug-controls {
    background: var(--highlight-bg);
    border-radius: 8px;
    padding: 15px;
    border: 1px dashed var(--primary-color);
}

.debug-controls .btn {
    font-size: 0.9rem;
    padding: 8px 12px;
}

.debug-controls .btn .icon {
    font-size: 0.9rem;
}

/* Recognition Debug Display */
.recognition-debug {
    background: var(--card-bg);
    border: 2px solid var(--secondary-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
    box-shadow: var(--box-shadow);
}

.debug-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.debug-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.debug-section h4 {
    font-size: 0.9rem;
    color: var(--primary-dark);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.debug-section h4 .icon {
    color: var(--secondary-color);
    font-size: 1rem;
}

.recognition-display {
    background: #f0f8ff;
    border: 2px solid #4a90e2;
    border-radius: 8px;
    padding: 12px;
    font-family: var(--arabic-font);
    font-size: 1.3rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    color: #2c5282;
    font-weight: 600;
}

body.dark-mode .recognition-display {
    background: #1a2332;
    border-color: #4a90e2;
    color: #87ceeb;
}

.words-list {
    background: var(--highlight-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    font-family: var(--ui-font);
    font-size: 0.95rem;
    min-height: 35px;
    display: flex;
    align-items: center;
}

.expected-display {
    background: #fff5f5;
    border: 2px solid #e53e3e;
    border-radius: 8px;
    padding: 12px;
    font-family: var(--arabic-font);
    font-size: 1.3rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    color: #c53030;
    font-weight: 600;
}

body.dark-mode .expected-display {
    background: #2d1a1a;
    border-color: #e53e3e;
    color: #feb2b2;
}

.match-status {
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    border: 2px solid transparent;
}

.match-status.success {
    background: #c6f6d5;
    color: #22543d;
    border-color: #38a169;
}

.match-status.error {
    background: #fed7d7;
    color: #742a2a;
    border-color: #e53e3e;
}

.match-status.waiting {
    background: #fef5e7;
    color: #744210;
    border-color: #ed8936;
}

body.dark-mode .match-status.success {
    background: #1a2e1a;
    color: #68d391;
}

body.dark-mode .match-status.error {
    background: #2d1818;
    color: #fc8181;
}

body.dark-mode .match-status.waiting {
    background: #2d2518;
    color: #f6e05e;
}

/*----------------------------------------------------------------------------*\
*  :: Ayah Display & Feedback
\*----------------------------------------------------------------------------*/

/* Main Ayah Container with Elegant Card Design */
.ayah-text {
  font-family: var(--arabic-font);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  line-height: 2.4;
  color: var(--text-color);
  direction: rtl;
  text-align: center; /* Center for elegance */
  padding: 30px 25px;
  min-height: 80px;
  word-spacing: 4px;
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, 
    hsla(var(--primary-hue), 60%, 98%, 0.8), 
    hsla(var(--primary-hue), 50%, 96%, 0.9));
  border: 2px solid hsla(var(--primary-hue), 40%, 85%, 0.4);
  box-shadow: 0 8px 24px hsla(var(--primary-hue), 30%, 50%, 0.08);
  position: relative;
  overflow: hidden;
}

/* Decorative pattern overlay for Arabic text */
.ayah-text::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, hsla(var(--primary-hue), 50%, 90%, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, hsla(var(--secondary-hue), 40%, 88%, 0.2) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Ensure text is above overlay */
.ayah-text > * {
  position: relative;
  z-index: 1;
}

/* Dark mode adjustments for Ayah text */
body.dark-mode .ayah-text {
  background: linear-gradient(135deg, 
    hsla(var(--primary-hue), 25%, 18%, 0.9), 
    hsla(var(--primary-hue), 20%, 20%, 0.95));
  border-color: hsla(var(--primary-hue), 30%, 35%, 0.5);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

body.dark-mode .ayah-text::before {
  background: 
    radial-gradient(circle at 20% 30%, hsla(var(--primary-hue), 40%, 25%, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, hsla(var(--secondary-hue), 30%, 22%, 0.15) 0%, transparent 50%);
}

#ayahDisplay {
  background-color: transparent;
  position: relative;
  margin-bottom: 24px;
}

/* Modern Transliteration Design */
.transliteration-text {
  font-family: 'Readex Pro', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: clamp(1rem, 2.6vw, 1.15rem);
  line-height: 1.8;
  color: var(--muted-text);
  direction: ltr;
  text-align: center;
  margin-top: 16px;
  padding: 16px 24px;
  background: hsla(var(--primary-hue), 30%, 95%, 0.5);
  border-left: 4px solid hsla(var(--primary-hue), 50%, 60%, 0.6);
  border-radius: 8px;
  unicode-bidi: plaintext;
  font-style: normal;
  letter-spacing: 0.3px;
  position: relative;
}

/* Transliteration label */
.transliteration-text::before {
  content: '🔤 Transliteration';
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 8px;
  opacity: 0.8;
}

body.dark-mode .transliteration-text {
  background: hsla(var(--primary-hue), 20%, 22%, 0.6);
  border-left-color: hsla(var(--primary-hue), 45%, 50%, 0.7);
}

/* Elegant Translation Design */
.translation-text {
  font-family: 'Readex Pro', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
  line-height: 2;
  color: var(--text-color);
  direction: ltr;
  text-align: center;
  margin-top: 20px;
  padding: 20px 28px;
  background: linear-gradient(to right, 
    hsla(var(--secondary-hue), 50%, 96%, 0.6),
    hsla(var(--secondary-hue), 45%, 94%, 0.7),
    hsla(var(--secondary-hue), 50%, 96%, 0.6));
  border: 1px solid hsla(var(--secondary-hue), 40%, 85%, 0.5);
  border-radius: 12px;
  font-style: italic;
  opacity: 1;
  position: relative;
  box-shadow: 0 4px 12px hsla(var(--secondary-hue), 30%, 50%, 0.08);
}

/* Translation label */
.translation-text::before {
  content: '📖 Translation';
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--secondary-color);
  font-weight: 600;
  margin-bottom: 10px;
  font-style: normal;
  opacity: 0.85;
}

body.dark-mode .translation-text {
  background: linear-gradient(to right, 
    hsla(var(--secondary-hue), 25%, 20%, 0.7),
    hsla(var(--secondary-hue), 20%, 22%, 0.8),
    hsla(var(--secondary-hue), 25%, 20%, 0.7));
  border-color: hsla(var(--secondary-hue), 30%, 35%, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#liveMatchDisplay {
  background-color: var(--highlight-bg);
  border: 1px dashed var(--border-color);
}

/* Icon-only label hidden but kept for i18n/tests */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Elegant blur effects with backdrop */
.ayah-text.ayah-hidden + .translation-text,
.ayah-text.ayah-hidden ~ .transliteration-text {
  filter: blur(8px) brightness(1.05);
  pointer-events: none;
  user-select: none;
  opacity: 0.7;
  transform: scale(0.98);
  transition: all 0.4s ease;
}

/* Hidden text labels */
.translation-text.hidden,
.transliteration-text.hidden {
  display: none;
}

/* Transliteration toggle button visual state */
.btn-transliteration[aria-pressed="false"] .icon {
  opacity: 0.5;
}

/* Translation toggle button visual state */
.btn-translation[aria-pressed="false"] .icon {
  opacity: 0.5;
}

/* Word Styling */
.word {
  display: inline-block; /* Allows padding/margin */
  padding: 1px 3px;
  margin: 0 1px;
  border-radius: 4px;
  transition: background-color var(--transition-speed) ease,
              color var(--transition-speed) ease,
              opacity var(--transition-speed) ease,
              transform 0.2s ease-out;
}

/* Hint mode - slightly faded */
.word.hint {
  color: var(--muted-text);
  opacity: 0.6;
  background-color: transparent;
  position: relative; /* For potential future pseudo-elements */
}

/* Revealed word */
.word.revealed {
  color: var(--primary-color);
  background-color: var(--highlight-bg);
  font-weight: 700; /* Use Amiri Bold */
  opacity: 1;
  transform: scale(1.02); /* Slight emphasis */
}

/* Pending word */
.word.pending {
  color: var(--pending-text);
  background-color: var(--pending-bg);
  opacity: 1;
}

/* Reciting Mode adjustments - REMOVED BLUR/FADE EFFECT */
/* User wants Ayah to remain fully visible during recitation */
.reciting-mode #ayahDisplay {
  /* Effects removed - Ayah stays clear */
}

.reciting-mode .word.hint {
  /* Hint opacity removed - text stays fully visible */
  opacity: 1;
  color: var(--text-color);
}

/* Hint Message Banner */
.hint-message {
  background: linear-gradient(90deg, hsla(var(--primary-hue), 50%, 45%, 0.05), hsla(var(--primary-hue), 50%, 45%, 0.15), hsla(var(--primary-hue), 50%, 45%, 0.05));
  color: var(--primary-dark);
  padding: 8px 15px;
  border-radius: 6px;
  margin: 15px 0;
  text-align: center;
  font-size: 0.9em;
  font-weight: 500;
  border-left: 4px solid var(--primary-color);
}
body.dark-mode .hint-message {
  color: var(--primary-color);
   border-left-color: var(--primary-color);
}


/* Progress Bar */
.progress-container {
  width: 100%;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  margin-top: 15px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color) 0%, var(--primary-color) 100%);
  transition: width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1); /* Smoother transition */
  border-radius: 4px;
}

/*----------------------------------------------------------------------------*\
*  :: Status Display
\*----------------------------------------------------------------------------*/
.status-container {
  margin-top: 15px;
  text-align: center;
}

/* Microphone meter */
.mic-meter-wrapper {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.mic-meter-container {
  width: 160px;
  height: 10px;
  background-color: var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.mic-level {
  height: 100%;
  width: 0%; /* start empty until JS updates meter */
  background: linear-gradient(90deg, #f44336 0%, #ff9800 50%, var(--primary-color) 100%);
  transition: width 0.12s linear;
}
.shortcut-hint { font-size: 0.85rem; color: var(--muted-text); }

.status {
  display: inline-flex; /* Use flex for icon alignment */
  align-items: center;
  padding: 8px 18px;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--primary-dark);
  background-color: var(--highlight-bg);
  border-radius: 20px; /* Pill shape */
  border: 1px solid transparent; /* Placeholder for states */
  transition: all var(--transition-speed) ease;
}

.status .status-icon {
  margin-right: 8px;
  font-size: 1.1em;
  color: var(--primary-color);
}

/* Status States */
.status.listening {
  color: hsl(145, 63%, 42%); /* Success Green Text */
  background-color: hsla(145, 63%, 42%, 0.15);
  border-color: hsla(145, 63%, 42%, 0.3);
}
.status.listening .status-icon { color: hsl(145, 63%, 42%); }

body.dark-mode .status.listening {
  color: hsl(145, 55%, 75%); /* Lighter Green Text */
  background-color: hsla(145, 55%, 75%, 0.15);
  border-color: hsla(145, 55%, 75%, 0.3);
}
body.dark-mode .status.listening .status-icon { color: hsl(145, 55%, 75%); }


.status.error {
  color: hsl(4, 71%, 50%); /* Error Red Text */
  background-color: hsla(4, 71%, 50%, 0.1);
  border-color: hsla(4, 71%, 50%, 0.2);
}
.status.error .status-icon { color: hsl(4, 71%, 50%); }

body.dark-mode .status.error {
  color: hsl(4, 70%, 75%); /* Lighter Red Text */
  background-color: hsla(4, 70%, 75%, 0.15);
  border-color: hsla(4, 70%, 75%, 0.3);
}
body.dark-mode .status.error .status-icon { color: hsl(4, 70%, 75%); }

.status.success { /* For completion message */
   color: var(--primary-dark);
   background-color: var(--highlight-bg);
   border: 1px dashed var(--primary-color);
}
.status.success .status-icon { color: var(--primary-color); }


/*----------------------------------------------------------------------------*\
*  :: Settings
\*----------------------------------------------------------------------------*/
.settings-toggles {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.toggle-group {
  display: flex;
  align-items: center;
}

.toggle-label {
  margin-left: 12px;
  font-size: 0.95rem;
  color: var(--muted-text);
  cursor: pointer;
}

/* Custom Toggle Switch */
.toggle-switch {
position: relative;
display: inline-block;
width: 44px; /* Adjusted size */
height: 24px;
}

.toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}

.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: var(--border-color);
transition: var(--transition-speed);
}

.slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: var(--transition-speed);
}

input:checked + .slider {
background-color: var(--primary-color);
}

input:focus + .slider {
box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
transform: translateX(20px);
}

/* Rounded sliders */
.slider.round {
border-radius: 24px;
}

.slider.round:before {
border-radius: 50%;
}

/*----------------------------------------------------------------------------*\
*  :: Instructions & Footer
\*----------------------------------------------------------------------------*/
.instructions-list {
  list-style: none;
  padding-left: 0;
}

.instructions-list li {
  margin-bottom: 10px;
  position: relative;
  padding-left: 25px;
  font-size: 0.95rem;
  color: var(--muted-text);
}

.instructions-list li::before {
  content: '\f138'; /* Font Awesome arrow-right */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--accent-color);
}

.instructions-tip, .instructions-note {
  font-size: 0.9rem;
  margin-top: 15px;
  padding: 10px;
  border-radius: 6px;
  background-color: var(--highlight-bg);
  color: var(--muted-text);
}

.instructions-tip .icon { color: var(--secondary-color); }
.instructions-note .icon { color: hsl(4, 71%, 60%); } /* Warning color */

.app-footer {
  text-align: center;
  margin-top: 50px;
  padding: 20px;
  font-size: 0.9rem;
  color: var(--muted-text);
  border-top: 1px solid var(--border-color);
}

.footer-link {
  color: var(--muted-text);
}
.footer-link:hover {
  color: var(--primary-color);
}

/*----------------------------------------------------------------------------*\
*  :: Modal Styling
\*----------------------------------------------------------------------------*/
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6); /* Darker overlay */
  align-items: center; /* Use Flexbox for centering */
  justify-content: center;
  padding: 20px; /* Padding for small screens */
  opacity: 0;
  transition: opacity 0.4s ease;
}

.modal[style*="display: flex"] { /* Animate in */
  opacity: 1;
}

.modal-content {
  background-color: var(--card-bg);
  margin: auto;
  padding: 30px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 600px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  position: relative;
  max-height: 85vh; /* Limit height */
  overflow-y: auto; /* Allow scrolling */
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

/* Summary modal specific tweaks */
.modal #summaryContent p { color: var(--muted-text); }
.modal .modal-actions .btn { margin: 0 6px; }

.modal[style*="display: flex"] .modal-content { /* Animate in */
  transform: scale(1);
  opacity: 1;
}

.modal-title {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--primary-color);
  text-align: center;
}

.modal-content p, .modal-content ul {
  margin-bottom: 15px;
  line-height: 1.7;
  color: var(--text-color);
}

.modal-content ul {
  padding-left: 25px;
}
.modal-content li {
  margin-bottom: 8px;
}

.modal-close-button {
  position: absolute;
  top: 10px;
  right: 15px;
  color: var(--muted-text);
  font-size: 28px;
  font-weight: bold;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  line-height: 1;
  transition: color var(--transition-speed) ease;
}

.modal-close-button:hover,
.modal-close-button:focus {
  color: var(--primary-color);
  outline: none;
}

/*----------------------------------------------------------------------------*\
*  :: Feedback Modal - Modern Redesign
\*----------------------------------------------------------------------------*/

/* Modal Content Enhanced */
.feedback-modal-content {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafa 100%);
  border-radius: 20px;
  max-width: 600px;
  max-height: 90vh;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode .feedback-modal-content {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal Header */
.feedback-modal-header {
  text-align: center;
  padding: 40px 40px 30px;
  background: linear-gradient(135deg, 
    hsla(var(--primary-hue), 50%, 45%, 0.08) 0%,
    hsla(var(--primary-hue), 40%, 50%, 0.04) 100%);
  border-bottom: 1px solid var(--border-color);
}

body.dark-mode .feedback-modal-header {
  background: linear-gradient(135deg, 
    hsla(var(--primary-hue), 50%, 45%, 0.15) 0%,
    hsla(var(--primary-hue), 40%, 50%, 0.08) 100%);
}

/* Icon Wrapper */
.feedback-icon-wrapper {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px hsla(var(--primary-hue), 50%, 50%, 0.3);
  animation: iconPulse 2s ease-in-out infinite;
}

.feedback-icon-wrapper i {
  font-size: 2.2rem;
  color: white;
}

@keyframes iconPulse {
  0%, 100% {
    box-shadow: 0 10px 30px hsla(var(--primary-hue), 50%, 50%, 0.3);
  }
  50% {
    box-shadow: 0 10px 40px hsla(var(--primary-hue), 50%, 50%, 0.5);
  }
}

/* Modal Title */
.feedback-modal-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 12px;
  letter-spacing: -0.5px;
}

.feedback-modal-subtitle {
  font-size: 1rem;
  color: var(--muted-text);
  line-height: 1.6;
  margin: 0;
}

/* Form Container */
.feedback-form {
  padding: 35px 40px;
}

/* Form Grid Layout */
.feedback-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Form Group */
.feedback-form-group {
  margin-bottom: 20px;
}

/* Label Styling */
.feedback-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 8px;
  transition: color var(--transition-speed) ease;
}

.feedback-label i {
  color: var(--primary-color);
  font-size: 1rem;
}

/* Input Styling */
.feedback-input,
.feedback-select,
.feedback-textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: var(--ui-font);
  color: var(--text-color);
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.3s ease;
  outline: none;
  line-height: 1.5;
  box-sizing: border-box;
}

body.dark-mode .feedback-input,
body.dark-mode .feedback-select,
body.dark-mode .feedback-textarea {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.feedback-input:focus,
.feedback-select:focus,
.feedback-textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px hsla(var(--primary-hue), 50%, 50%, 0.1);
  transform: translateY(-2px);
}

.feedback-input::placeholder,
.feedback-textarea::placeholder {
  color: var(--muted-text);
  opacity: 0.6;
}

/* Textarea Specific */
.feedback-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

/* Character Counter */
.feedback-char-count {
  font-size: 0.85rem;
  color: var(--muted-text);
  text-align: right;
  margin-top: 6px;
  transition: color 0.3s ease;
}

.feedback-char-count.warning {
  color: hsl(30, 70%, 50%);
}

.feedback-char-count.danger {
  color: hsl(0, 70%, 50%);
  font-weight: 600;
}

/* Select Wrapper */
.feedback-select-wrapper {
  position: relative;
}

.feedback-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 14px 40px 14px 16px;
  cursor: pointer;
  line-height: 1.5;
  height: auto;
  vertical-align: middle;
  box-sizing: border-box;
}

.feedback-select-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-text);
  pointer-events: none;
  transition: color var(--transition-speed) ease;
  font-size: 0.9rem;
}

.feedback-select:focus ~ .feedback-select-icon {
  color: var(--primary-color);
}

/* Error Message */
.feedback-form-error {
  padding: 12px 16px;
  background: hsla(0, 70%, 50%, 0.1);
  border: 1px solid hsla(0, 70%, 50%, 0.3);
  border-radius: 10px;
  color: hsl(0, 70%, 45%);
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: none;
  animation: errorShake 0.4s ease;
}

.feedback-form-error:not(:empty) {
  display: block;
}

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

/* Submit Button */
.feedback-modal-actions {
  margin-top: 25px;
}

.feedback-submit-btn {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px hsla(var(--primary-hue), 50%, 50%, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.feedback-submit-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px hsla(var(--primary-hue), 50%, 50%, 0.4);
}

.feedback-submit-btn:active {
  transform: translateY(-1px);
}

.feedback-submit-btn i {
  transition: transform 0.3s ease;
}

.feedback-submit-btn:hover i {
  transform: translateX(5px);
}

/* Close Button Specific for Feedback Modal */
.feedback-close-btn {
  z-index: 10;
  background: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

body.dark-mode .feedback-close-btn {
  background: rgba(255, 255, 255, 0.1);
}

.feedback-close-btn:hover {
  transform: rotate(90deg);
  background: var(--primary-color);
  color: white;
}

/* Custom Scrollbar for Feedback Modal */
.feedback-modal-content::-webkit-scrollbar {
  width: 8px;
}

.feedback-modal-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.feedback-modal-content::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

.feedback-modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

body.dark-mode .feedback-modal-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

/* Responsive Design for Feedback Modal */
@media screen and (max-width: 767px) {
  .feedback-modal-content {
    max-width: 95%;
    max-height: 85vh;
    margin: 20px;
  }

  .feedback-modal-header {
    padding: 30px 25px 25px;
  }

  .feedback-icon-wrapper {
    width: 65px;
    height: 65px;
    margin-bottom: 15px;
  }

  .feedback-icon-wrapper i {
    font-size: 1.8rem;
  }

  .feedback-modal-title {
    font-size: 1.4rem;
  }

  .feedback-modal-subtitle {
    font-size: 0.9rem;
  }

  .feedback-form {
    padding: 25px 20px;
  }

  .feedback-form-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .feedback-input,
  .feedback-select,
  .feedback-textarea {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  .feedback-submit-btn {
    padding: 14px 20px;
    font-size: 1rem;
  }
}

/*----------------------------------------------------------------------------*\
 *  :: Memorization Test Mode Styling
\*----------------------------------------------------------------------------*/

/* Style for the container when the original text should be hidden */
.ayah-display-container.hidden-for-test .ayah-text {
  opacity: 0.05; /* Make it almost invisible, but allows brief flashing for hints later */
  /* Alternatively, for complete instant invisibility:
  visibility: hidden;
  */
  transition: opacity 0.15s ease-out; /* Very fast fade out */
  pointer-events: none; /* Prevent accidental selection */
}

/* Style for the placeholder dots in the live match area */
#liveMatchDisplay .word.pending {
  color: var(--pending-text);
  background-color: transparent; /* No background for pending dots */
  font-weight: bold; /* Make dots bolder */
  letter-spacing: 2px; /* Space out dots */
  font-family: var(--ui-font); /* Use UI font for dots */
  font-size: 1.5rem; /* Adjust dot size if needed */
  vertical-align: middle;
  opacity: 0.6; /* Make dots slightly subtle */
  padding: 1px 0; /* Minimal vertical padding */
  margin: 0 2px;
}

/* Optional: Style revealed words more distinctively in test mode */
.reciting-mode #liveMatchDisplay .word.revealed {
  background-color: var(--highlight-bg);
  padding: 2px 5px; /* Slightly more padding */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transform: scale(1.03); /* Slightly larger */
}

/* Ensure hint message is still visible if added */
.reciting-mode #hint-message {
  opacity: 1;
  visibility: visible;
}

/*----------------------------------------------------------------------------*\
*  :: Responsive Design
\*----------------------------------------------------------------------------*/
/* Tablets */
@media screen and (max-width: 1024px) {
  .container {
      max-width: 95%;
  }
}

/* Mobile Devices */
@media screen and (max-width: 767px) {
  html {
      font-size: 15px; /* Adjust base size */
  }

  .container {
      padding: 15px;
  }

  .app-header {
      margin-bottom: 30px;
  }

  .card {
       --card-padding: 15px;
       margin-bottom: 20px;
  }

  .selection-form {
      grid-template-columns: 1fr; /* Stack form elements */
  }

  .form-group-button {
      margin-top: 10px;
  }
  .form-group-button .btn {
      width: 100%;
  }

  .ayah-text {
      font-size: clamp(1.4rem, 5.5vw, 1.8rem);
      line-height: 2;
      padding: 8px;
  }

  .button-group {
      flex-direction: column; /* Stack buttons */
  }
  .button-group .btn {
      width: 100%;
  }

  .status {
      font-size: 0.9rem;
      padding: 6px 14px;
  }

  .modal-content {
      width: 95%;
      padding: 20px;
  }

   .toggle-group {
      flex-direction: column;
      align-items: flex-start;
      gap: 5px;
  }
  .toggle-label {
       margin-left: 0;
  }
}

/* Smaller Mobile Devices */
@media screen and (max-width: 480px) {
   html {
      font-size: 14px; /* Further adjust base size */
  }
   .container {
      padding: 10px;
  }
   .card {
      --card-padding: 12px;
   }
   .card-title {
      font-size: 1.1rem;
   }
   .ayah-text {
      word-spacing: 1px;
   }
}


/*----------------------------------------------------------------------------*\
*  :: Accessibility & Print
\*----------------------------------------------------------------------------*/
/* Focus outline */
*:focus-visible {
outline: 3px solid var(--secondary-color);
outline-offset: 2px;
box-shadow: 0 0 0 3px hsla(var(--primary-hue), 50%, 50%, 0.2);
border-radius: 4px; /* Match outline to element shape */
}
select:focus-visible {
  border-radius: calc(var(--border-radius) / 1.5); /* Match select border */
}
.slider:focus-visible {
   border-radius: 24px; /* Match toggle switch */
}


@media print {
body {
  background: none;
  color: black;
  font-size: 12pt;
}

.container {
  width: 100%;
  max-width: none;
  padding: 0;
}

.card {
  box-shadow: none;
  border: 1px solid #ccc;
  margin-bottom: 15px;
  break-inside: avoid;
}

.app-header,
.selection-form button,
.recitation-controls,
.status-container,
.settings-card,
.instructions-tip,
.instructions-note,
.app-footer,
.modal,
.page-background,
.progress-container,
.hint-message {
  display: none !important;
}

.ayah-text {
  font-size: 16pt;
  color: black;
  background: none;
  line-height: 1.8;
}
.word { background: none !important; color: black !important; opacity: 1 !important; }

a { color: black; text-decoration: underline; }
}