@font-face {
    font-family: 'UthmanicHafs';
    src: 	url('https://verses.quran.foundation/fonts/quran/hafs/uthmanic_hafs/UthmanicHafs1Ver18.woff2	') format('woff2'),
         url('https://verses.quran.foundation/fonts/quran/hafs/uthmanic_hafs/UthmanicHafs1Ver18.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
        /* Désactiver le pull-to-refresh globalement */
        html,
        body {
            overscroll-behavior-y: none;    /* bloque le pull-to-refresh vertical */
            overscroll-behavior-x: contain; /* limite les overscroll horizontaux */
        }

        /* =========================================================
           STYLES GLOBAUX (mise en page générale)
           - Police, couleurs de fond, comportement du scroll
        ========================================================== */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

	html {
    	    direction: rtl;
	}

        body {
    font-family: 'Amiri', serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8f5e9 100%);
    color: #1b5e20;
    min-height: 100vh;
    direction: inherit;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    transition: background 0.3s ease, color 0.3s ease;

    /* ↓↓↓ SAFE AREA : pousse TOUT le contenu sous la barre de statut iPhone ↓↓↓ */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* 🌙 MODE SOMBRE - UTILISE UNE CLASSE */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d3d2d 100%) !important;
    color: #e0e0e0 !important;
}

body.dark-mode .container {
    background: rgba(30, 30, 30, 0.95) !important;
}

body.dark-mode .card {
    background: #2a2a2a !important;
    border-color: #444 !important;
}

body.dark-mode .search-input,
body.dark-mode input[type="text"],
body.dark-mode input[type="number"],
body.dark-mode select,
body.dark-mode textarea {
    background: #1f1f1f !important;
    color: #64b5f6 !important;
    border-color: #444 !important;
}

body.dark-mode .result-item {
    background: #2a2a2a !important;
    border-color: #444 !important;
    color: #e0e0e0 !important;
}

body.dark-mode .result-text {
    color: #e0e0e0 !important;
}

body.dark-mode .result-header {
    color: #b0bec5 !important;
}

body.dark-mode .btn-primary {
    background: #2e7d32 !important;
    color: white !important;
}

body.dark-mode .btn-primary:hover {
    background: #388e3c !important;
}

body.dark-mode .btn-secondary {
    background: #3a3a3a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .btn-secondary:hover {
    background: #4a4a4a !important;
}

body.dark-mode .btn-print,
body.dark-mode .btn-fullscreen {
    background: #3a3a3a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .verse-carousel-container {
    background: #1a1a1a !important;
}

body.dark-mode .verse-carousel-item {
    background: #2a2a2a !important;
}

body.dark-mode .verse-carousel-content {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .verse-carousel-text {
    color: #e0e0e0 !important;
}

body.dark-mode .verse-carousel-header {
    color: #b0bec5 !important;
}

body.dark-mode label {
    color: #e0e0e0 !important;
}

body.dark-mode .radio-option label {
    color: #e0e0e0 !important;
}

body.dark-mode .search-history-dropdown,
body.dark-mode .history-item,
body.dark-mode .surah-filter-dropdown {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
    border-color: #444 !important;
}

body.dark-mode .history-item:hover {
    background: #3a3a3a !important;
}

body.dark-mode .modal-pdf-carousel-content {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .modal-pdf-carousel-title,
body.dark-mode .modal-pdf-carousel-subtitle {
    color: #e0e0e0 !important;
}

body.dark-mode .modal-pdf-carousel-btn {
    background: #2e7d32 !important;
    color: white !important;
    border-color: #3a7d32 !important;
}

body.dark-mode .modal-pdf-carousel-btn:hover {
    background: #388e3c !important;
}

body.dark-mode .pdf-processing {
    background: rgba(0, 0, 0, 0.9) !important;
    color: #e0e0e0 !important;
}

body.dark-mode .dark-mode-btn {
    background: #2e7d32 !important;
    color: white !important;
}

body.dark-mode .dark-mode-btn:hover {
    background: #388e3c !important;
}

body.dark-mode .results-counter,
body.dark-mode .verse-counter,
body.dark-mode .subtitle,
body.dark-mode .root-warning {
    color: #b0bec5 !important;
}

body.dark-mode .error-message {
    color: #ff6b6b !important;
}

body.dark-mode .loading-spinner {
    color: #e0e0e0 !important;
}


        body.fullscreen {
            margin: 0;
            padding: 0;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            will-change: contents;
            overscroll-behavior-y: contain;
        }

        /* =========================================================
           EN-TÊTE PRINCIPALE (titre de l'application)
        ========================================================== */
        .header {
            background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
            color: white;
            padding: 12px 24px;
            text-align: center;
            border-radius: 12px;
            margin-bottom: 24px;
            box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .header-title-container {
            flex: 1;
            text-align: center;
        }

        h1 {
            font-size: 32px;
            font-weight: 700;
            margin-bottom: 8px;
            font-family: 'Amiri', serif;
        }

        .subtitle {
            font-size: 16px;
            opacity: 0.9;
            font-family: 'Amiri', serif;
        }

        .dark-mode-btn {
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: 2px solid white;
            padding: 10px 14px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 18px;
            font-weight: 700;
            transition: all 0.3s ease;
            flex-shrink: 0;
            font-family: 'Amiri', serif;
            white-space: nowrap;
        }

        .dark-mode-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.05);
        }

        .dark-mode-btn:active {
            transform: scale(0.95);
        }

        /* =========================================================
           CARTES (card) GÉNÉRALES
           - Utilisées pour les blocs (filtres, options, résultats)
        ========================================================== */
        .card {
            background: white;
            border-radius: 12px;
            padding: 10px 16px 6px 16px;
	    margin-top: -6px;
            margin-bottom: 6px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            border: 2px solid #00bcd4;
            will-change: auto;
        }

        .filter-group {
            margin-bottom: 10px;
        }

        label {
            display: block;
            font-size: 14px;
            font-weight: 700;
            margin-bottom: 4px;
            color: #1b5e20;
            font-family: 'Amiri', serif;
	    text-align: start;
        }

        select,
input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    border: 2px solid #c8e6c9;
    border-radius: 8px;
    font-family: 'Amiri', serif;
    background: white;
    color: #f9a825;
    font-weight: 700;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
}

        select:focus,
        input[type="number"]:focus {
            outline: none;
            border-color: #2e7d32;
            box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
        }

        .error-message {
            background: #fce4ec;
            color: #c62828;
            padding: 10px;
            border-radius: 6px;
            margin-top: 8px;
            font-size: 14px;
            display: none;
            font-family: 'Amiri', serif;
            border-inline-start: 4px solid #c62828;
        }

        .root-warning {
            color: #e65100;
            font-size: 13px;
            margin-top: 5px;
            display: none;
            font-weight: bold;
        }

        .verse-counter {
            background: #e8f5e9;
            padding: 8px;
            border-radius: 8px;
            text-align: center;
            font-size: 16px;
            font-weight: 700;
            color: #2e7d32;
            margin: 10px 0;
            font-family: 'Amiri', serif;
            border: 2px solid #2e7d32;
        }

        /* =========================================================
           OPTIONS DE TYPE DE RECHERCHE (radio buttons)
        ========================================================== */
        .search-type-group {
            margin: 12px 0;
        }

        .radio-option {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: space-between;
    padding: 7px 8px;
    margin-bottom: 6px;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
    gap: 4px;
}

        .radio-option:hover {
            background: #e8f5e9;
        }

        .radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-left: 0;
    cursor: pointer;
    flex-shrink: 0;
    order: 1;
}

        .radio-option label {
    margin: 0 4px;
    cursor: pointer;
    flex: 1;
    font-family: 'Amiri', serif;
    font-size: clamp(12px, 3.5vw, 16px);
    font-weight: 700;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: start;
    order: 2;
    line-height: 1.3;
}

        .checkbox-wrapper {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    background: #f9f9f9;
    border-radius: 6px;
    flex-shrink: 0;
    overflow: visible;
    position: static;
    order: 3;
    gap: 4px;
}

        .checkbox-wrapper input[type="checkbox"] {
            width: 18px;
            height: 18px;
            margin-left: 8px;
            cursor: pointer;
        }

        .checkbox-wrapper label {
    margin: 0;
    font-size: clamp(9px, 2.5vw, 12px);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: visible;
    color: #1b5e20;
}

        /* =========================================================
           BOUTONS GÉNÉRAUX
        ========================================================== */
        .btn {
            padding: 14px;
            font-size: 16px;
            font-weight: 700;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-family: 'Amiri', serif;
            transition: all 0.3s ease;
            min-width: 60px;
            will-change: transform, box-shadow;
        }

        .btn-primary {
            width: 100%;
            padding: 16px;
            font-size: 20px;
            background: #2e7d32;
            color: white;
        }

        .btn-primary:hover {
            background: #1b5e20;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(46, 125, 50, 0.4);
        }

        /* Barre de boutons au-dessus de la barre de recherche */
	 .buttons-bar {
    	     display: flex;
    	     align-items: center;
    	     justify-content: flex-start;  /* ← au lieu de center */
    	     gap: 4px;

    	/* un peu plus de padding interne */
    	     padding: 10px 12px;

    	     background: linear-gradient(90deg, #f57f17, #2e7d32);
    	     border-radius: 16px;

    	/* ↓↓↓ DÉCALAGE VERS LE BAS ↓↓↓ */
    	     margin: 10px auto 16px; /* au lieu de 0 auto 12px */

    	     max-width: 100%;
    	     overflow-x: auto;
    	     scrollbar-width: thin;
    	     scrollbar-color: rgba(255,255,255,0.5) transparent;
    	     -webkit-overflow-scrolling: touch;
    	     scroll-snap-type: x mandatory;
    	     cursor: grab;
    	     position: relative;             /* Pour ::before/::after */
	}

	.btn:last-child {
    	     margin-inline-start: 4px;
    	     margin-inline-end: 2px;
	}

    /* Fix : uniquement le bouton plein écran (🖥️ تعطيل ملء الشاشة) - taille réduite sur petits écrans */
@media (max-width: 480px) {
    #fullscreenBtn {
        font-size: 12px !important;
        padding: 5px 6px !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
    }
}

@media (max-width: 380px) {
    #fullscreenBtn {
        font-size: 10px !important;
        padding: 4px 5px !important;
    }
}

	/* ✅ Padding symétrique pour scroll max */
	.buttons-bar {
    	    padding-right: 12px;  /* Plus d'espace droite */
    	    padding-left: 12px;   /* Égal gauche */
	}

	.buttons-bar:active {
    	    cursor: grabbing;
	}

	.buttons-bar::-webkit-scrollbar { height: 4px; }
	.buttons-bar::-webkit-scrollbar-track { background: transparent; }
	.buttons-bar::-webkit-scrollbar-thumb { 
   	     background: rgba(255,255,255,0.5); 
   	     border-radius: 2px; 
	}

	/* Zoom petits (compact) */
	.tool-btn, .zoom-display {
    	    min-width: 28px;
    	    height: 32px;
    	    font-size: 12px;
    	    padding: 4px 2px;
	}

	/* ✅ GRANDS boutons texte préservés */
	.btn {
    	    min-height: 38px !important;        /* Plus grand */
    	    padding: 8px 12px !important;       /* Texte lisible */
    	    font-size: 13px !important;         /* Lisible mobile */
    	    white-space: nowrap;                /* Pas de retour ligne */
    	    flex-shrink: 0;                     /* Ne rétrécit pas */
	}

	.buttons-bar #fullscreenBtn {
    	    white-space: normal !important;
    	    overflow-wrap: break-word !important;
    	    word-break: break-word !important;
    	    line-height: 1.1 !important;
	}

	/* Mobile : zoom encore plus compacts + bande plus basse */
	   @media (max-width: 480px) {
    	   .buttons-bar {
             gap: 2px;
             padding: 10px 8px;
             margin-top: 12px;   /* espace supplémentaire sous le haut de l'écran */
             margin-bottom: 18px;
    	}
    	   .tool-btn, .zoom-display {
             min-width: 24px !important;
             height: 28px !important;
             font-size: 11px !important;
             padding: 2px !important;
    	}
    	  .btn {
             min-height: 36px !important;
             padding: 6px 10px !important;
             font-size: 12px !important;
    		}
	}

        .btn-secondary {
            flex: 1;
            background: #1006d2;
            color: white;
            margin-bottom: 0;
            white-space: nowrap;
            min-width: 120px;
        }

        .btn-secondary:hover {
            background: #616161;
        }

        .btn-print {
            flex: 1;
            background: #3949ab;
            color: white;
            white-space: nowrap;
            min-width: 120px;
        }

        .btn-print:hover {
            background: #1565c0;
        }

        .btn-print:disabled {
            background: #90caf9;
            cursor: not-allowed;
            opacity: 0.7;
        }

        .btn-fullscreen {
    	    flex: 1;
    	    background: #0288d1;
    	    color: white;
    	    white-space: normal;
    	    overflow-wrap: break-word;
    	    word-break: break-word;
    	    min-width: 120px;
	}

        .btn-fullscreen:hover {
            background: #e65100;
        }

.buttons-bar .btn-secondary,
.buttons-bar .btn-print,
.buttons-bar .btn-fullscreen {
    width: clamp(96px, 22vw, 110px);
    height: 44px;
    padding: 4px 6px;

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.1;
    overflow: hidden;
}
        /* =========================================================
           INDICATEURS DE CHARGEMENT ET MODELES PDF
        ========================================================== */
        .loading-spinner {
            text-align: center;
            padding: 20px;
            color: #2e7d32;
            font-size: 18px;
            font-weight: bold;
            display: none;
            font-family: 'Amiri', serif;
        }

        .loading-spinner.active {
            display: block;
        }

        .pdf-processing {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            padding: 30px;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
            z-index: 10000;
            display: none;
            text-align: center;
            min-width: 250px;
            max-width: 400px;
        }

        .pdf-processing.active {
            display: block;
            animation: slideIn 0.3s ease;
        }

        @keyframes slideIn {
            from {
                transform: translate(-50%, -50%) scale(0.9);
                opacity: 0;
            }
            to {
                transform: translate(-50%, -50%) scale(1);
                opacity: 1;
            }
        }

        .pdf-processing-spinner {
            width: 40px;
            height: 40px;
            border: 4px solid #e8f5e9;
            border-top: 4px solid #2e7d32;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 15px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .pdf-processing-text {
            font-size: 16px;
            color: #1b5e20;
            font-family: 'Amiri', serif;
            margin-bottom: 10px;
            font-weight: 700;
        }

        .pdf-progress {
            font-size: 14px;
            color: #666;
            font-family: 'Amiri', serif;
            margin-bottom: 10px;
        }

        .pdf-progress-bar {
            width: 100%;
            height: 8px;
            background: #e0e0e0;
            border-radius: 4px;
            margin-top: 10px;
            overflow: hidden;
        }

        .pdf-progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #2e7d32, #1b5e20);
            width: 0%;
            transition: width 0.3s ease;
        }

        /* Modèle pour options PDF spécifiques au carrousel */
        .modal-pdf-carousel {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 9999;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .modal-pdf-carousel.active {
            display: flex;
            animation: fadeIn 0.3s ease;
        }

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

        .modal-pdf-carousel-content {
            background: white;
            border-radius: 16px;
            padding: 30px;
            max-width: 400px;
            width: 90%;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            animation: slideUp 0.3s ease;
            text-align: center;
            direction: rtl;
        }

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

        .modal-pdf-carousel-title {
            font-size: 24px;
            font-weight: 700;
            color: #2e7d32;
            margin-bottom: 20px;
            font-family: 'Amiri', serif;
        }

        .modal-pdf-carousel-subtitle {
            font-size: 16px;
            color: #666;
            margin-bottom: 25px;
            font-family: 'Amiri', serif;
        }

        .modal-pdf-carousel-buttons {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .modal-pdf-carousel-btn {
            padding: 14px;
            font-size: 16px;
            font-weight: 700;
            border: 2px solid #2e7d32;
            background: white;
            color: #2e7d32;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-family: 'Amiri', serif;
        }

        .modal-pdf-carousel-btn:hover {
            background: #2e7d32;
            color: white;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
        }

        .modal-pdf-carousel-btn-cancel {
            background: #f5f5f5;
            color: #666;
            border-color: #ddd;
        }

        .modal-pdf-carousel-btn-cancel:hover {
            background: #e0e0e0;
            color: #333;
            border-color: #999;
        }

        /* =========================================================
           BARRE DE RECHERCHE + HISTORIQUE + FILTRE SURAH
        ========================================================== */
        .search-bar-container {
            position: relative;
            display: flex;
            gap: 12px;
            margin-bottom: 6px;
        }

        .search-input-wrapper {
            flex: 1;
            position: relative;
        }

        .search-input {
            width: 100%;
            padding: 7px 12px;
            font-size: 16px;
            border: 2px solid #c8e6c9;
            border-radius: 8px;
            font-family: 'Amiri', serif;
            transition: all 0.3s ease;
        }

        .search-input:focus {
            outline: none;
            border-color: #2e7d32;
            box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
        }

        .search-history-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            background: white;
            border: 2px solid #c8e6c9;
            border-top: none;
            border-radius: 0 0 8px 8px;
            max-height: 300px;
            overflow-y: auto;
            display: none;
            z-index: 1000;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
	    direction: rtl;
        }

        .search-history-dropdown.active {
            display: block;
        }

        .history-item {
            padding: 12px 14px;
            border-bottom: 1px solid #f0f0f0;
            cursor: pointer;
            font-size: 16px;
            font-family: 'Amiri', serif;
            transition: background 0.2s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
	    direction: rtl;
    	    text-align: right;
        }

        .root-suggestion-item {
            color: #1b5e20;
            font-weight: bold;
        }

        .root-suggestion-item small {
            color: #666;
            font-weight: normal;
            margin-inline-end: 10px;
        }

        .history-item:hover {
            background: #e8f5e9;
        }

        .history-item-text {
            flex: 1;
        }

        .history-item-delete {
            color: #d32f2f;
            cursor: pointer;
            font-size: 18px;
            padding: 0 8px;
            display: none;
            transition: all 0.2s ease;
        }

        .history-item:hover .history-item-delete {
            display: block;
        }

        .history-empty {
            padding: 12px 14px;
            color: #999;
            text-align: center;
            font-size: 14px;
            font-family: 'Amiri', serif;
        }

        .mic-btn {
            background: #2e7d32;
            color: white;
            border: none;
            width: 42px;
            height: 46px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 20px;
            padding: 0;
            transition: all 0.3s ease;
            flex-shrink: 0;
        }

        .mic-btn:hover {
            background: #1b5e20;
            transform: scale(1.05);
        }

        .mic-btn.recording {
            background: #d32f2f;
            animation: pulse 0.5s infinite;
        }

        @keyframes pulse {
            0%, 100% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.7); }
            50% { box-shadow: 0 0 0 10px rgba(211, 47, 47, 0); }
        }

        .results-counter {
    	    background: #e8f5e9;
    	    padding: 5px 10px;
    	    border-radius: 8px;
    	    margin-bottom: 6px;
    	    font-size: 13px;
    	    font-weight: 700;
    	    color: #2e7d32;
    	    font-family: 'Amiri', serif;
    	    border: 1px solid #c8e6c9;
    	    line-height: 1.4;
    	    text-align: center;
    	    word-break: keep-all;
	}

	@media (max-width: 480px) {
    	  .results-counter {
            font-size: 11px;
            padding: 4px 8px;
            line-height: 1.3;
    	   }
	}

        .result-item {
            background: white;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            padding: 16px;
            margin-bottom: 8px;
            transition: all 0.3s ease;
            will-change: transform;
        }

        .result-item:hover {
            box-shadow: 0 4px 12px rgba(46, 125, 50, 0.2);
            border-color: #2e7d32;
        }

        .result-header {
    	    background: #2e7d32;
    	    color: white;
    	    padding: 5px 12px;
    	    border-radius: 6px;
    	    margin-bottom: 6px;
    	    font-size: 14px;
    	    font-weight: 700;
    	    font-family: 'Amiri', serif;
    	    line-height: 1.3;
	    direction: rtl;
	}

        .result-header span {
            color: #00bcd4 !important;
            font-size: 18px !important;
            font-weight: bold !important;
        }

	/* Ancienne police du texte coranique */
        /* .result-text { */
            /* font-size: 22px; */
            /* line-height: 1.8; */
            /* color: #212121; */
            /* font-family: 'Amiri', serif; */
            /* word-break: break-word; */
            /* user-select: text; */
        /* } */

	/* Nouvelle police du texte coranique */
	.result-text,
	.verse-carousel-text,
	.verse-carousel-item {
    	    font-family: 'UthmanicHafs', 'Amiri', serif !important;
    	    line-height: 2.25 !important;
    	    direction: rtl !important;
    	    text-align: right !important;
    	    font-weight: 500 !important;
    	    font-feature-settings: "liga" 1, "dlig" 1, "hlig" 1;
	}

	.verse-text-zoomable {
    	    font-size: 29px !important;
	}
}

    	/* ↓↓↓ Appui long iOS : permet la sélection et le menu contextuel ↓↓↓ */
    	    user-select: text !important;
    	    -webkit-user-select: text !important;
    	    -webkit-touch-callout: default !important;
	}

	.scroll-top-btn {
    	    position: absolute;
    	    inset-inline-end: 8px;
    	    top: 50%;
    	    transform: translateY(-50%);
    	    background: rgba(255,255,255,0.9);
    	    border: none;
    	    border-radius: 50%;
    	    width: 28px;
    	    height: 28px;
    	    font-size: 14px;
    	    font-weight: bold;
    	    color: #2e7d32;
    	    cursor: pointer;
    	    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    	    z-index: 10;
    	    transition: all 0.2s ease;
	}
	.scroll-top-btn:hover {
    	    background: #2e7d32;
    	    color: white;
    	    transform: translateY(-50%) scale(1.1);
	}
	.dark-mode .scroll-top-btn {
    	    background: rgba(46,125,50,0.9);
    	    color: white;
	}
	.dark-mode .scroll-top-btn:hover {
    	    background: white;
    	    color: #2e7d32;
	}

	.result-header {
    	    position: relative;  /* ✅ Pour position absolute bouton */
    	    padding-inline-start: 36px;
	}

.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    font-weight: bold;
    color: #2e7d32;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 10;
    transition: all 0.2s ease;
    margin: 0;
}
.scroll-top-btn {
    inset-inline-start: 8px;
}
.scroll-bottom-btn {
    inset-inline-end: 8px;
}
.scroll-btn:hover {
    background: #2e7d32;
    color: white;
    transform: translateY(-50%) scale(1.1);
}
.dark-mode .scroll-btn {
    background: rgba(46,125,50,0.9);
    color: white;
}
.dark-mode .scroll-btn:hover {
    background: white;
    color: #2e7d32;
}

.result-header {
    position: relative;
    padding: 6px 48px;
    text-align: center;
}

        /* =========================================================
           CONTENEUR PDF INVISIBLE POUR GENERATION D'IMAGES
        ========================================================== */
	.tool-btn {
    	    background: #2e7d32;
    	    color: white;
    	    border: none;
    	    border-radius: 50%;
    	    width: 36px;
   	    height: 36px;
    	    font-size: 16px;
    	    cursor: pointer;
    	    margin-inline-start: 4px;
    	    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
	}

	.tool-btn:hover { background: #4caf50; }
	.tool-btn:active { background: #1b5e20; }
	.zoom-display {
    	    font-size: 14px;
    	    color: #2e7d32;
    	    font-weight: bold;
    	    margin-inline-start: 8px;
    	    min-width: 45px;
    	    text-align: center;
	}

	/* Zoom versets */
	.verse-text-zoomable {
    	    transition: font-size 0.2s ease;
	}

        .pdf-container {
            position: fixed;
            left: -9999px;
            top: -9999px;
            width: 800px;
            background: white;
            padding: 20px;
            font-family: 'Amiri', serif;
            direction: rtl;
            text-align: right;
        }

        .pdf-page {
            width: 100%;
            min-height: 1122px;
            background: white;
            padding: 20px;
            position: relative;
        }

        .pdf-title {
            text-align: center;
            font-size: 24px;
            font-weight: bold;
            color: #2e7d32;
            margin-bottom: 15px;
            font-family: 'Amiri', serif;
        }

        .pdf-header {
            text-align: center;
            font-size: 14px;
            color: #666;
            border-bottom: 2px solid #2e7d32;
            padding-bottom: 10px;
            margin-bottom: 15px;
            font-family: 'Amiri', serif;
        }

        .pdf-result {
            margin-bottom: 15px;
            display: block;
        }

        .pdf-result-header {
            background: #2e7d32;
            color: white;
            padding: 8px 12px;
            border-radius: 4px;
            margin-bottom: 8px;
            font-size: 14px;
            font-weight: bold;
            font-family: 'Amiri', serif;
        }

        .pdf-result-text {
            font-size: 18px;
            line-height: 1.8;
            color: #212121;
            font-family: 'Amiri', serif;
        }

        .hidden {
            display: none !important;
        }

	/* =======================
   	MODALE À PROPOS
   	======================= */

.about-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Amiri', serif;
}

.about-modal.hidden {
    display: none;
}

.about-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.about-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    padding: 20px 20px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    direction: rtl;
    overflow-y: auto;
    z-index: 1;
}

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

.about-modal-header h2 {
    font-size: 22px;
    margin: 0;
    color: #2e7d32;
}

.about-modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.about-modal-body {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 16px;
}

.about-modal-footer {
    text-align: end;
}

        /* =========================================================
           LISTE SURAH + WHEEL DES VERSETS (dans la recherche par numéro)
        ========================================================== */
        .surah-filter-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            background: white;
            border: 2px solid #2e7d32;
            border-top: none;
            border-radius: 0 0 8px 8px;
            max-height: 300px;
            overflow-y: auto;
            display: none;
            z-index: 1001;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
        }

        .surah-filter-dropdown.active {
            display: block;
        }

        .surah-filter-item {
            padding: 10px 14px;
            border-bottom: 1px solid #f0f0f0;
            cursor: pointer;
            font-size: 16px;
            font-family: 'Amiri', serif;
            transition: background 0.2s ease;
            color: #1b5e20;
        }

        .surah-filter-item:hover {
            background: #e8f5e9;
            font-weight: 600;
        }

        .surah-filter-item.center-selected {
            background: #fff3cd;
            color: #2e7d32;
            font-weight: 700;
            border: 2px solid #2e7d32;
            margin: 5px 5px;
            padding: 12px 14px;
        }

        .verse-wheel-container {
            position: relative;
            margin-top: 12px;
            padding: 12px;
            background: #f5f5f5;
            border-radius: 8px;
            border: 2px solid #c8e6c9;
        }

        .verse-wheel-label {
            font-size: 14px;
            font-weight: 700;
            color: #2e7d32;
            margin-bottom: 10px;
            text-align: center;
            font-family: 'Amiri', serif;
        }

        .verse-wheel {
            display: flex;
            align-items: center;
            gap: 8px;
            height: 200px;
            background: white;
            border-radius: 8px;
            overflow: hidden;
            border: 2px solid #e0e0e0;
            position: relative;
        }

        .verse-wheel-items {
            flex: 1;
            height: 100%;
            overflow-y: scroll;
            display: flex;
            flex-direction: column;
            scroll-snap-type: y mandatory;
            scroll-behavior: smooth;
        }

        .verse-wheel-item {
            min-height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            font-family: 'Amiri', serif;
            font-weight: 500;
            color: #999;
            cursor: pointer;
            scroll-snap-align: center;
            transition: all 0.2s ease;
            border: 2px solid transparent;
        }

        .verse-wheel-item:hover {
            background: #f0f0f0;
        }

        .verse-wheel-item.selected {
            background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
            color: white;
            font-weight: 700;
            font-size: 20px;
            border: 2px solid #00bcd4;
        }

        .verse-wheel-center-line {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            width: 100%;
            height: 40px;
            border-top: 2px dashed #2e7d32;
            border-bottom: 2px dashed #2e7d32;
            pointer-events: none;
            z-index: 10;
        }

        .verse-wheel-selected-display {
            background: #e8f5e9;
            border-radius: 8px;
            padding: 8px 12px;
            text-align: center;
            font-size: 16px;
            font-weight: 700;
            color: #2e7d32;
            font-family: 'Amiri', serif;
            margin-top: 10px;
            border: 2px solid #2e7d32;
        }

        /* =========================================================
           CARROUSEL DES VERSETS (MODE RECHERCHE PAR NUMÉRO)
           - CONTENEUR PRINCIPAL
           - ZONE DE SCROLL
           - ITEMS
           - BOUTONS DE NAVIGATION
        ========================================================== */
        .verse-carousel-container {
            background: white;
            border-radius: 12px;
            border: 2px solid #2e7d32;
            overflow: hidden;
            position: relative;
            margin-top: 16px;
            padding: 0;
            height: calc(100vh - 300px);
            max-height: 90vh;
            box-shadow: 0 4px 12px rgba(46, 125, 50, 0.15);
            display: flex;
            flex-direction: column;
        }

        .verse-carousel-scroll {
            flex: 1;
            overflow-y: scroll;
            scroll-snap-type: none;
            scroll-behavior: auto;
            direction: rtl;
            min-height: 0;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
        }

        .verse-carousel-scroll::-webkit-scrollbar {
            width: 6px;
        }

        .verse-carousel-scroll::-webkit-scrollbar-track {
            background: #f0f0f0;
        }

        .verse-carousel-scroll::-webkit-scrollbar-thumb {
            background: #2e7d32;
            border-radius: 3px;
        }

        .verse-carousel-item {
            min-height: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            scroll-snap-align: none;
            scroll-snap-stop: auto;
            padding: 40px 20px;
            border-bottom: 1px solid #f0f0f0;
            position: relative;
            flex-shrink: 0;
            will-change: background;
        }

        .verse-carousel-item.active {
            background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
            border-inline-start: 4px solid #2e7d32;
        }

        .verse-carousel-item.inactive {
            opacity: 0.5;
            background: white;
        }

        .verse-carousel-item.inactive:hover {
            opacity: 0.7;
            background: #f9f9f9;
        }

        .verse-carousel-content {
            width: 100%;
            max-height: 100%;
            overflow-y: auto;
            word-wrap: break-word;
            overflow-wrap: break-word;
            -webkit-hyphens: auto;
            -moz-hyphens: auto;
            hyphens: auto;
        }

        .verse-carousel-header {
            background: #2e7d32;
            color: white;
            padding: 8px 12px;
            border-radius: 6px;
            margin-bottom: 12px;
            font-size: 14px;
            font-weight: 700;
            font-family: 'Amiri', serif;
            text-align: start;
        }

        .verse-carousel-header span {
            color: #00bcd4;
            font-size: 16px;
        }

        .verse-carousel-text {
            font-size: 20px;
            line-height: 2.2;
            color: #212121;
            font-family: 'Amiri', serif;
            text-align: start;
            word-break: break-word;
            word-wrap: break-word;
            overflow-wrap: break-word;
            user-select: text;
            width: 100%;
            white-space: normal;
            display: block;
        }

/* ===== LANGUE : BOUTON + MENU + HINT (Hint = la main👈) ===== */

.language-switcher {
    position: relative;
    display: flex;
    flex-direction: row;   /* toujours: bouton, puis hint */
    align-items: center;
    gap: 6px;              /* espace entre bouton et hint */
    margin-inline-start: 8px;
    font-family: 'Cairo', 'Amiri', system-ui, sans-serif;
    font-size: 14px;
    direction: ltr;        /* ne pas hériter du RTL global */
}

.language-button {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    display: flex;              /* centrer le contenu */
    align-items: center;        /* vertical */
    justify-content: center;    /* horizontal */
    padding: 0;                 /* pas de padding parasite */
    background: #ffffff;
    color: #222;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
    font-size: 20px;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

body.dark-mode .language-button {
    background: #222;
    color: #f5f5f5;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.12);
}

.language-button:hover {
    box-shadow: 0 0 0 2px rgba(33,150,243,0.4);
}

.language-button-label {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
}

/* Hint : 👈 + texte */
.language-hint {
    background: transparent;
}

body.dark-mode .language-hint {
    background: transparent;
}

/* Menu déroulant des langues */
.language-menu {
    position: absolute;
    top: 110%;
    right: 0;
    min-width: 160px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    padding: 4px;
    display: none;
    z-index: 9999;
    color: #222; /* texte foncé sur fond clair */
}

.language-menu.open {
    display: block;
}

body.dark-mode .language-menu {
    background: #2b2b2b;
    box-shadow: 0 4px 16px rgba(0,0,0,0.7);
    color: #f5f5f5; /* texte clair sur fond sombre */
}

.language-menu-item {
    width: 100%;
    text-align: right;
    border: none;
    background: transparent;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    color: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.language-menu-item:hover {
    background: rgba(0,0,0,0.04);
}

body.dark-mode .language-menu-item:hover {
    background: rgba(255,255,255,0.08);
}

/* ===== MENU DES LANGUES EN GRILLE (comme mukarrar.com) ===== */
.language-menu {
    position: fixed;
    top: 64px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(560px, 94vw);
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
    padding: 0;
}

.language-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #e0e0e0;
}

.language-menu-title {
    font-weight: 700;
    font-size: 15px;
}

.language-menu-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 999px;
    border: 1px solid #cfd8dc;
    background: #f5f7f8;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.language-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px 6px;
    padding: 10px 10px 14px;
}

.language-menu-grid .language-menu-item {
    justify-content: flex-start;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 10px;
    font-size: 13px;
    text-align: start;
    min-height: 44px;
}

.language-menu-code {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 1.5px solid #2e7d32;
    color: #2e7d32;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, -apple-system, sans-serif;
}

.language-menu-name {
    overflow-wrap: normal;
    word-break: normal;
    min-width: 0;
    line-height: 1.25;
}

.language-menu-grid .language-menu-item.active {
    background: #2e7d32;
    color: #ffffff;
}

.language-menu-grid .language-menu-item.active .language-menu-code {
    border-color: #ffffff;
    color: #ffffff;
}

body.dark-mode .language-menu-header {
    border-bottom-color: #444;
}

body.dark-mode .language-menu-close {
    background: #333;
    border-color: #555;
}

body.dark-mode .language-menu-code {
    border-color: #81c784;
    color: #81c784;
}

/* ----- Menu des langues : petits telephones (26 langues) -----
   Hauteur reelle de l'ecran (dvh) quand le navigateur la connait,
   cases plus compactes pour que la grille reste lisible. */
@supports (height: 100dvh) {
    .language-menu {
        max-height: calc(100dvh - 90px);
    }
}

@media (max-width: 380px) {
    .language-menu-grid {
        gap: 3px 4px;
        padding: 8px 6px 10px;
    }
    .language-menu-grid .language-menu-item {
        gap: 4px;
        padding: 4px 4px;
        font-size: 12px;
        min-height: 40px;
    }
    .language-menu-code {
        flex: 0 0 22px;
        width: 22px;
        height: 22px;
        font-size: 9px;
    }
    .language-menu-header {
        padding: 8px 10px;
    }
    .language-menu-title {
        font-size: 14px;
    }
}

/ * Code pour conserver le header sur une seule ligne */
//.header-title-container {
  //display: flex;
   //flex-direction: column;
   //max-width: 100%; /* ou une largeur adaptée */
//}

/* h1 : une seule ligne + ... si trop long */
//.header-title-container h1 {
    //white-space: nowrap;
    //overflow: hidden;
    //text-overflow: ellipsis;
//}

/* taille par défaut */
.header-title-container h1 {
    font-size: 1.4rem;
}

/* Français / Espagnol : un peu plus petit */
html[lang="fr"] .header-title-container h1,
html[lang="es"] .header-title-container h1 {
    font-size: 1.25rem;
}

/* Mode jour : style normal */
//#resultsCounter {
    //font-size: 16px;
    //color: #333;
//}

/* Mode nuit : texte très lisible */
body.dark-mode #resultsCounter {
    color: #6ee7b7 !important;              /* texte en vert lumineux */
}

/* Optionnel : léger fond et bord en mode nuit pour le remarquer */
body.dark-mode #resultsCounter {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 26px;
    padding: 6px 10px;
}

        /* =========================================================
           BARRE DE CONTROLES DU CARROUSEL (3 BOUTONS)
           - Toujours sur une seule ligne
           - Scroll horizontal si nécessaire
        ========================================================== */
        .verse-carousel-controls {
            display: flex;
            gap: 8px;
            padding: 12px;
            background: #f5f5f5;
            border-top: 1px solid #e0e0e0;
            justify-content: center;
            /* IMPORTANT : NE PAS CASSER LA LIGNE, SCROLL HORIZONTAL SI MANQUE DE PLACE */
            flex-wrap: nowrap;
            overflow-x: auto;
            overflow-y: hidden;
            position: relative;
            z-index: 100;
            min-height: 50px;
            -webkit-overflow-scrolling: touch;
        }

        .verse-carousel-btn {
            padding: 10px 18px;
            background: #2e7d32;
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.2s ease;
            font-family: 'Amiri', serif;
            min-width: 110px;
            visibility: visible !important;
            opacity: 1 !important;
            display: inline-flex !important;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            white-space: normal;
	    overflow-wrap: break-word;
	    word-break: break-word;
	    text-align: center;
        }

        .verse-carousel-btn:hover:not(:disabled) {
            background: #1b5e20;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(46, 125, 50, 0.3);
        }

        .verse-carousel-btn:focus {
            outline: 2px solid #2e7d32;
            outline-offset: 2px;
        }

        .verse-carousel-btn:active:not(:disabled) {
            transform: translateY(0);
        }

        .verse-carousel-btn:disabled {
            background: #ccc;
            cursor: not-allowed;
            opacity: 0.6;
        }

        .verse-carousel-position {
            text-align: center;
            padding: 8px;
            font-size: 12px;
            color: #666;
            background: white;
            border-top: 1px solid #e0e0e0;
            font-family: 'Amiri', serif;
            font-weight: 600;
        }

        /* Mode plein écran du carrousel (remplit toute la fenêtre) */
        .verse-carousel-fullscreen {
    	    position: fixed !important;
    	    top: 0 !important;
    	    left: 0 !important;
    	    right: 0 !important;
    	    bottom: 0 !important;
    	    z-index: 10000 !important;
    	    background: white !important;
    	    border-radius: 0 !important;
    	    height: 100vh !important;
    	    width: 100vw !important;
    	    max-height: 100vh !important;
    	    max-width: 100vw !important;
    	    overflow: visible !important;
    	    display: flex !important;
    	    flex-direction: column !important;

    /* ↓↓↓ SAFE AREA iPhone ↓↓↓ */
    	    padding-top: env(safe-area-inset-top) !important;
    	    padding-bottom: env(safe-area-inset-bottom) !important;
    	    padding-left: env(safe-area-inset-left) !important;
    	    padding-right: env(safe-area-inset-right) !important;

    	    margin: 0 !important;
    	    border: none !important;
    	    box-shadow: none !important;
    	    visibility: visible !important;
    	    opacity: 1 !important;
    	    -webkit-app-region: drag;
	}	

	    body.dark-mode .verse-carousel-fullscreen {
    	    background: #1a1a1a !important;
	}

        .verse-carousel-fullscreen .verse-carousel-scroll {
            max-height: calc(100vh - 120px) !important;
            height: auto !important;
            flex: 1 !important;
        }

        .verse-carousel-fullscreen .verse-carousel-controls {
            position: absolute !important;
            bottom: 50px !important;
            left: 0 !important;
            right: 0 !important;
            width: 100% !important;
        }

        .verse-carousel-fullscreen .verse-carousel-position {
            position: absolute !important;
            bottom: 0 !important;
            left: 0 !important;
            right: 0 !important;
            width: 100% !important;
        }

        /* Animation d'entrée du verset actif */
        @keyframes slideInVerse {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Sur mobile : ajuster la hauteur du carrousel */
        @media (max-width: 768px) {
            .verse-carousel-fullscreen {
                height: 100% !important;
                max-height: 100% !important;
            }
            
            body.fullscreen {
                margin: 0 !important;
                padding: 0 !important;
                overflow: hidden !important;
                width: 100vw !important;
                height: 100vh !important;
            }
        }

        /* Sur petit écran (<600px) : optimiser encore plus */
        @media (max-width: 600px) {
            .verse-carousel-fullscreen {
                position: fixed !important;
                top: 0 !important;
                left: 0 !important;
                right: 0 !important;
                bottom: 0 !important;
                width: 100vw !important;
                height: 100vh !important;
                max-width: 100vw !important;
                max-height: 100vh !important;
                padding: 0 !important;
                margin: 0 !important;
            }
            
            body.fullscreen {
                position: fixed !important;
                margin: 0 !important;
                padding: 0 !important;
                overflow: hidden !important;
                width: 100vw !important;
                height: 100vh !important;
                top: 0 !important;
                left: 0 !important;
            }
        }

        .verse-carousel-fullscreen .verse-carousel-scroll {
            max-height: calc(100vh - 120px);
        }

        .verse-carousel-item.active {
            animation: slideInVerse 0.2s ease;
        }

        /* =========================================================
           MEDIA QUERIES (ADAPTATION MOBILE)
        ========================================================== */
        @media (max-width: 600px) {
            .container {
                padding: 12px;
            }

            h1 {
                font-size: 24px;
            }

            .result-text {
                font-size: 20px;
            }

            .buttons-bar {
        	gap: 6px;
        	overflow-x: auto;
        	margin-top: 10px;   /* léger espace sur petits écrans */
        	margin-bottom: 16px;
   	   }

            .btn {
                font-size: 14px;
                padding: 12px;
                min-width: 100px;
            }

            .verse-carousel-container {
                height: calc(100vh - 300px);
            }

            .verse-carousel-item {
                padding: 30px 16px;
            }

            .verse-carousel-text {
                font-size: 18px;
                line-height: 2;
            }

            .header {
                flex-direction: column;
                gap: 12px;
            }

            .dark-mode-btn {
                width: 100%;
            }
        }

        /* Impression : cacher certains éléments */
        @media print {
            .buttons-bar,
            .search-bar-container,
            .mic-btn,
            .loading-spinner {
                display: none !important;
            }

            body {
                background: white;
            }
        }

        /* =========================================================
           ANIMATIONS POUR LES NOTIFICATIONS ET MENUS CONTEXTUELS
        ========================================================== */
        @keyframes slideUpNotif {
            from {
                transform: translateX(-50%) translateY(20px);
                opacity: 0;
            }
            to {
                transform: translateX(-50%) translateY(0);
                opacity: 1;
            }
        }

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

        @keyframes menuAppear {
            from {
                transform: scale(0.8);
                opacity: 0;
            }
            to {
                transform: scale(1);
                opacity: 1;
            }
        }

        /* Menu contextuel des mots (clic droit / appui long) */
        #word-context-menu {
            position: fixed;
            visibility: hidden;
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.5);
            z-index: 99999;
            padding: 0;
            min-width: 220px;
            max-width: 85vw;
            width: auto;
            animation: menuAppear 0.15s ease;
            direction: rtl;
            text-align: right;
            max-height: 80vh;
            overflow-y: auto;
            font-family: 'Amiri', serif;
        }

.header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* on garde */
    gap: 12px;
}

.header-title-container {
    flex: 1;
    text-align: center;
}

/* Nouveau conteneur de boutons */
.header-buttons-wrapper {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Les deux boutons peuvent rétrécir un peu sur mobile */
.header-buttons-wrapper .dark-mode-btn {
    padding: 8px 10px;
    font-size: 16px;
    max-width: 140px;
}

/* ===== OPTIONS DE RECHERCHE - ADAPTATION MODE SOMBRE ===== */

/* Mode CLAIR : labels des options en vert foncé */
.radio-option label {
    color: #1b5e20 !important;
}

/* Mode SOMBRE : labels des options en vert lumineux */
body.dark-mode .radio-option label {
    color: #6ee7b7 !important;
}

/* Aussi pour les checkboxes */
body.dark-mode .checkbox-wrapper label {
    color: #6ee7b7 !important;
}

/* ===== CONTENEURS DES OPTIONS - MODE SOMBRE ===== */

/* Mode SOMBRE : conteneur des radio options */
body.dark-mode .radio-option {
    background: #2a2a2a !important;
    border: 1px solid #444 !important;
}

body.dark-mode .radio-option:hover {
    background: #333333 !important;
}

/* Mode SOMBRE : conteneur des checkboxes */
body.dark-mode .checkbox-wrapper {
    background: #2a2a2a !important;
    border: 1px solid #444 !important;
}

/* =========================================================
   SAFE AREA + PLEIN ÉCRAN CSS
   Sans API Fullscreen native - iOS/Capacitor compatible
========================================================== */

/* Safe area pour la bande de boutons */
@supports (padding-top: env(safe-area-inset-top)) {
    .verse-carousel-fullscreen {
        padding-top: env(safe-area-inset-top) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
}

/* Plein écran général (bouton 🖥️) */
body.app-fullscreen {
    margin: 0 !important;
    padding: 0 !important;
    background-position: top center !important;
}

body.app-fullscreen .container {
    max-width: 100% !important;
    width: 100vw !important;
    min-height: 100vh !important;
    padding: 4px 8px 8px 8px !important;
    padding-top: calc(env(safe-area-inset-top, 0px) + 2px) !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

body.dark-mode.app-fullscreen {
    background: #1a1a1a !important;
}

/* Placeholder ou le texte (transparent pour info) de la barre de recherche - toujours visible */
.search-input::placeholder {
    font-size: 12px;
    color: #1b5e20;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    .search-input::placeholder {
        font-size: 11px;
    }
}

.app-notif {
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Amiri', serif;
  z-index: 99999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  max-width: 90vw;
  text-align: center;
}

.app-notif.hidden {
  display: none;
}

@keyframes bounceArrow {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(8px); }
}

/* ===== Animation du bouton fixe "بدء البحث" après que le bouton flottant disparaît ===== */
@keyframes pulseGreen {
    0%   { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.7); transform: scale(1); }
    50%  { box-shadow: 0 0 0 12px rgba(46, 125, 50, 0); transform: scale(1.04); }
    100% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); transform: scale(1); }
}

.btn-pulse {
    animation: pulseGreen 0.6s ease 6;
}

/* ===== Animation des bandes d'options à cochées ===== */
@keyframes highlightOption {
    0%   { background: #f5f5f5; transform: scale(1); }
    40%  { background: #c8e6c9; transform: scale(1.02); box-shadow: 0 2px 12px rgba(46,125,50,0.25); }
    100% { background: #f5f5f5; transform: scale(1); box-shadow: none; }
}

.radio-option-highlight {
    animation: highlightOption 0.6s ease forwards;
}

/* ===== Animation de la barre de recherche ===== */
@keyframes searchBorderPulse {
    0%, 100% { border-color: #c8e6c9; box-shadow: none; }
    50%       { border-color: #2e7d32; box-shadow: 0 0 8px rgba(46, 125, 50, 0.4); }
}

.search-input.pulse-hint {
    animation: searchBorderPulse 1.5s ease-in-out 4;
}

/* =========================================================
   CLAVIER ARABE VIRTUEL
   ========================================================= */

#arabicKeyboardContainer {
    display: none;
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: #f3f5f8;
    border-radius: 12px;
    box-sizing: border-box;
    position: relative;
    z-index: 50;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

#arabicKeyboardContainer:not(.hidden) {
    display: block !important;
}

.arabic-keyboard.hidden {
    display: none !important;
}

.arabic-keyboard .kb-row {
    display: flex;
    direction: ltr;
    flex-direction: row;
    gap: 6px;
    margin-bottom: 6px;
}

.arabic-keyboard .kb-row:last-child {
    margin-bottom: 0;
}

.arabic-keyboard button {
    flex: 1;
    min-width: 0;
    min-height: 50px;
    padding: 6px 4px;
    border: 1px solid #d9dee7;
    border-radius: 8px;
    background: #ffffff;
    color: #222;
    font-family: 'Amiri', 'Segoe UI', system-ui, sans-serif;
    font-size: 24px;
    line-height: 1.25;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    transition: background 0.15s ease, transform 0.08s ease, color 0.15s ease;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
}

.arabic-keyboard button:hover {
    background: #f7f9fc;
}

.arabic-keyboard button:active {
    transform: scale(0.98);
    background: #e9edf3;
}

.arabic-keyboard .kb-wide {
    flex: 1.6;
    font-size: 15px;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}

.arabic-keyboard .kb-space {
    flex: 6;
    font-size: 18px;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}

/* Boutons contenant des mots complets */
.arabic-keyboard button.kb-word {
    flex: 1.35;
    font-size: 13px;
    line-height: 1.25;
    padding: 5px 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Amiri', 'Segoe UI', system-ui, sans-serif;
}

/* Ligne des diacritiques */
.arabic-keyboard .kb-row-diacritics button {
    font-size: 20px;
}

/* =========================
   TOUCHES D'ACTION COLORÉES
   ========================= */

.arabic-keyboard button.kb-delete {
    background: #fff3e0;
    border-color: #ffcc80;
    color: #e65100;
}

.arabic-keyboard button.kb-delete:hover {
    background: #ffe0b2;
}

.arabic-keyboard button.kb-clear {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
}

.arabic-keyboard button.kb-clear:hover {
    background: #ffcdd2;
}

.arabic-keyboard button.kb-enter {
    background: #e8f5e9;
    border-color: #81c784;
    color: #2e7d32;
    font-weight: 600;
}

.arabic-keyboard button.kb-enter:hover {
    background: #c8e6c9;
}

.arabic-keyboard button.kb-spacebar {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #1565c0;
}

.arabic-keyboard button.kb-spacebar:hover {
    background: #bbdefb;
}

/* Bouton clavier dans la barre de recherche */
.kb-btn {
    margin-inline: 0;
    padding: 0;
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    border: none;
    background: #eeeeee;
    color: #222;
    cursor: pointer;
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.08s ease;
}

.kb-btn:hover {
    background: #dddddd;
}

.kb-btn:active {
    transform: scale(0.96);
}

.kb-btn.active {
    background: #2e7d32;
    color: #fff;
}

/* =========================
   MODE SOMBRE
   ========================= */
body.dark-mode #arabicKeyboardContainer {
    background: #2f3540;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

body.dark-mode .arabic-keyboard button {
    background: #404854;
    color: #ffffff;
    border-color: #586272;
}

body.dark-mode .arabic-keyboard button:hover {
    background: #4a5360;
}

body.dark-mode .arabic-keyboard button:active {
    background: #586272;
}

body.dark-mode .arabic-keyboard button.kb-delete {
    background: #5c4732;
    border-color: #8d6e63;
    color: #ffcc80;
}

body.dark-mode .arabic-keyboard button.kb-clear {
    background: #5a3636;
    border-color: #ad6b6b;
    color: #ff8a80;
}

body.dark-mode .arabic-keyboard button.kb-enter {
    background: #2f4f36;
    border-color: #66bb6a;
    color: #c8e6c9;
}

body.dark-mode .arabic-keyboard button.kb-spacebar {
    background: #304a5e;
    border-color: #64b5f6;
    color: #bbdefb;
}

body.dark-mode .kb-btn {
    background: #555;
    color: #fff;
}

body.dark-mode .kb-btn:hover {
    background: #666;
}

body.dark-mode .kb-btn.active {
    background: #2e7d32;
    color: #fff;
}

/* =========================
   RESPONSIVE MOBILE
   ========================= */
@media (max-width: 768px) {
    #arabicKeyboardContainer {
        padding: 6px;
        margin-top: 6px;
    }

    .arabic-keyboard .kb-row {
        gap: 4px;
        margin-bottom: 4px;
    }

    .arabic-keyboard button {
        min-height: 46px;
        font-size: 20px;
        padding: 5px 2px;
        line-height: 1.2;
    }

    .arabic-keyboard .kb-wide {
        font-size: 12px;
    }

    .arabic-keyboard .kb-space {
        font-size: 15px;
    }

    .arabic-keyboard button.kb-word {
        flex: 1.35;
        font-size: 11px;
        line-height: 1.2;
        padding: 4px 2px;
    }

    .arabic-keyboard .kb-row-diacritics button {
        font-size: 18px;
    }

    .kb-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 16px;
    }
}

/* =========================================================
   MODE VERSET - CORRECTION AFFICHAGE EN PAYSAGE MOBILE
   ========================================================= */
@media (max-width: 950px) and (orientation: landscape) {

    /* Conteneur général du navigateur d'ayat */
    .verse-carousel-container,
    .verse-navigator-container,
    .single-verse-view,
    .verse-mode-container {
        min-height: auto !important;
        height: auto !important;
        padding: 8px !important;
    }

    /* Zone contenant le texte du verset */
    .verse-carousel-text,
    .single-verse-text,
    .verse-text-display,
    .result-text {
        font-size: 30px !important;
        line-height: 2.05 !important;
        padding: 10px 14px !important;
        text-align: right !important;
        direction: rtl !important;
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        max-height: none !important;
        overflow-y: visible !important;
    }

    /* Carte principale du verset */
    .verse-carousel-card,
    .single-verse-card,
    .result-item {
        padding: 10px !important;
        border-radius: 14px !important;
    }

    /* En-tête sourate / verset / page / juz */
    .verse-carousel-header,
    .result-header {
        font-size: 16px !important;
        line-height: 1.5 !important;
        padding: 10px 12px !important;
        margin-bottom: 8px !important;
    }

    /* Boutons de navigation en bas */
    .verse-carousel-controls,
    .navigator-controls,
    .carousel-controls {
        display: flex !important;
        gap: 8px !important;
        justify-content: center !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        margin-top: 8px !important;
    }

    .verse-carousel-controls button,
    .navigator-controls button,
    .carousel-controls button {
        min-height: 42px !important;
        padding: 8px 12px !important;
        font-size: 15px !important;
        border-radius: 10px !important;
        flex: 1 1 auto !important;
    }

    /* Barre de recherche du mode verset */
    .search-input-wrapper {
        gap: 6px !important;
    }

    #searchInput {
        font-size: 18px !important;
        padding-block: 10px !important;
    }

    /* Bouton micro dans ce mode */
    .voice-search-btn,
    #voiceSearchBtn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
    }
}

.results-counter {
    line-height: 1.9;
}

/* Ligne de détail */
.counter-details-line {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.95em;
}

/* Libellés UI (التفصيل:, تكرار, Détail, Details, etc.) */
.counter-ui-label {
    font-weight: 700;
}

/* Titre "التفصيل:" / "Détail:" */
.counter-details-title {
    color: #1565c0;
    background-color: #ffeb3b;
    font-weight: 800;
    margin-inline-end: 6px;
    padding: 2px 6px;
    border-radius: 6px;
}

/* Label "تكرار" / "occurrence(s)" */
.counter-occ-label {
    color: #00897b; /* vert-bleu fixe */
}

/* Bloc de chaque token */
.counter-token-part {
    font-weight: 700;
}

/* Mot coranique */
.counter-token-word {
    color: #5d4037;   /* marron foncé */
    font-weight: 800;
}

/* compteur numérique */
.counter-token-count {
    color: #5d4037;   /* même couleur que le mot */
    font-weight: 800;
}

/* " = " */
.counter-token-separator {
    color: #546e7a;
    font-weight: 700;
    padding: 0 2px;
}

/* séparateur " | " */
.counter-detail-divider {
    color: #9e9e9e;
    font-weight: 700;
    margin: 0 4px;
}

/* Ajustements simples pour dark mode, en gardant UNE seule couleur par rôle */
.dark-mode .counter-details-title,
body.dark-mode .counter-details-title {
    color: #8ec5ff;
}

.dark-mode .counter-occ-label,
body.dark-mode .counter-occ-label {
    color: #5ee0c0;
}

.dark-mode .counter-token-word,
.dark-mode .counter-token-count,
body.dark-mode .counter-token-word,
body.dark-mode .counter-token-count {
    color: #ffcc80;
}

/* =========================================================
   BOUTON INFO DES TOTAUX (mode نص كما هو)
   ========================================================= */
.counter-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin: 0 4px;
    padding: 0;
    border: 1px solid #2e7d32;
    border-radius: 50%;
    background: #ffffff;
    color: #2e7d32;
    font: italic 700 12px/1 Georgia, 'Times New Roman', serif;
    vertical-align: middle;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.counter-info-text {
    display: block;
    margin-top: 6px;
    padding: 6px 8px;
    border-top: 1px dashed #a5d6a7;
    font-weight: 400;
    font-size: 12px;
    line-height: 1.6;
    color: #1b5e20;
    text-align: start;
}

.counter-info-text[hidden] {
    display: none;
}

body.dark-mode .counter-info-btn {
    background: transparent;
    border-color: #6ee7b7;
    color: #6ee7b7;
}

body.dark-mode .counter-info-text {
    color: #d1fae5;
    border-top-color: rgba(110, 231, 183, 0.4);
}
