/* =====================================================
   Hadits Nabi 9 Perawi v1.3.0
   9 Book Covers Grid + Full-width + Dark/Light
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&family=Playfair+Display:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

/* ---------- App container: full width / 1170px, no side gap ---------- */
.hn9p-app {
    --hn9p-primary: #0d7377;
    --hn9p-accent: #c9a227;
    --hn9p-bg: #f4f0e8;
    --hn9p-card-bg: #ffffff;
    --hn9p-text: #1a2525;
    --hn9p-text-muted: #5c6b6b;
    --hn9p-border: rgba(201, 162, 39, 0.22);
    --hn9p-shadow: 0 12px 40px rgba(13, 115, 119, 0.10);
    --hn9p-trans-bg: linear-gradient(145deg, #f9f5ee 0%, #f1ebe2 100%);
    --hn9p-toolbar-bg: rgba(255, 255, 255, 0.95);

    font-family: 'Inter', system-ui, sans-serif;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    color: var(--hn9p-text);
    box-sizing: border-box;
}

.hn9p-app *,
.hn9p-app *::before,
.hn9p-app *::after {
    box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
    .hn9p-app {
        --hn9p-bg: #0c1414;
        --hn9p-card-bg: #172222;
        --hn9p-text: #e9e4d8;
        --hn9p-text-muted: #9aabaa;
        --hn9p-border: rgba(201, 162, 39, 0.28);
        --hn9p-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
        --hn9p-trans-bg: linear-gradient(145deg, #1f2d2d 0%, #1a2626 100%);
        --hn9p-toolbar-bg: rgba(23, 34, 34, 0.96);
    }
}

.dark .hn9p-app,
body.dark-mode .hn9p-app,
html[data-theme="dark"] .hn9p-app {
    --hn9p-bg: #0c1414;
    --hn9p-card-bg: #172222;
    --hn9p-text: #e9e4d8;
    --hn9p-text-muted: #9aabaa;
    --hn9p-border: rgba(201, 162, 39, 0.28);
    --hn9p-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    --hn9p-trans-bg: linear-gradient(145deg, #1f2d2d 0%, #1a2626 100%);
    --hn9p-toolbar-bg: rgba(23, 34, 34, 0.96);
}

/* ========== COVERS SECTION ========== */
.hn9p-covers-section {
    width: 100%;
    padding: 1.5rem 1rem 2.5rem;
    transition: opacity 0.4s ease, transform 0.4s ease;
    background: linear-gradient(180deg, #f7fafc 0%, #eef4f9 100%);
    border-radius: 16px;
}

.hn9p-covers-header {
    text-align: center;
    margin-bottom: 2rem;
}

.hn9p-covers-bismillah {
    font-family: 'Amiri', serif;
    font-size: 1.2rem;
    letter-spacing: 0.1em;
    color: var(--hn9p-accent);
    margin-bottom: 0.75rem;
}

.hn9p-covers-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.6rem, 4.5vw, 2.4rem);
    font-weight: 700;
    color: var(--hn9p-text);
    margin: 0 0 0.4rem;
}

.hn9p-covers-subtitle {
    font-size: 1.05rem;
    color: var(--hn9p-text-muted);
    margin: 0;
}

/* Grid 3 columns desktop, 2 tablet, 1 mobile – no big gaps */
.hn9p-covers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    width: 100%;
}

@media (max-width: 900px) {
    .hn9p-covers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 520px) {
    .hn9p-covers-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        max-width: 320px;
        margin: 0 auto;
    }
}

/* Book cover card */
.hn9p-book-cover {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
    perspective: 900px;
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.hn9p-book-cover:hover {
    transform: translateY(-8px) scale(1.02);
}

.hn9p-book-cover:focus {
    outline: 3px solid var(--hn9p-accent);
    outline-offset: 4px;
}

.hn9p-book-spine {
    position: absolute;
    left: 0;
    top: 4%;
    bottom: 4%;
    width: 10px;
    background: linear-gradient(90deg, #a8b8c8, #c5d0dc 40%, #b0bec9);
    border-radius: 3px 0 0 3px;
    z-index: 2;
    box-shadow: inset -2px 0 4px rgba(0,0,0,0.3);
}

.hn9p-book-front {
    position: absolute;
    inset: 0 0 0 8px;
    background: linear-gradient(160deg, #e8f1f8 0%, #d4e5f2 40%, #c5d9eb 100%);
    background-size: cover;
    background-position: center;
    border-radius: 0 10px 10px 0;
    box-shadow:
        0 4px 6px rgba(100, 130, 160, 0.08),
        0 10px 24px rgba(100, 130, 160, 0.12),
        0 2px 4px rgba(0,0,0,0.04),
        inset 0 0 0 1px rgba(255,255,255,0.5);
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.hn9p-book-default {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    text-align: center;
    color: #2c3e50;
    background: linear-gradient(180deg, transparent 20%, rgba(255,255,255,0.7) 60%, rgba(232,241,248,0.95) 100%);
}

.hn9p-book-icon {
    font-size: 2.2rem;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.hn9p-book-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.35rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.hn9p-book-author {
    font-size: 0.78rem;
    opacity: 0.85;
}

.hn9p-book-overlay {
    width: 100%;
    padding: 1rem 0.85rem;
    background: linear-gradient(transparent 30%, rgba(30,50,70,0.55) 100%);
    text-align: center;
}

.hn9p-book-overlay .hn9p-book-name {
    color: #fff;
    font-size: 0.98rem;
}

/* Exit / enter animations */
.hn9p-covers-exit {
    opacity: 0;
    transform: scale(0.96);
    pointer-events: none;
}

.hn9p-covers-enter {
    animation: hn9p-fadeIn 0.45s ease forwards;
}

@keyframes hn9p-fadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

/* ========== READER ========== */
.hn9p-reader {
    width: 100%;
    padding: 1rem 1rem 2.5rem;
}

.hn9p-reader-enter {
    animation: hn9p-fadeUp 0.5s ease forwards;
}

.hn9p-reader-exit {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.3s, transform 0.3s;
}

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

.hn9p-reader-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.hn9p-reader-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0;
    color: var(--hn9p-text);
}

.hn9p-btn-ghost {
    background: transparent;
    border: 1.5px solid var(--hn9p-border);
    color: var(--hn9p-text);
    padding: 0.55rem 1rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.hn9p-btn-ghost:hover {
    background: var(--hn9p-card-bg);
    border-color: var(--hn9p-primary);
}

/* Toolbar */
.hn9p-toolbar {
    background: var(--hn9p-toolbar-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--hn9p-border);
    border-radius: 16px;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--hn9p-shadow);
}

.hn9p-toolbar-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.hn9p-field-group {
    flex: 1 1 200px;
}

.hn9p-field-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--hn9p-text-muted);
    margin-bottom: 0.35rem;
}

.hn9p-input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid var(--hn9p-border);
    border-radius: 11px;
    background: var(--hn9p-card-bg);
    color: var(--hn9p-text);
    font-size: 0.95rem;
}

.hn9p-input:focus {
    outline: none;
    border-color: var(--hn9p-primary);
    box-shadow: 0 0 0 3px rgba(13, 115, 119, 0.15);
}

.hn9p-search-row {
    display: flex;
    gap: 0.5rem;
}

.hn9p-search-row .hn9p-input {
    flex: 1;
}

.hn9p-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: 11px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.hn9p-btn:hover {
    transform: translateY(-2px);
}

.hn9p-btn-primary {
    background: linear-gradient(135deg, var(--hn9p-primary), #14919b);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 115, 119, 0.3);
}

.hn9p-btn-accent {
    background: linear-gradient(135deg, #c9a227, #e0bc4a);
    color: #2a2208;
    box-shadow: 0 4px 12px rgba(201, 162, 39, 0.3);
}

.hn9p-actions {
    flex: 0 0 auto;
}

/* Content centered */
.hn9p-content-area {
    max-width: 720px;
    margin: 0 auto;
    transition: opacity 0.25s;
}

.hn9p-placeholder {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--hn9p-text-muted);
}

.hn9p-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    padding: 2rem;
    color: var(--hn9p-text-muted);
}

.hn9p-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--hn9p-border);
    border-top-color: var(--hn9p-primary);
    border-radius: 50%;
    animation: hn9p-spin 0.7s linear infinite;
}

@keyframes hn9p-spin {
    to { transform: rotate(360deg); }
}

/* ========== CARD ========== */
.hn9p-card {
    background: var(--hn9p-card-bg);
    border-radius: 18px;
    border: 1px solid var(--hn9p-border);
    box-shadow: var(--hn9p-shadow);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.hn9p-card-inner {
    padding: 1.6rem 1.7rem 1.45rem;
}

.hn9p-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hn9p-book-label {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--hn9p-primary);
}

.hn9p-number-badge {
    background: linear-gradient(135deg, var(--hn9p-primary), #14919b);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.32rem 0.85rem;
    border-radius: 50px;
    white-space: nowrap;
}

.hn9p-arabic {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    direction: rtl;
    text-align: right;
    line-height: 2.2;
    color: var(--hn9p-text);
    margin: 0 0 1.4rem;
    word-wrap: break-word;
}

.hn9p-translation {
    background: var(--hn9p-trans-bg);
    border-radius: 13px;
    padding: 1.25rem 1.4rem;
    border-right: 4px solid var(--hn9p-accent);
}

.hn9p-translation-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--hn9p-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.hn9p-translation-text {
    margin: 0;
    font-family: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 500;
    font-style: italic;
    line-height: 1.75;
    color: var(--hn9p-text);
}

.hn9p-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.35rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--hn9p-border);
    font-size: 0.85rem;
    color: var(--hn9p-text-muted);
}

.hn9p-salam {
    font-size: 1.3rem;
    color: var(--hn9p-accent);
}

.hn9p-style-luxury .hn9p-card-inner::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--hn9p-accent), #e8d48b, var(--hn9p-accent));
    margin: -1.6rem -1.7rem 1.25rem;
}

.hn9p-error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: 1.1rem 1.4rem;
    border-radius: 12px;
    text-align: center;
}

@media (prefers-color-scheme: dark) {
    .hn9p-error {
        background: #2a1515;
        border-color: #7f1d1d;
        color: #fca5a5;
    }
}

@media (max-width: 640px) {
    .hn9p-covers-section,
    .hn9p-reader {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .hn9p-card-inner {
        padding: 1.3rem 1.15rem 1.2rem;
    }

    .hn9p-arabic {
        font-size: 1.2rem !important;
    }

    .hn9p-translation-text {
        font-size: 1.1rem;
    }

    .hn9p-toolbar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .hn9p-actions {
        width: 100%;
    }

    .hn9p-actions .hn9p-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hn9p-book-cover,
    .hn9p-covers-section,
    .hn9p-reader {
        transition: none !important;
        animation: none !important;
    }
}


/* ========== Single Hadith Page (permalink) ========== */
.hn9p-single-page {
    width: 100%;
    max-width: 100%;
}

.hn9p-single-wrap {
    width: 100%;
    max-width: 1170px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.hn9p-breadcrumb {
    font-size: 0.85rem;
    color: var(--hn9p-text-muted, #5c6b6b);
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.hn9p-breadcrumb a {
    color: var(--hn9p-primary, #0d7377);
    text-decoration: none;
}

.hn9p-breadcrumb a:hover {
    text-decoration: underline;
}

.hn9p-nav-links {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.hn9p-nav-links a {
    color: var(--hn9p-primary, #0d7377);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.9rem;
}

.hn9p-nav-links a:hover {
    text-decoration: underline;
}

.hn9p-book-landing-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.85rem;
    margin: 0 0 0.35rem;
    text-align: center;
}

.hn9p-book-landing-author {
    text-align: center;
    color: var(--hn9p-text-muted, #5c6b6b);
    margin-bottom: 1.75rem;
}

.hn9p-quick-form {
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

.hn9p-quick-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--hn9p-text-muted);
}

.hn9p-sample-list {
    margin-top: 2.5rem;
}

.hn9p-sample-list h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    font-family: 'Playfair Display', serif;
}

.hn9p-sample-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--hn9p-border, rgba(201,162,39,0.2));
    border-radius: 10px;
    margin-bottom: 0.6rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s, border-color 0.2s;
}

.hn9p-sample-item:hover {
    background: var(--hn9p-card-bg, #fff);
    border-color: var(--hn9p-primary, #0d7377);
}

.hn9p-sample-num {
    font-weight: 600;
    color: var(--hn9p-primary, #0d7377);
    white-space: nowrap;
    font-size: 0.85rem;
}

.hn9p-sample-text {
    font-size: 0.9rem;
    color: var(--hn9p-text-muted);
    line-height: 1.5;
}

/* Number badge as link */
a.hn9p-number-badge {
    text-decoration: none;
    color: #fff;
}
a.hn9p-number-badge:hover {
    opacity: 0.9;
}

/* Book cover is now <a> */
a.hn9p-book-cover {
    text-decoration: none;
    color: inherit;
}


/* Calm soft-blue book landing */
.hn9p-book-landing {
    background: linear-gradient(180deg, #f7fafc 0%, #eef4f9 50%, #f7fafc 100%);
    border-radius: 16px;
    padding: 2rem 1.5rem 2.5rem;
}

.hn9p-book-landing-title {
    color: #2c3e50;
}

.hn9p-book-landing-author {
    color: #5a7a9a;
}

/* Elegant hover for book covers */
.hn9p-book-cover:hover .hn9p-book-front {
    box-shadow:
        0 8px 16px rgba(100, 130, 160, 0.12),
        0 16px 40px rgba(100, 130, 160, 0.16),
        0 2px 6px rgba(0,0,0,0.05),
        inset 0 0 0 1px rgba(255,255,255,0.6);
}

.hn9p-book-name {
    color: #2c3e50;
}

.hn9p-book-author {
    color: #5a7a9a;
}

.hn9p-book-overlay .hn9p-book-name {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.35);
}

.hn9p-covers-title {
    color: #2c3e50;
}

.hn9p-covers-subtitle {
    color: #5a7a9a;
}

.hn9p-covers-bismillah {
    color: #6b8fad;
}

/* Soft primary for calm theme context */
.hn9p-covers-section {
    --hn9p-primary: #4a7c9b;
    --hn9p-accent: #7ba3c4;
}

/* ========== Hadits Hari Ini (shortcode / widget) ========== */
.hn9p-hari-ini {
    width: 100%;
    max-width: 720px;
    margin: 1.5rem auto;
    padding: 0 0.5rem;
}

.hn9p-hari-ini-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.hn9p-hari-ini-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0;
    color: var(--hn9p-text, #1a2525);
}

.hn9p-hari-ini-ornament {
    color: var(--hn9p-accent, #c9a227);
    font-size: 1rem;
    opacity: 0.85;
}

.hn9p-hari-ini-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--hn9p-text-muted, #8a9a9a);
    margin: 0.75rem 0 0;
    font-style: italic;
}

.hn9p-hari-ini .hn9p-card {
    margin-bottom: 0;
}
