
/* =====================================================================
   Lock floating UI buttons to consistent corners across languages (LTR/RTL)
   ===================================================================== */
/* Base (desktop/tablet) */
html[dir="rtl"] .floating-support-btn { right: 24px; left: auto; }
html[dir="rtl"] .floating-help-btn { left: calc(20px + env(safe-area-inset-left, 0px)); right: auto; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
html[dir="rtl"] .settings-menu-btn { left: calc(20px + env(safe-area-inset-left, 0px)); right: auto; }
html[dir="rtl"] .floating-signin-btn { right: 24px; left: auto; }

/* Mobile overrides */
@media (max-width: 768px) {
  html[dir="rtl"] .floating-support-btn { right: 16px; left: auto; }
  html[dir="rtl"] .floating-help-btn { left: calc(16px + env(safe-area-inset-left, 0px)); right: auto; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  html[dir="rtl"] .settings-menu-btn { left: calc(16px + env(safe-area-inset-left, 0px)); right: auto; }
  html[dir="rtl"] .floating-signin-btn { right: 16px; left: auto; }
}

/* Floating Support Button */
.floating-support-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  box-shadow: 0 4px 12px rgba(238, 90, 111, 0.4), 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  overflow: hidden;
}

.floating-support-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(238, 90, 111, 0.5), 0 4px 8px rgba(0,0,0,0.15);
  width: auto;
  padding: 0 20px;
  border-radius: 28px;
  text-decoration: none !important;
}

.floating-support-btn .fa-heart {
  font-size: 1.3rem;
  color: white;
  animation: heartbeat 1.5s ease-in-out infinite;
}

.floating-support-btn .support-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;
}

.floating-support-btn:hover .support-text {
  max-width: 100px;
  margin-left: 8px;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  10%, 30% { transform: scale(1.1); }
  20% { transform: scale(1.15); }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .floating-support-btn {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
  
  .floating-support-btn .fa-heart {
    font-size: 1.1rem;
  }
  
  .floating-help-btn {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)); /* Stack vertically above settings on mobile */
    left: calc(16px + env(safe-area-inset-left, 0px));
    width: 48px;
    height: 48px;
  }
  
  .floating-help-btn .fa-circle-question {
    font-size: 1.1rem;
  }
}

/* Also shrink settings button at tablet widths to align with help */
@media (max-width: 768px) {
  .settings-menu-btn {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: calc(16px + env(safe-area-inset-left, 0px));
    width: 48px;
    height: 48px;
  }
}

/* Extra-small screens: lock help button to circular size and prevent hover expansion */
@media (max-width: 480px) {
  .floating-help-btn {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: calc(16px + env(safe-area-inset-left, 0px));
    width: 48px !important;
    height: 48px !important;
  }
  .floating-help-btn:hover {
    width: 48px !important;
    padding: 0 !important;
    border-radius: 50% !important;
  }
  .settings-menu-btn {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: calc(16px + env(safe-area-inset-left, 0px));
    width: 48px;
    height: 48px;
  }
}

/* Floating Help Button */
.floating-help-btn {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px)); /* Position above settings button */
  left: calc(20px + env(safe-area-inset-left, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a90e2, #357abd);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4), 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 998;
  overflow: hidden;
  cursor: pointer;
}

.floating-help-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.5), 0 4px 8px rgba(0,0,0,0.15);
  width: auto;
  padding: 0 20px;
  border-radius: 28px;
}

.floating-help-btn .fa-circle-question {
  font-size: 1.3rem;
  animation: pulse 2s ease-in-out infinite;
}

.floating-help-btn .help-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;
}

.floating-help-btn:hover .help-text {
  max-width: 60px;
  margin-left: 8px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* RTL support */
html[dir="rtl"] .floating-support-btn {
  right: 24px;
  left: auto;
}

html[dir="rtl"] .floating-support-btn:hover .support-text {
  margin-left: 0;
  margin-right: 8px;
}

html[dir="rtl"] .floating-help-btn {
  left: calc(20px + env(safe-area-inset-left, 0px));
  right: auto;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

html[dir="rtl"] .floating-help-btn:hover .help-text {
  margin-left: 0;
  margin-right: 8px;
}

/* RTL Settings button text */
html[dir="rtl"] .settings-menu-btn:hover .settings-text {
  margin-left: 0;
  margin-right: 8px;
}

/* Alignment fixes: ensure help button matches settings offsets exactly */
@media (min-width: 769px) {
  .floating-help-btn { left: 20px !important; bottom: 88px !important; }
}
@media (max-width: 768px) and (min-width: 481px) {
  .floating-help-btn {
    left: calc(16px + env(safe-area-inset-left, 0px)) !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    width: 48px !important;
    height: 48px !important;
  }
  .floating-help-btn:hover {
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    border-radius: 50% !important;
  }
  .floating-help-btn .fa-circle-question { font-size: 1.1rem; }
}
@media (max-width: 480px) {
  .floating-help-btn {
    left: calc(16px + env(safe-area-inset-left, 0px)) !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    width: 48px !important;
    height: 48px !important;
  }
  .floating-help-btn:hover { width: 48px !important; padding: 0 !important; border-radius: 50% !important; }
}

/* ===========================
   FLOATING SIGN-IN BUTTON (Stable, Green, Circular)
   =========================== */

/* Floating Sign-In Button */
.floating-signin-btn {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border: none;
  background: linear-gradient(135deg, #28a745, #20c997);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1001;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
  box-shadow: 0 6px 18px rgba(32, 201, 151, 0.35);
}

.floating-signin-btn i {
  color: #ffffff;
  font-size: 1.4rem;
}

.floating-signin-btn:hover {
  box-shadow: 0 8px 24px rgba(32, 201, 151, 0.45);
}

/* RTL Support */
html[dir="rtl"] .floating-signin-btn {
  right: 24px;
  left: auto;
}

@media (max-width: 768px) {
  .floating-signin-btn {
    top: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
html[dir="rtl"] .floating-signin-btn { right: 16px; left: auto; }
}






/* Animations */




/* Mobile responsive (already defined above) */

/* RTL Support adjustments already defined above */

/* Settings button RTL */
html[dir="rtl"] .settings-menu-btn {
  left: 20px;
  right: auto;
}

@media (max-width: 768px) {
  html[dir="rtl"] .floating-support-btn {
    right: 16px;
    left: auto;
  }
  
  html[dir="rtl"] .floating-help-btn {
    left: calc(16px + env(safe-area-inset-left, 0px));
    right: auto;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  
  html[dir="rtl"] .settings-menu-btn {
    left: calc(16px + env(safe-area-inset-left, 0px));
    right: auto;
  }
}

/* Help Modal Content */
.help-content {
  padding: 20px 0;
}

.help-content .instructions-list {
  padding-left: 20px;
  margin-bottom: 20px;
}

.help-content .instructions-list li {
  margin-bottom: 12px;
  line-height: 1.6;
  color: var(--text-color);
}

.help-content .instructions-list li strong {
  color: var(--primary-color);
  font-weight: 600;
}

.help-tips {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.help-tip, .help-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 8px;
}

.help-tip {
  background: rgba(255, 193, 7, 0.1);
  border-left: 4px solid #ffc107;
}

.help-note {
  background: rgba(220, 53, 69, 0.1);
  border-left: 4px solid #dc3545;
}

.help-tip .icon {
  color: #ffc107;
  font-size: 1.1rem;
  margin-top: 2px;
}

.help-note .icon {
  color: #dc3545;
  font-size: 1.1rem;
  margin-top: 2px;
}

.help-tip span, .help-note span {
  color: var(--text-color);
  line-height: 1.5;
  font-size: 0.9rem;
}


/* Support modal tweaks */
.support-modal { text-align: center; }
.support-modal .support-options { display: flex; gap: 12px; justify-content: center; margin-top: 10px; }
.form-error { color: #ef4444; margin-top: 6px; font-size: 0.9rem; }

/* Enhanced styles for the word matching feedback */

/* Words that have been matched/revealed */
.word.revealed {
    color: #26734d; /* Islamic green */
    background-color: rgba(38, 115, 77, 0.1);
    border-radius: 4px;
    padding: 2px 4px;
    margin: 0 2px;
    position: relative;
    transition: all 0.3s ease;
}

/* Words waiting to be matched */
.word.pending {
    color: #999;
    padding: 2px 4px;
    margin: 0 2px;
    transition: all 0.3s ease;
}

/* Style for hidden (original) words */
.word.hidden {
    color: transparent;
    background-color: #eee;
    border-radius: 4px;
    padding: 2px 6px;
    margin: 0 2px;
    user-select: none; /* Prevent selection */
}

/* Message displayed when verse is hidden */
.hidden-message {
    text-align: center;
    font-style: italic;
    color: #888;
    padding: 20px;
    font-size: 1.2rem;
    opacity: 0.7;
}

/* Container for the matched words display */
.live-match {
    padding: 15px;
    min-height: 80px;
    background-color: rgba(38, 115, 77, 0.05);
    border-radius: 8px;
    line-height: 2;
    transition: all 0.3s ease;
}

/* Progress visualization */
.progress-container {
    width: 100%;
    height: 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    margin: 15px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #26734d;
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Match status visualization */
.match-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 10px 0;
    gap: 8px;
}

.match-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ddd;
    transition: all 0.3s ease;
}

.match-dot.matched {
    background-color: #26734d;
}

/* Status styling */
.status {
    text-align: center;
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 30px;
    background-color: rgba(38, 115, 77, 0.1);
    color: #26734d;
    font-weight: 500;
    transition: all 0.3s ease;
}

.status.listening {
    background-color: rgba(46, 204, 113, 0.2);
    color: #27ae60;
}

.status.error {
    background-color: rgba(231, 76, 60, 0.2);
    color: #c0392b;
}

/* Fix for the completion success animation */
.completion-success {
    background-color: rgba(46, 204, 113, 0.2);
    transition: background-color 0.5s ease;
}

/* Enhanced auto controls */
.auto-controls {
    margin-top: 10px;
    padding: 10px;
    background-color: rgba(38, 115, 77, 0.05);
    border-radius: 8px;
}

.auto-controls label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.auto-controls input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
}

/* Fix for some browsers */
@media (max-width: 768px) {
    .word {
        display: inline-block;
    }
}

/* Mobile styles for settings modal */
@media (max-width: 480px) {
    .settings-menu {
        padding: 10px;
    }
    
    .settings-content {
        max-width: none;
        width: 100%;
        max-height: 90vh;
    }
    
    .settings-menu-btn {
        bottom: 16px;
        left: 16px;
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
        /* Prevent button expansion on mobile */
        padding: 0 !important;
    }
    
    /* Force hide text and keep icon only on mobile */
    .settings-menu-btn .settings-text {
        display: none !important;
        max-width: 0 !important;
        margin-left: 0 !important;
    }
    
    /* Ensure icon stays centered on mobile */
    .settings-menu-btn .fa-gear {
        margin-right: 0 !important;
    }
    
    /* Prevent hover expansion on mobile */
    .settings-menu-btn:hover {
        width: 48px !important;
        padding: 0 !important;
        border-radius: 50% !important;
    }
    
    .settings-header {
        padding: 16px;
    }
    
    .settings-title {
        font-size: 1.1rem;
    }
    
    .lang-option {
        padding: 12px;
    }
    
    .lang-option .lang-code {
        font-size: 0.8rem;
        min-width: 20px;
    }
    
    .setting-item {
        margin-bottom: 16px;
    }
    
    .setting-label {
        font-size: 0.85rem;
    }
}

/* Beautiful hint mode styling */
.word.hint {
    color: rgba(38, 115, 77, 0.4); /* Faded primary color */
    position: relative;
    background-color: rgba(242, 242, 242, 0.5);
    border-radius: 6px;
    padding: 3px 6px;
    margin: 0 2px;
    font-weight: normal;
    transition: all 0.3s ease;
    cursor: default;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.7);
}

/* Create a subtle pulse animation for hint words to draw attention */
@keyframes hint-pulse {
    0% { opacity: 0.4; }
    50% { opacity: 0.6; }
    100% { opacity: 0.4; }
}

/* Apply the animation to all hint words */
.reciting-mode .word.hint {
    animation: hint-pulse 2s infinite ease-in-out;
}

/* Make the current expected word more visible */
.reciting-mode .word.hint:nth-of-type(1) {
    color: rgba(38, 115, 77, 0.7);
    font-weight: 500;
}

/* Style for the hint message banner */
.hint-message {
    background: linear-gradient(90deg, rgba(38, 115, 77, 0.1), rgba(38, 115, 77, 0.2), rgba(38, 115, 77, 0.1));
    color: rgba(38, 115, 77, 0.9);
    padding: 8px 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 0.9em;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-left: 3px solid rgba(38, 115, 77, 0.5);
    position: relative;
    overflow: hidden;
}

/* Create a subtle sliding animation for the hint message */
.hint-message::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: slide 2s infinite;
}

@keyframes slide {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Enhanced style for when recitation mode is active */
.reciting-mode .output-area {
    border-left: 4px solid #26734d;
    box-shadow: 0 4px 12px rgba(38, 115, 77, 0.1);
}

/* Increase contrast for live match display during recitation */
.reciting-mode #liveMatchDisplay {
    background-color: rgba(38, 115, 77, 0.08);
    border: 1px solid rgba(38, 115, 77, 0.1);
}

/* Enhance the revealed words display for better visibility */
.reciting-mode .word.revealed {
    color: #26734d;
    background-color: rgba(38, 115, 77, 0.15);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(38, 115, 77, 0.1);
}

/* Make pending words more visible */
.reciting-mode .word.pending {
    background-color: rgba(0, 0, 0, 0.03);
    padding: 3px 6px;
    border-radius: 4px;
}
