/* ParallelQuran Resource Panel (v2.70.0)
 *
 * Collapsible side drawer + floating toggle. Desktop: right-side drawer.
 * Mobile: full-width bottom sheet.
 *
 * Theme variables (with fallbacks for safety):
 *   --pq-green-dark #1B5E20, --pq-green #2E7D32, --pq-green-light #4CAF50
 *   --pq-gold-dark #C5A55A, --pq-gold #C49A2F, --pq-gold-light #F0E6C0
 *   --pq-cream #FAF7F0, --pq-cream-warm #F5F0E8
 */

/* Floating toggle button */
.pq-rp-toggle {
    position: fixed;
    right: 1rem;
    bottom: 1.25rem;
    z-index: 9998;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--pq-green-dark, #1B5E20);
    border-radius: 999px;
    background: var(--pq-green, #2E7D32);
    color: #fff;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    transition: background 0.15s ease, transform 0.15s ease;
}
.pq-rp-toggle:hover,
.pq-rp-toggle:focus {
    background: var(--pq-green-dark, #1B5E20);
    transform: translateY(-1px);
    outline: none;
}
.pq-rp-toggle.is-open {
    background: var(--pq-gold-dark, #C5A55A);
    border-color: var(--pq-gold-dark, #C5A55A);
}
.pq-rp-toggle-icon {
    font-size: 1.05rem;
    line-height: 1;
}
.pq-rp-toggle-label {
    letter-spacing: 0.01em;
}

/* Backdrop (mobile only) */
.pq-rp-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9997;
    background: rgba(0, 0, 0, 0.32);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.pq-rp-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Drawer */
.pq-rp-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    width: min(380px, 92vw);
    height: 100vh;
    background: var(--pq-cream, #FAF7F0);
    border-left: 1px solid var(--pq-gold-light, #F0E6C0);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pq-rp-drawer.is-open {
    transform: translateX(0);
}

.pq-rp-header {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pq-gold-light, #F0E6C0);
    background: var(--pq-cream-warm, #F5F0E8);
}
.pq-rp-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--pq-green-dark, #1B5E20);
    letter-spacing: 0.01em;
}
.pq-rp-ref {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88rem;
    color: var(--pq-gold-dark, #C5A55A);
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--pq-gold-light, #F0E6C0);
    border-radius: 4px;
    background: #fff;
}
.pq-rp-close {
    border: none;
    background: transparent;
    color: var(--pq-green-dark, #1B5E20);
    font-size: 1.6rem;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
}
.pq-rp-close:hover,
.pq-rp-close:focus {
    background: var(--pq-gold-light, #F0E6C0);
    outline: none;
}

.pq-rp-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1rem 1.25rem 2rem;
    color: #2c2a26;
    font-size: 0.95rem;
    line-height: 1.5;
}

.pq-rp-loading,
.pq-rp-empty {
    padding: 1rem 0;
    color: #6b665c;
    font-style: italic;
    font-size: 0.92rem;
}

/* Sections */
.pq-rp-section {
    margin: 0 0 1.5rem;
}
.pq-rp-section + .pq-rp-section {
    padding-top: 1.25rem;
    border-top: 1px solid var(--pq-gold-light, #F0E6C0);
}
.pq-rp-section-h {
    margin: 0 0 0.65rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--pq-green-dark, #1B5E20);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pq-rp-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.25rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--pq-green-pale, #E8F5E9);
    color: var(--pq-green-dark, #1B5E20);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
}

/* Cards */
.pq-rp-card {
    background: #fff;
    border: 1px solid var(--pq-gold-light, #F0E6C0);
    border-radius: 6px;
    padding: 0.8rem 0.95rem;
    margin: 0 0 0.65rem;
}
.pq-rp-ar {
    font-family: 'Amiri', 'Scheherazade New', 'Noto Naskh Arabic', serif;
    font-size: 1.35rem;
    line-height: 1.85;
    color: var(--pq-green-dark, #1B5E20);
    margin: 0 0 0.4rem;
    direction: rtl;
}
.pq-rp-translit {
    font-style: italic;
    color: #6b665c;
    font-size: 0.88rem;
    margin: 0 0 0.4rem;
}
.pq-rp-neutral {
    margin: 0 0 0.55rem;
    color: #2c2a26;
}
.pq-rp-readings {
    list-style: none;
    margin: 0 0 0.55rem;
    padding: 0;
}
.pq-rp-reading {
    padding: 0.3rem 0;
    border-bottom: 1px dashed var(--pq-gold-light, #F0E6C0);
    font-size: 0.92rem;
}
.pq-rp-reading:last-child {
    border-bottom: none;
}
.pq-rp-translator {
    color: var(--pq-green-dark, #1B5E20);
    font-weight: 700;
}
.pq-rp-note {
    margin: 0.55rem 0 0;
    padding: 0.5rem 0.7rem;
    background: var(--pq-cream-warm, #F5F0E8);
    border-left: 3px solid var(--pq-gold, #C49A2F);
    font-size: 0.9rem;
    color: #4a463e;
}
.pq-rp-theme {
    font-weight: 700;
    color: var(--pq-green-dark, #1B5E20);
    font-size: 0.95rem;
    margin: 0 0 0.2rem;
}
.pq-rp-mufassir {
    font-size: 0.82rem;
    color: var(--pq-gold-dark, #C5A55A);
    margin: 0 0 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pq-rp-commentary {
    color: #2c2a26;
    font-size: 0.92rem;
}

/* Lists (commentators, connections) */
.pq-rp-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.5rem;
}
.pq-rp-list--connections {
    flex-direction: column;
    gap: 0.3rem;
}
.pq-rp-list-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    background: #fff;
    border: 1px solid var(--pq-gold-light, #F0E6C0);
    border-radius: 4px;
    font-size: 0.9rem;
}
.pq-rp-list--connections .pq-rp-list-item {
    width: 100%;
    justify-content: space-between;
}
.pq-rp-list-link {
    color: var(--pq-green-dark, #1B5E20);
    text-decoration: none;
    font-weight: 600;
}
.pq-rp-list-link:hover,
.pq-rp-list-link:focus {
    text-decoration: underline;
}
.pq-rp-list-count {
    color: #6b665c;
    font-size: 0.82rem;
}
.pq-rp-link {
    display: inline-block;
    margin-top: 0.4rem;
    color: var(--pq-green-dark, #1B5E20);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--pq-green-light, #4CAF50);
}
.pq-rp-link:hover,
.pq-rp-link:focus {
    color: var(--pq-gold-dark, #C5A55A);
    border-bottom-color: var(--pq-gold-dark, #C5A55A);
}

/* Mobile: bottom sheet */
@media (max-width: 640px) {
    .pq-rp-drawer {
        top: auto;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        height: 78vh;
        max-height: 78vh;
        border-left: none;
        border-top: 1px solid var(--pq-gold-light, #F0E6C0);
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
        transform: translateY(100%);
    }
    .pq-rp-drawer.is-open {
        transform: translateY(0);
    }
    .pq-rp-toggle {
        right: 0.85rem;
        bottom: 0.85rem;
        padding: 0.55rem 0.8rem;
        font-size: 0.88rem;
    }
}

/* Print: hide */
@media print {
    .pq-rp-toggle,
    .pq-rp-backdrop,
    .pq-rp-drawer {
        display: none !important;
    }
}
