/* =========================================================================
   Amal Journal — Dua Journal styles
   =========================================================================
   Path:   assets/css/dua-journal.css
   Since:  3.7.7
   Update: 3.8.1 — Modal panel width fix (was rendering as narrow column).

   v3.8.1 changes:
   - Outer modal now uses position: fixed + block layout instead of flex
     (flex was collapsing the panel to content width).
   - All critical dimensions forced with !important.
   - Panel is block element with margin: auto for centering.
   - Text wraps normally (word-break: normal, overflow-wrap: anywhere).
   ========================================================================= */

/* ---------- List container ---------- */

.aj-dua-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---------- Card ---------- */

.aj-dua-item {
    display: flex;
    gap: 10px;
    padding: 12px 72px 12px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, .04),
        0 4px 10px rgba(15, 23, 42, .03);
    position: relative;
    transition: box-shadow .15s, border-color .15s;
}

.aj-dua-item:hover {
    border-color: #cbd5e1;
    box-shadow:
        0 2px 4px rgba(15, 23, 42, .06),
        0 8px 18px rgba(15, 23, 42, .05);
}

.aj-dua-item.is-answered {
    background: #f9fafb;
    border-color: #e5e7eb;
    opacity: .85;
}

/* ---------- Check button ---------- */

.aj-dua-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-top: 2px;
    transition: border-color .15s, background .15s;
}

.aj-dua-check:hover { border-color: #10b981; }

.aj-dua-item.is-answered .aj-dua-check {
    background: #10b981;
    border-color: #10b981;
}

.aj-dua-check svg { width: 14px; height: 14px; stroke: currentColor; display: block; }

/* ---------- Body ---------- */

.aj-dua-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.aj-dua-meta {
    order: -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 10.5px;
    color: #6b7280;
    margin: 0 0 6px;
}

.aj-dua-title {
    order: 1;
    font-size: 14.5px;
    font-weight: 700;
    color: #1f2933 !important;
    line-height: 1.35;
    margin: 0 0 6px;
    font-family: 'Noto Sans Bengali', 'Kalpurush', sans-serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-decoration: none !important;
}

.aj-dua-text {
    order: 2;
    font-size: 13.5px;
    line-height: 1.75;
    color: #4b5563 !important;
    font-family: 'Noto Sans Bengali', 'Kalpurush', sans-serif;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin: 0;
    unicode-bidi: plaintext;
    text-align: start;
    text-decoration: none !important;
}

/* ---------- Category chip ---------- */

.aj-dua-cat {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1e40af;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    font-size: 9.5px;
    line-height: 1.2;
    white-space: nowrap;
}

.aj-dua-answered {
    color: #10b981;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10.5px;
}

/* ---------- Expand button ---------- */

.aj-dua-expand {
    position: absolute;
    top: 8px;
    right: 34px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s, color .15s;
    font-family: inherit;
}

.aj-dua-expand:hover {
    background: rgba(47, 128, 237, .1);
    color: #2f80ed;
}

.aj-dua-expand svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    display: block;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* ---------- Delete button ---------- */

.aj-dua-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s, color .15s;
    font-family: inherit;
}

.aj-dua-delete:hover {
    background: rgba(220, 38, 38, .08);
    color: #dc2626;
}

/* =========================================================================
   Full-page modal — v3.8.1 (bulletproof layout)
   ========================================================================= */

.aj-dua-modal {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 2147483600 !important;
    display: block !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: rgba(8, 12, 20, .65) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s;
}

.aj-dua-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.aj-dua-modal-panel {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 640px !important;
    min-width: 0 !important;
    margin: 0 auto !important;
    background: #ffffff !important;
    color: #1f2933 !important;
    border-radius: 16px !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .4) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    transform: translateY(12px) scale(.98);
    transition: transform .2s cubic-bezier(.34, 1.3, .64, 1);
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
}

.aj-dua-modal.is-open .aj-dua-modal-panel {
    transform: translateY(0) scale(1);
}

.aj-dua-modal-head {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 12px 14px !important;
    border-bottom: 1px solid #e5e7eb !important;
    background: #fafafa !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.aj-dua-modal-head .aj-dua-cat {
    font-size: 10px !important;
    padding: 3px 9px !important;
}

.aj-dua-modal-answered {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(16, 185, 129, .12);
    color: #065f46;
    font-size: 10.5px;
    font-weight: 700;
    font-family: 'Noto Sans Bengali', 'Kalpurush', sans-serif;
}

.aj-dua-modal-close {
    margin-left: auto !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 8px !important;
    border: none !important;
    background: transparent !important;
    color: #6b7280 !important;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    transition: background .15s, color .15s;
    font-family: inherit;
    flex-shrink: 0 !important;
}

.aj-dua-modal-close:hover {
    background: rgba(220, 38, 38, .08) !important;
    color: #dc2626 !important;
}

.aj-dua-modal-body {
    padding: 20px 22px 26px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    min-width: 0 !important;
    font-family: 'Noto Sans Bengali', 'Kalpurush', sans-serif !important;
    box-sizing: border-box !important;
}

.aj-dua-modal-title {
    margin: 0 0 14px !important;
    font-size: 19px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    line-height: 1.4 !important;
    font-family: 'Noto Sans Bengali', 'Kalpurush', sans-serif !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
    text-align: start !important;
}

.aj-dua-modal-text {
    margin: 0 !important;
    font-size: 15px !important;
    line-height: 2 !important;
    color: #334155 !important;
    font-family: 'Noto Sans Bengali', 'Kalpurush', sans-serif !important;
    white-space: pre-wrap !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
    unicode-bidi: plaintext !important;
    text-align: start !important;
}

/* ---------- Mobile ---------- */

@media (max-width: 700px) {
    .aj-dua-item {
        padding: 11px 68px 11px 11px;
        border-radius: 11px;
    }
    .aj-dua-title { font-size: 14px; }
    .aj-dua-text  { font-size: 13px; line-height: 1.7; }

    .aj-dua-modal {
        padding: 0 !important;
    }
    .aj-dua-modal-panel {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
    }
    .aj-dua-modal-body {
        padding: 16px 18px 24px !important;
    }
    .aj-dua-modal-title { font-size: 17px !important; }
    .aj-dua-modal-text  { font-size: 14.5px !important; line-height: 1.95 !important; }
}

/* ---------- Dark mode ---------- */

@media (prefers-color-scheme: dark) {
    .aj-dua-item {
        background: #1e1e1e;
        border-color: #2a313b;
        box-shadow:
            0 1px 2px rgba(0, 0, 0, .3),
            0 4px 10px rgba(0, 0, 0, .25);
    }
    .aj-dua-item.is-answered { background: #181818; opacity: .8; }

    .aj-dua-title { color: #e6e8eb !important; }
    .aj-dua-text  { color: #cbd5e1 !important; }
    .aj-dua-meta  { color: #94a3b8; }
    .aj-dua-cat {
        background: rgba(96, 165, 250, .15);
        color: #93c5fd;
    }
    .aj-dua-check { border-color: #4b5563; }

    .aj-dua-expand { color: #94a3b8; }
    .aj-dua-expand:hover {
        background: rgba(96, 165, 250, .15);
        color: #93c5fd;
    }

    .aj-dua-delete { color: #6b7280; }
    .aj-dua-delete:hover {
        background: rgba(220, 38, 38, .15);
        color: #fca5a5;
    }

    .aj-dua-modal-panel {
        background: #1e1e1e !important;
        color: #e6e8eb !important;
    }
    .aj-dua-modal-head {
        background: #14181f !important;
        border-bottom-color: #2a313b !important;
    }
    .aj-dua-modal-title { color: #e6e8eb !important; }
    .aj-dua-modal-text  { color: #cbd5e1 !important; }
    .aj-dua-modal-close { color: #9aa4b2 !important; }
    .aj-dua-modal-close:hover {
        background: rgba(220, 38, 38, .15) !important;
        color: #fca5a5 !important;
    }
    .aj-dua-modal-answered {
        background: rgba(16, 185, 129, .2);
        color: #6ee7b7;
    }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .aj-dua-item,
    .aj-dua-check,
    .aj-dua-delete,
    .aj-dua-expand,
    .aj-dua-modal,
    .aj-dua-modal-panel { transition: none !important; }
}