/* Component-specific styles */

/* Video Generator Tab System */
.video-tab-btn {
    transition: all 0.2s ease;
    white-space: nowrap;
}

.video-tab-btn.active {
    background-color: rgba(255, 255, 255, 0.8);
    border-color: #8B5CF6;
    color: #8B5CF6;
}

.dark .video-tab-btn.active {
    background-color: rgba(31, 41, 55, 0.8);
    color: #A78BFA;
}

.video-tab-content {
    display: none;
}

.video-tab-content.active {
    display: block;
}

/* Custom Slider Styles */
.slider {
    -webkit-appearance: none;
    background: linear-gradient(to right, #E5E7EB 0%, #E5E7EB 100%);
    outline: none;
    border-radius: 15px;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #8B5CF6, #EC4899);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #8B5CF6, #EC4899);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dark .slider {
    background: linear-gradient(to right, #374151 0%, #374151 100%);
}

/* Scrollbar Hide */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Font Arabic Class */
.font-arabic {
    font-family: 'KFGQPC HAFS Uthmanic Script', 'UthmanicHafs1Ver18', 'Al Majeed Quranic Font', 'Amiri Quran', 'Scheherazade New', Arial, sans-serif;
    line-height: 1.8;
}

/* Video Preview Container Responsive */
#videoPreviewContainer {
    max-width: 100%;
    margin: 0 auto;
}

/* Desktop constraints for different orientations */
@media (min-width: 768px) {
    /* Landscape - full width is fine */
    #videoPreviewContainer.orientation-landscape {
        max-width: 100%;
    }
    
    /* Portrait - limit width to prevent huge size */
    #videoPreviewContainer.orientation-portrait {
        max-width: 400px;
    }
    
    /* Square - limit width */
    #videoPreviewContainer.orientation-square {
        max-width: 450px;
    }
}

/* Large desktop - even more constraints */
@media (min-width: 1024px) {
    /* Portrait - slightly larger but still constrained */
    #videoPreviewContainer.orientation-portrait {
        max-width: 450px;
    }
    
    /* Square - slightly larger */
    #videoPreviewContainer.orientation-square {
        max-width: 500px;
    }
}

/* Mobile Responsive Improvements */
@media (max-width: 640px) {
    .video-tab-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .video-tab-btn i {
        font-size: 12px;
    }
    
    /* Stack form elements vertically on mobile */
    .video-tab-content .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .video-tab-content .sm\\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .video-tab-content .sm\\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Mobile - all orientations use full width */
    #videoPreviewContainer {
        max-width: 100%;
    }
    
    /* Fix footer positioning on mobile for video tab */
    #videoContent {
        min-height: auto;
        padding-bottom: 2rem;
    }
    
    /* Ensure main content area takes proper space */
    main {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
}

/* Reading Progress Bar Styles */
.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.reading-progress-container.visible {
    opacity: 1;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #10B981);
    transition: width 0.15s ease;
    width: 0%;
    border-radius: 0 2px 2px 0;
}

.dark .reading-progress-container {
    background-color: rgba(255, 255, 255, 0.1);
}

.dark .reading-progress-bar {
    background: linear-gradient(90deg, #60A5FA, #34D399);
}

/* Mobile Navigation Buttons */
.mobile-nav-buttons {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 16px 0 8px 0;
}

.mobile-nav-btn {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3B82F6;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    transition: transform 0.1s ease;
    min-width: 70px;
    touch-action: manipulation;
}

.mobile-nav-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.5);
    transform: scale(1.05);
}

.mobile-nav-btn:disabled {
    background: rgba(156, 163, 175, 0.1);
    border-color: rgba(156, 163, 175, 0.3);
    color: #9CA3AF;
    transform: none;
}

.dark .mobile-nav-btn {
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.3);
    color: #60A5FA;
}

.dark .mobile-nav-btn:hover {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.5);
}

.dark .mobile-nav-btn:disabled {
    background: rgba(156, 163, 175, 0.1);
    border-color: rgba(156, 163, 175, 0.3);
    color: #6B7280;
}

/* Qibla / AR Styles */
#compass {
    position: relative;
    width: 16rem;
    height: 16rem;
    animation: fadeInSimple 0.2s ease-in;
}

#qiblaNeedle {
    transition: transform 0.1s ease-out;
    transform-origin: bottom center;
}

#kaabaIndicator {
    position: absolute;
    width: 48px;
    height: 48px;
    top: 0;
    left: 0;
    will-change: transform, opacity;
    z-index: 100;
    pointer-events: none;
    filter: drop-shadow(0 0 12px rgba(255, 200, 50, 0.7));
    transition: transform 0.2s ease-out, opacity 0.3s ease;
}

#arUnsupported {
    animation: slideIn 0.3s ease-out;
}

#arCamera {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#arCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

#qiblaDegree {
    backdrop-filter: blur(10px);
    font-family: monospace;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

#flipCameraBtn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    transition: all 0.2s ease;
}

@supports (-webkit-touch-callout: none) { /* iOS Specific AR fix */
    #kaabaIndicator {
        transform: translateZ(0);
    }
}

/* Enhanced Qibla AR Styles */
#directionArrow {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

#compassRose {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

#kaabaIndicator {
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

/* Tasbih Button - Prevent zoom and improve touch */
#tasbihContent button[onclick="incrementTasbih()"] {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Tab Navigation */
.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 8px;
    color: #6B7280;
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    background: transparent;
    border: 1px solid transparent;
    margin: 0 1px;
    white-space: nowrap;
    transition: all 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.tab:hover {
    color: #3B82F6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.tab.active {
    color: white;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    border-color: #2563EB;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Dark mode tab styles */
.dark .tab {
    color: #9CA3AF;
}

.dark .tab:hover {
    color: #60A5FA;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(96, 165, 250, 0.08));
    border-color: rgba(96, 165, 250, 0.3);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.2);
}

.dark .tab.active {
    color: white;
    background: linear-gradient(135deg, #60A5FA, #3B82F6);
    border-color: #3B82F6;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Tab Content Visibility - CRITICAL for tab functionality */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Quran Search Styles */
.quran-search-container {
    position: relative;
}

/* RTL support for search container */
[dir="rtl"] #quranSearchInput {
    text-align: right;
}

[dir="ltr"] #quranSearchInput {
    text-align: left;
}

[dir="rtl"] #quranSearchResults {
    text-align: right;
}

[dir="ltr"] #quranSearchResults {
    text-align: left;
}

/* Search icon positioning */
[dir="rtl"] .quran-search-container .flex-shrink-0:first-child {
    order: 2;
}

[dir="rtl"] .quran-search-container .flex-shrink-0:last-child {
    order: 0;
}

[dir="rtl"] .quran-search-container input {
    order: 1;
}

.search-result-item {
    transition: all 0.2s ease-in-out;
}

.search-result-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-result-item:active {
    transform: translateY(0);
}

/* Custom scrollbar for search results */
#quranSearchResults::-webkit-scrollbar {
    width: 6px;
}

#quranSearchResults::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

#quranSearchResults::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#quranSearchResults::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.dark #quranSearchResults::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.dark #quranSearchResults::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.dark #quranSearchResults::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modern Modal Button Styles */
#adhkarMenuModal button:not(#closeAdhkarMenu) {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(249, 250, 251, 0.8));
    border: 1px solid rgba(229, 231, 235, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(1);
}

#adhkarMenuModal button:not(#closeAdhkarMenu):hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
    background: linear-gradient(145deg, rgba(249, 250, 251, 0.9), rgba(243, 244, 246, 0.9));
}

.dark #adhkarMenuModal button:not(#closeAdhkarMenu) {
    background: linear-gradient(145deg, rgba(31, 41, 55, 0.8), rgba(17, 24, 39, 0.8));
    border-color: rgba(75, 85, 99, 0.8);
}

.dark #adhkarMenuModal button:not(#closeAdhkarMenu):hover {
    background: linear-gradient(145deg, rgba(55, 65, 81, 0.9), rgba(31, 41, 55, 0.9));
}

#adhkarMenuModal button:not(#closeAdhkarMenu) i {
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.dark #adhkarMenuModal button:not(#closeAdhkarMenu) i {
    background-color: rgba(17, 24, 39, 0.8);
}

#adhkarMenuModal button:not(#closeAdhkarMenu) span {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
}

/* Quran Sticky Controls */
.quran-controls-sticky {
    position: sticky !important;
    top: var(--safe-area-top) !important;
    z-index: 50 !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 0.5rem;
    margin: 0 0 1rem 0 !important;
    transition: transform 0.3s cubic-bezier(.4,2,.6,1), opacity 0.3s;
    width: 100% !important;
    /* Ensure proper sticky behavior */
    position: -webkit-sticky !important;
    position: sticky !important;
}

/* Ensure parent containers don't interfere with sticky positioning */
body {
    overflow-x: hidden;
}

/* Ensure the main container doesn't interfere with sticky positioning */
main {
    overflow-x: hidden;
}

/* Comprehensive sticky positioning system */
:root {
    /* Base heights - will be dynamically calculated */
    --header-height: 0px;
    --tabs-height: 0px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Calculate actual heights using JavaScript */
.quran-controls-sticky {
    /* Initial positioning - will be updated by JS */
    position: sticky !important;
    top: var(--safe-area-top) !important;
    z-index: 50 !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 0.5rem;
    margin: 0 0 1rem 0 !important;
    transition: transform 0.3s cubic-bezier(.4,2,.6,1), opacity 0.3s, top 0.3s ease;
    width: 100% !important;
    /* Ensure proper sticky behavior */
    position: -webkit-sticky !important;
    position: sticky !important;
}

/* Responsive sticky positioning */
@media (max-width: 1024px) {
    .quran-controls-sticky {
        top: var(--safe-area-top) !important;
    }
}

@media (max-width: 768px) {
    .quran-controls-sticky {
        top: var(--safe-area-top) !important;
        margin: -0.5rem -0.5rem 1rem -0.5rem !important;
        padding: 0.5rem 0.75rem !important;
        border-radius: 0.25rem !important;
    }
}

@media (max-width: 480px) {
    .quran-controls-sticky {
        top: var(--safe-area-top) !important;
        margin: -0.25rem -0.25rem 1rem -0.25rem !important;
        padding: 0.375rem 0.5rem !important;
    }
}

/* iOS PWA specific adjustments */
@supports (-webkit-touch-callout: none) {
    .quran-controls-sticky {
        top: var(--safe-area-top) !important;
        /* iOS specific optimizations */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }
}

/* Android specific adjustments */
@supports not (-webkit-touch-callout: none) {
    .quran-controls-sticky {
        top: var(--safe-area-top) !important;
        /* Android specific optimizations */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform;
    }
}

.dark .quran-controls-sticky {
    background: rgba(31, 41, 55, 0.95) !important;
    border-bottom-color: #374151;
}

.dark .quran-controls-sticky {
    background: rgba(31, 41, 55, 0.95);
    border-bottom-color: #374151;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Ensure proper spacing and layout */
.quran-controls-sticky > div {
    flex-shrink: 0;
    min-width: 0;
}

/* Responsive button sizing */
.quran-controls-sticky button {
    min-height: 36px;
    min-width: 36px;
}

@media (max-width: 768px) {
    .quran-controls-sticky button {
        min-height: 32px;
        min-width: 32px;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .quran-controls-sticky button {
        min-height: 28px;
        min-width: 28px;
        font-size: 0.75rem;
    }
}

.quran-controls-hidden {
    opacity: 0.3 !important;
    pointer-events: none !important;
}

/* Prayer Time Highlighting */
.next-prayer-highlight {
    background-color: #e0f2fe !important; 
    border-left: 4px solid #0ea5e9 !important;
    font-weight: 600 !important;
    color: #0ea5e9 !important;
}

.dark .next-prayer-highlight {
    background-color: rgba(96, 165, 250, 0.2) !important;
    border-left-color: #60a5fa !important;
    color: #f0f9ff !important;
}

/* Modern Prayer Times Highlight Styles */
#prayerContent .next-prayer-highlight {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(16, 185, 129, 0.9)) !important;
    border: 2px solid rgba(34, 197, 94, 0.5) !important;
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
    transform: scale(1.02) !important;
    animation: prayerPulse 2s ease-in-out infinite !important;
}

.dark #prayerContent .next-prayer-highlight {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.8), rgba(16, 185, 129, 0.8)) !important;
    border: 2px solid rgba(34, 197, 94, 0.6) !important;
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}

/* Text styling for highlighted prayer */
#prayerContent .next-prayer-highlight span {
    color: white !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

/* Icon styling for highlighted prayer */
#prayerContent .next-prayer-highlight .w-10 {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7)) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

#prayerContent .next-prayer-highlight .w-10 i {
    color: #059669 !important;
}

/* Disable hover effect for highlighted prayer */
#prayerContent .next-prayer-highlight:hover {
    transform: scale(1.02) !important;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(16, 185, 129, 0.9)) !important;
}

.dark #prayerContent .next-prayer-highlight:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.8), rgba(16, 185, 129, 0.8)) !important;
}

/* Enhanced verse styling for better desktop reading */
.ayah {
    transition: background-color 0.2s ease;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    display: inline;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.ayah:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.dark .ayah:hover {
    background-color: rgba(59, 130, 246, 0.2);
}

.ayah-playing {
    background-color: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.dark .ayah-playing {
    background-color: rgba(96, 165, 250, 0.3);
    color: #60a5fa;
}

/* Verse Marker Styles */
.verse-marker {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    margin: 0 0.25rem;
    vertical-align: middle;
    transition: box-shadow 0.25s, filter 0.25s;
}

.verse-marker:hover, .verse-marker:focus {
    z-index: 2;
}

.verse-marker:hover .verse-icon, .verse-marker:focus .verse-icon {
    filter: drop-shadow(0 0 8px #3b82f6aa) brightness(1.2);
    transition: filter 0.2s;
}

.dark .verse-marker:hover .verse-icon, .dark .verse-marker:focus .verse-icon {
    filter: drop-shadow(0 0 10px #60a5fa) brightness(1.3);
}

.verse-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../icons/seperator.svg');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.verse-number {
    position: relative;
    z-index: 1;
    font-size: 0.8rem;
    font-weight: bold;
    color: #2d3748;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.dark .verse-number {
    color: #f7fafc;
}

/* Ayah Context Menu Popover */
#ayahMenuPopover {
    display: none;
    position: absolute;
    z-index: 10000;
    min-width: 200px;
    max-width: 280px;
    background-color: #fff;
    border: 0.1px solid #ccc;
    border-radius: 0.375rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 8px;
    transition: opacity 0.3s ease;
    word-break: break-word;
    white-space: normal;
}

#ayahMenuPopover .flex {
    display: flex;
    flex-direction: row;
    gap: 4px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

#ayahMenuPopover button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 36px;
    height: 36px;
    padding: 8px;
    color: #333;
    border: none;
    background: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-align: center;
    white-space: nowrap;
    border-radius: 6px;
}

#ayahMenuPopover button:hover {
    background-color: #f0f0f0;
}

#ayahMenuPopover i {
    font-size: 14px;
}

.dark #ayahMenuPopover {
    background-color: #374151;
    border-color: #4b5563;
}

.dark #ayahMenuPopover button {
    color: #f3f4f6;
}

.dark #ayahMenuPopover button:hover {
    background-color: #4b5563;
}

/* Auto-appearing tooltip for reading mode button */
#btnReadingMode.show-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
    pointer-events: none;
    animation: tooltipFadeIn 0.3s ease-out;
}

#btnReadingMode.show-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(236, 10, 10, 0.95);
    z-index: 1000;
    margin-bottom: -5px;
    pointer-events: none;
    animation: tooltipFadeIn 0.3s ease-out;
}

#btnReadingMode {
    position: relative;
}

/* Auto-appearing tooltips for ayah menu buttons */
#ayahMenuPopover button.show-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 20001;
    margin-bottom: 5px;
    pointer-events: none;
    animation: tooltipFadeIn 0.3s ease-out;
}

#ayahMenuPopover button.show-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(236, 10, 10, 0.95);
    z-index: 20001;
    margin-bottom: -4px;
    pointer-events: none;
    animation: tooltipFadeIn 0.3s ease-out;
}

/* Mobile-specific tooltip positioning */
@media (max-width: 768px) {
    #ayahMenuPopover button.show-tooltip::after {
        bottom: auto;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-bottom: 0;
        margin-top: 15px;
        font-size: 12px;
        padding: 8px 12px;
        max-width: 150px;
        white-space: nowrap; /* Change from 'normal' to 'nowrap' */
        text-align: center;
        word-wrap: normal;   /* Change from 'break-word' to 'normal' */
        hyphens: manual;     /* Change from 'auto' to 'manual' */
    }
    
    #ayahMenuPopover button.show-tooltip::before {
        bottom: auto;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-bottom: 0;
        margin-top: 10px;
        border-top-color: rgba(236, 10, 10, 0.95);
        border-bottom-color: rgba(0, 0, 0, 0.9);
    }
    
    /* Specific positioning for each button to avoid overlap */
    #ayahMenuPlay.show-tooltip::after {
        margin-top: 20px;
    }
    
    #ayahMenuPlay.show-tooltip::before {
        margin-top: 15px;
    }
    
    #ayahMenuTranslation.show-tooltip::after {
        margin-top: 20px;
    }
    
    #ayahMenuTranslation.show-tooltip::before {
        margin-top: 15px;
    }
    
    #ayahMenuTafsir.show-tooltip::after {
        margin-top: 20px;
    }
    
    #ayahMenuTafsir.show-tooltip::before {
        margin-top: 15px;
    }
    
    #ayahMenuBookmark.show-tooltip::after {
        margin-top: 20px;
    }
    
    #ayahMenuBookmark.show-tooltip::before {
        margin-top: 15px;
    }
    
    #ayahMenuShare.show-tooltip::after {
        margin-top: 20px;
    }
    
    #ayahMenuShare.show-tooltip::before {
        margin-top: 15px;
    }
}

#ayahMenuPopover button {
    position: relative;
}

/* Auto-appearing tooltip for verse marker */
.verse-marker.show-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 8px;
    pointer-events: none;
    animation: tooltipFadeIn 0.3s ease-out;
}

.verse-marker.show-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(236, 10, 10, 0.95);
    z-index: 1000;
    margin-bottom: -4px;
    pointer-events: none;
    animation: tooltipFadeIn 0.3s ease-out;
}

/* Mobile-specific verse marker tooltip positioning */
@media (max-width: 768px) {
    .verse-marker.show-tooltip::after {
        font-size: 12px;
        padding: 8px 12px;
        margin-bottom: 10px;
        max-width: 200px;
        white-space: nowrap; /* Add this line */
        text-align: center;
    }
}

/* Dark mode tooltip styles */
.dark #ayahMenuPopover button.show-tooltip::after,
.dark .verse-marker.show-tooltip::after,
.dark #btnReadingMode.show-tooltip::after {
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
}

.dark #ayahMenuPopover button.show-tooltip::before,
.dark .verse-marker.show-tooltip::before,
.dark #btnReadingMode.show-tooltip::before {
    border-top-color: rgba(236, 10, 10, 0.95);
}

/* Dark mode mobile tooltips */
@media (max-width: 768px) {
    .dark #ayahMenuPopover button.show-tooltip::before {
        border-top-color: rgba(236, 10, 10, 0.95);
        border-bottom-color: rgba(255, 255, 255, 0.95);
    }
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Prayer Settings Dropdown Styles */
#azanSoundSelect,
#asrCalculationSelect {
    text-align-last: center;
}

/* RTL Language Styles */
[dir="rtl"] #azanSoundSelect,
[dir="rtl"] #asrCalculationSelect {
    text-align-last: right;
}

/* LTR Language Styles */
[dir="ltr"] #azanSoundSelect,
[dir="ltr"] #asrCalculationSelect {
    text-align-last: left;
}

/* Ensure dropdown options are properly aligned */
#azanSoundSelect option,
#asrCalculationSelect option {
    text-align: inherit;
}

/* Force dropdown positioning for better cross-browser compatibility */
#azanSoundSelect:focus,
#asrCalculationSelect:focus {
    outline: none;
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Remove dropdown arrows */
#azanSoundSelect,
#asrCalculationSelect {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none !important;
}

/* Remove dropdown arrows for Firefox */
#azanSoundSelect::-ms-expand,
#asrCalculationSelect::-ms-expand {
    display: none;
}

/* Coming Prayer Indicator Styles */
.coming-prayer-indicator {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgb(59, 130, 246);
    transition: all 0.2s ease;
}

.dark .coming-prayer-indicator {
    color: rgb(147, 197, 253);
}

/* Coming Prayer Indicator - now integrated in text flow */
.coming-prayer-indicator {
    margin-top: 2px;
    font-weight: 400;
} 