:root {
    --wal-primary: #7c2d64;
    --wal-primary-dark: #551a43;
    --wal-soft: #fff3fa;
    --wal-border: #ead8e5;
    --wal-text: #2d2530;
    --wal-muted: #746779;
    --wal-white: #ffffff;
}

.wal-library-shell {
    max-width: 1160px;
    margin: 0 auto;
    padding: 48px 18px 70px;
    color: var(--wal-text);
    font-family: inherit;
}

.wal-library-hero {
    position: relative;
    overflow: hidden;
    border-radius: 30px;
    padding: 54px 42px;
    background:
        radial-gradient(circle at top right, rgba(255,255,255,.55), transparent 32%),
        linear-gradient(135deg, #7c2d64 0%, #a94f88 45%, #d98bb8 100%);
    color: #fff;
    box-shadow: 0 24px 60px rgba(124,45,100,.22);
}

.wal-library-hero::after {
    content:"";
    position:absolute;
    width:240px;
    height:240px;
    right:-80px;
    bottom:-100px;
    border-radius:50%;
    background:rgba(255,255,255,.18);
}

.wal-library-hero::before {
    content:"♪";
    position:absolute;
    right:72px;
    top:38px;
    font-size:92px;
    line-height:1;
    opacity:.18;
    font-weight:900;
}

.wal-eyebrow,
.wal-modal-eyebrow {
    display:inline-flex;
    align-items:center;
    gap:8px;
    font-size:13px;
    letter-spacing:.08em;
    text-transform:uppercase;
    font-weight:700;
}

.wal-library-hero h1 {
    margin: 14px 0 14px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.04;
    color:#fff;
}

.wal-library-hero p {
    margin:0;
    max-width:760px;
    font-size:18px;
    line-height:1.75;
    opacity:.95;
}

.wal-toolbar {
    display:flex;
    gap:14px;
    justify-content:space-between;
    align-items:center;
    padding:18px;
    margin:30px 0 12px;
    background:#fff;
    border:1px solid var(--wal-border);
    border-radius:22px;
    box-shadow:0 12px 35px rgba(85,26,67,.08);
}

.wal-search-wrap { flex: 1 1 auto; }
.wal-filter-wrap { flex: 0 0 250px; }

.wal-search,
.wal-subject-filter {
    width:100%;
    border:1px solid var(--wal-border) !important;
    border-radius:14px !important;
    min-height:48px;
    padding:0 16px !important;
    background:#fff !important;
    color:var(--wal-text) !important;
    box-shadow:none !important;
    outline:none !important;
}

.wal-search:focus,
.wal-subject-filter:focus {
    border-color:var(--wal-primary) !important;
    box-shadow:0 0 0 4px rgba(124,45,100,.12) !important;
}

.wal-count-line {
    margin: 8px 2px 18px;
    color: var(--wal-muted);
    font-size:14px;
}

.wal-table-wrap {
    overflow:hidden;
    background:#fff;
    border:1px solid var(--wal-border);
    border-radius:24px;
    box-shadow:0 18px 50px rgba(85,26,67,.08);
}

.wal-table {
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    margin:0 !important;
    background:#fff;
    table-layout:fixed;
    direction:rtl;
}

.wal-col-audio { width:34%; }
.wal-col-writer { width:26%; }
.wal-col-subject { width:24%; }
.wal-col-action { width:16%; }

.wal-table thead th {
    background:var(--wal-soft);
    color:var(--wal-primary-dark);
    font-size:14px;
    text-align:right !important;
    padding:18px 20px;
    border-bottom:1px solid var(--wal-border);
}

.wal-table tbody td {
    padding:18px 20px;
    border-bottom:1px solid #f1e4ee;
    vertical-align:middle;
    text-align:right !important;
    box-sizing:border-box;
}

.wal-table tbody tr:last-child td { border-bottom:none; }

.wal-audio-row {
    cursor:pointer;
    transition: background .18s ease, transform .18s ease;
}

.wal-audio-row:hover,
.wal-audio-row:focus {
    background:#fff8fc;
}

.wal-subject-pill {
    display:inline-flex;
    padding:7px 11px;
    border-radius:999px;
    color:var(--wal-primary-dark);
    background:#f7e6f1;
    font-size:13px;
    font-weight:700;
}

.wal-open-btn,
.wal-listen-btn,
.wal-download-btn {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:none;
    border-radius:999px;
    cursor:pointer;
    font-weight:800;
    text-decoration:none !important;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.wal-open-btn {
    min-width:94px;
    padding:11px 18px;
    color:#fff;
    background:linear-gradient(135deg, var(--wal-primary), #b14f8e);
    box-shadow:0 10px 22px rgba(124,45,100,.22);
}

.wal-open-btn:hover,
.wal-listen-btn:hover,
.wal-download-btn:hover {
    transform: translateY(-1px);
}

.wal-empty-state {
    padding:34px;
    border-radius:22px;
    background:#fff;
    border:1px dashed var(--wal-border);
    color:var(--wal-muted);
    text-align:center;
}

.wal-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
}

.wal-modal.is-open {
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px 16px;
    box-sizing:border-box;
    overflow-y:auto;
}

.wal-modal-overlay {
    position:absolute;
    inset:0;
    background:rgba(31,20,34,.62);
    backdrop-filter: blur(5px);
}

.wal-modal-card {
    position:relative;
    width:min(590px, calc(100% - 32px));
    margin:auto;
    max-height:calc(100vh - 48px);
    overflow-y:auto;
    background:#fff;
    border-radius:28px;
    padding:32px;
    box-shadow:0 35px 80px rgba(0,0,0,.26);
    animation:wal-pop .16s ease-out;
}

@keyframes wal-pop {
    from { opacity:0; transform:translateY(12px) scale(.98); }
    to { opacity:1; transform:translateY(0) scale(1); }
}

.wal-modal-close {
    position:absolute;
    top:16px;
    right:16px;
    width:38px;
    height:38px;
    border-radius:50%;
    border:1px solid var(--wal-border);
    background:#fff;
    color:var(--wal-text);
    cursor:pointer;
    font-size:24px;
    line-height:1;
}

.wal-modal-eyebrow { color:var(--wal-primary); }
.wal-modal-card h2 { margin:12px 48px 8px 0; color:var(--wal-text); font-size:30px; line-height:1.2; }
.wal-modal-meta { color:var(--wal-muted); margin:0 0 24px; display:flex; flex-wrap:wrap; gap:8px 16px; }
.wal-modal-meta span:not(:empty)::before { content:"• "; color:var(--wal-primary); }
.wal-modal-meta span:first-child:not(:empty)::before { content:""; }

.wal-modal-actions {
    display:flex;
    gap:12px;
    flex-wrap:wrap;
}

.wal-listen-btn,
.wal-download-btn {
    flex:1 1 180px;
    padding:14px 20px;
    min-height:50px;
}

.wal-listen-btn {
    background:linear-gradient(135deg, var(--wal-primary), #b14f8e);
    color:#fff !important;
    box-shadow:0 12px 24px rgba(124,45,100,.20);
}

.wal-download-btn {
    background:#fff;
    color:var(--wal-primary-dark) !important;
    border:1px solid var(--wal-border);
}

.wal-player-wrap {
    margin-top:18px;
    padding:16px;
    background:#fff7fc;
    border:1px solid var(--wal-border);
    border-radius:20px;
}

.wal-player-wrap audio {
    width:100%;
    display:block;
}

.wal-no-audio {
    margin:18px 0 0;
    padding:12px 14px;
    border-radius:14px;
    background:#fff4e5;
    color:#7a4c00;
}

@media (max-width: 760px) {
    .wal-library-shell { padding:30px 14px 48px; }
    .wal-library-hero { padding:36px 24px; border-radius:24px; }
    .wal-library-hero::before { right:28px; top:20px; font-size:60px; }
    .wal-toolbar { flex-direction:column; align-items:stretch; }
    .wal-filter-wrap { flex:auto; }
    .wal-table thead { display:none; }
    .wal-table,
    .wal-table tbody,
    .wal-table tr,
    .wal-table td { display:block; width:100%; }
    .wal-audio-row { padding:14px; border-bottom:1px solid var(--wal-border); }
    .wal-table tbody td { border-bottom:none; padding:7px 4px; }
    .wal-table tbody td::before {
        content: attr(data-label);
        display:block;
        font-size:12px;
        font-weight:800;
        color:var(--wal-muted);
        margin-bottom:3px;
    }
    .wal-open-btn { width:100%; margin-top:8px; }
    .wal-modal.is-open { align-items:center; padding:18px 12px; }
    .wal-modal-card { padding:26px 20px; margin:auto; max-height:calc(100vh - 36px); }
}


/* Kurdish / Sorani RTL defaults */
.wal-library-shell[dir="rtl"] {
    direction: rtl;
    text-align: right;
}
.wal-library-shell[dir="rtl"] .wal-toolbar,
.wal-library-shell[dir="rtl"] .wal-modal-meta,
.wal-library-shell[dir="rtl"] .wal-modal-actions {
    direction: rtl;
}
.wal-library-shell[dir="rtl"] .wal-search,
.wal-library-shell[dir="rtl"] .wal-subject-filter {
    text-align: right;
}
.wal-modal-card {
    direction: rtl;
    text-align: right;
}
.wal-modal-close {
    right: auto;
    left: 16px;
}
.wal-modal-card h2 {
    margin: 12px 0 8px 48px;
}


/* Alignment fix: keep every cell directly under its own heading, even when theme CSS tries to override table alignment. */
.wal-library-shell .wal-table th,
.wal-library-shell .wal-table td {
    text-align: right !important;
    vertical-align: middle !important;
}
.wal-library-shell .wal-table th:last-child,
.wal-library-shell .wal-table td:last-child {
    text-align: center !important;
}
.wal-library-shell .wal-table td strong {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
}
.wal-library-shell .wal-table-wrap {
    direction: rtl;
}
@media (max-width: 760px) {
    .wal-table { table-layout:auto; }
    .wal-library-shell .wal-table td:last-child { text-align: right !important; }
}
