/**
 * Apke Masail Integration Styles
 */
/* 1. Fonts & Typography */
@font-face {
    font-family: 'Mehr Nastaliq Web';
    src: url('../../fonts/Mehr_Nastaliq_Web v. 2.0.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Quranicscript';
    src: url('../../fonts/KFGQPC Uthmanic Script HAFS Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Amiri';
    src: url('../../fonts/Amiri-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Container */
.apke-masail-list,
.apke-masail-fatwa-detail,
.apke-masail-search-form,
.apke-masail-chapters,
.am-fatwa-container,
.am-content-text {
    direction: rtl;
    text-align: right;
    font-family: 'Mehr Nastaliq Web', serif;
}

/* Fatwa List */
.apke-masail-fatwas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.apke-masail-fatwa-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.3s ease;
}

.apke-masail-fatwa-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.apke-masail-fatwa-topic {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    color: #b21d48;
}

.apke-masail-fatwa-topic a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.apke-masail-fatwa-topic a:hover {
    color: #b21d48;
}

.apke-masail-fatwa-meta {
    font-size: 0.9em;
    color: #671a30;
    margin-top: 10px;
}

.apke-masail-chapter {
    display: inline-block;
    background: #e8f5e9;
    padding: 4px 12px;
    border-radius: 4px;
    margin-left: 8px;
}

.apke-masail-question-preview {
    margin-top: 10px;
    color: #424242;
    line-height: 1.6;
}

/* Pagination */
.apke-masail-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
    padding: 20px;
}

.apke-masail-pagination a {
    padding: 8px 16px;
    background: #b21d48;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.apke-masail-pagination a:hover {
    background: #b21d48;
}

.apke-masail-page-info {
    color: #757575;
}

/* Fatwa Detail */
.apke-masail-fatwa-detail {
    max-width: 900px;
    margin: 0 auto;
    border-radius: 8px;
}

.apke-masail-fatwa-header {
    border-bottom: 3px solid #671a30;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.apke-masail-fatwa-title {
    font-size: 34px !important;
    color: #671a30;
    margin: 0 0 15px 0;
}

.apke-masail-fatwa-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9em;
    color: #757575;
}

.apke-masail-volume,
.apke-masail-chapter,
.apke-masail-question-number {
    padding: 4px 12px;
    background: #ffcc99;
    border-radius: 4px;
}

/* Question Section */
.apke-masail-question-section {}

.apke-masail-question-section h3 {
    color: #fff5eb;
    margin-top: 0;
    font-size: 30px;
    background-color: #671a30;
    padding: 10px 15px;
}

.apke-masail-question-text {
    font-size: 27px;
    line-height: 1.8;
    color: #212121;
    text-align: justify;
}

.apke-masail-asked-by {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9em;
    color: #757575;
}

/* Answer Section */
.apke-masail-answer-section {
    margin-bottom: 30px;
}

.apke-masail-answer-section h3 {
    color: #671a30;
    font-size: 30px;
    margin-bottom: 20px;
    background-color: #fff5eb;
    padding: 10px 15px;
}

.apke-masail-answer-content {
    line-height: 1.6;
    font-size: 27px;
    color: #212121;
    text-align: justify;
}

.apke-masail-paragraph {}

.apke-masail-para-number {
    font-weight: bold;
    color: #b21d48;
    margin-left: 8px;
}

/* References */
.apke-masail-references-section {
    margin-top: 40px;
}

.apke-masail-references-section h3 {
    color: #b21d48;
    font-size: 1.5em;
    margin-top: 0;
}

.apke-masail-references-list {
    margin-top: 20px;
    font-size: 24px !important;
    text-align: justify;
}

.apke-masail-reference {
    line-height: 2.8;

}

/* Ensure the reference number or content is aligned */
.apke-masail-reference::before {
    /* Optional: stylistic marker if needed, but border-right handles the visual indicator */
}

.apke-masail-reference.ref-quran {
    font-family: 'Quranicscript';
}

.apke-masail-reference.ref-hadith {
    font-family: 'Amiri';
}

/* Reference Links */
.apke-masail-ref-link {
    color: #e926a2;
    text-decoration: none;
    font-weight: bold;
    margin: 0 2px;
    cursor: pointer;
}

.apke-masail-ref-link:hover {
    color: #b21d48;
    text-decoration: underline;
}

.apke-masail-ref-link.ref-quran {
    font-family: 'Quranicscript';
}

.apke-masail-ref-link.ref-hadith {
    font-family: 'Amiri';
}

/* Reference Popup */
.apke-masail-ref-popup {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.apke-masail-ref-popup-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    direction: rtl;
    text-align: right;
}

.apke-masail-ref-popup-close {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #757575;
    cursor: pointer;
    line-height: 1;
}

.apke-masail-ref-popup-close:hover {
    color: #212121;
}

.apke-masail-ref-popup-body {
    font-size: 1.1em;
    line-height: 1.8;
}

.apke-masail-ref-popup-body.ref-popup-quran {
    font-family: 'Quranicscript';
}

.apke-masail-ref-popup-body.ref-popup-hadith {
    font-family: 'Amiri';
}

/* Modal */
.apke-masail-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.apke-masail-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.apke-masail-modal-close {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #757575;
    cursor: pointer;
    line-height: 1;
}

.apke-masail-modal-close:hover {
    color: #212121;
}

.apke-masail-modal-body {
    direction: rtl;
    text-align: right;
}

/* Search Form */
.apke-masail-search-form {
    margin: 20px 0;
}

.apke-masail-search-form form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.apke-masail-search-form input[type="text"] {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1em;
    direction: rtl;
}

.apke-masail-search-form button {
    padding: 12px 24px;
    background: #b21d48;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s ease;
}

.apke-masail-search-form button:hover {
    background: #b21d48;
}

/* Chapters List */
.apke-masail-chapters-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.apke-masail-chapters-list li {
    margin-bottom: 10px;
}

.apke-masail-chapter-link {
    display: block;
    padding: 12px 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    text-decoration: none;
    color: #212121;
    transition: all 0.3s ease;
}

.apke-masail-chapter-link:hover {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #b21d48;
}

.apke-masail-chapter-count {
    color: #757575;
    font-size: 0.9em;
    margin-right: 10px;
}

/* Tags */
.apke-masail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.apke-masail-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #e8f5e9;
    color: #b21d48;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Widget */
.apke-masail-widget-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.apke-masail-widget-list li {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.apke-masail-widget-list li:last-child {
    border-bottom: none;
}

.apke-masail-widget-list a {
    color: #1b5e20;
    text-decoration: none;
    display: block;
}

.apke-masail-widget-list a:hover {
    color: #b21d48;
}

.apke-masail-widget-meta {
    display: block;
    font-size: 0.85em;
    color: #757575;
    margin-top: 5px;
}

/* Error */
.apke-masail-error {
    padding: 15px;
    background: #ffebee;
    color: #c62828;
    border-radius: 4px;
    border-right: 4px solid #c62828;
}

/* Responsive */
@media (max-width: 768px) {
    .apke-masail-fatwas {
        grid-template-columns: 1fr;
    }



    .apke-masail-fatwa-title {
        font-size: 1.5em;
    }

    .apke-masail-modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* Quranic Text Global Style */
.quran-text {
    font-family: 'Quranicscript', 'Amiri', serif;
    color: #FF00FF;
    /* Magenta */
}

/* Hadith/General Arabic Text Style */
.hadith-text {
    font-family: 'Amiri', serif;
    /* Color inherits (Black/Dark Grey) */
}

/* Ensure references do NOT use Magenta */
.apke-masail-references-section .quran-text,
.apke-masail-reference .quran-text {
    color: inherit;
    /* Keep original color in references */
}

/* Explicitly set font sizes/line-heights if needed for the specific scripts */
.quran-text {
    line-height: 2.0;
    /* Quran often needs more vertical space */
}