/* ========================================
   ATLAS PANELS — выезжающие панели
   (био-панель и панель тем; паттерн mkt-panel,
    ТЗ Атлас v1.0 §7.4)
   ======================================== */

.atl-panel {
    position: fixed;
    top: 76px;                     /* под шапкой платформы */
    inset-inline-end: 0;           /* справа; в RTL — слева */
    width: 380px;
    max-width: 92vw;
    height: calc(100vh - 76px);
    background: var(--atl-panel-bg, #FAF5E8);
    color: var(--atl-text, #3D3122);
    border-inline-start: 1px solid var(--atl-border, #E0D3B4);
    box-shadow: var(--atl-shadow-elev, 0 8px 28px rgba(0,0,0,0.2));
    /* ниже шапки (z-index 100): её дропдауны (виджет намазов) остаются сверху,
       как у эталона Мактабы (mkt-panel z-index 40) */
    z-index: 40;
    display: flex;
    flex-direction: column;
    animation: atl-slide-in 0.2s ease-out;
}

.atl-panel[hidden] { display: none !important; }

@keyframes atl-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
[dir="rtl"] .atl-panel { animation-name: atl-slide-in-rtl; }
@keyframes atl-slide-in-rtl {
    from { transform: translateX(-100%); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

/* ── Шапка панели ── */
.atl-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--atl-border);
    flex-shrink: 0;
}

.atl-panel-header h3 {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--atl-text);
}

.atl-panel-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--atl-text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease;
    font-family: inherit;
    flex-shrink: 0;
}
.atl-panel-close:hover {
    background: var(--atl-accent-bg);
    color: var(--atl-text);
}

.atl-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 24px;
}

/* ── Био-панель: имена ── */
.atl-bio-names { min-width: 0; }

.atl-bio-name-ar {
    font-family: 'Amiri', 'Scheherazade New', serif;
    font-size: 22px;
    line-height: 1.5;
    color: var(--atl-accent);
}

.atl-bio-name-ru {
    margin: 2px 0 0 !important;
    font-family: 'Inter', sans-serif;
    font-size: 15px !important;
    font-weight: 600;
    line-height: 1.35;
    color: var(--atl-text);
}

.atl-bio-honorific {
    font-family: 'Islamic Honorifics', 'Amiri', serif;
    color: var(--atl-accent);
}

/* ── Действия: силсила / закрепить (Блок C) ── */
.atl-bio-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.atl-action-btn {
    padding: 7px 12px;
    border: 1.5px solid var(--atl-border);
    border-radius: 8px;
    background: var(--atl-bg-elevated);
    color: var(--atl-text);
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.atl-action-btn:hover { border-color: var(--atl-accent); background: var(--atl-accent-bg); }
.atl-action-btn.active {
    border-color: var(--atl-accent);
    background: var(--atl-accent-bg);
    color: var(--atl-accent);
}

/* ── Био-панель: содержимое ── */
.atl-bio-meta {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
}

.atl-bio-row { display: flex; gap: 8px; }
.atl-bio-row-label {
    color: var(--atl-text-muted);
    flex-shrink: 0;
    min-width: 118px;
}
.atl-bio-row-value { color: var(--atl-text); }

.atl-bio-era-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-inline-end: 5px;
    vertical-align: baseline;
}

.atl-bio-note {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--atl-accent-bg);
    border-radius: 8px;
    font-family: 'Noto Serif', serif;
    font-size: 13px;
    line-height: 1.55;
    color: var(--atl-text);
}

.atl-bio-section-title {
    margin: 16px 0 8px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--atl-text-muted);
}

.atl-bio-works {
    margin: 0;
    padding-inline-start: 18px;
    font-family: 'Noto Serif', serif;
    font-size: 13px;
    line-height: 1.6;
    color: var(--atl-text);
}

/* ── Учителя / ученики (кликабельные) ── */
.atl-bio-links { display: flex; flex-direction: column; gap: 6px; }

.atl-bio-link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--atl-border);
    border-radius: 8px;
    background: var(--atl-bg-elevated);
    color: var(--atl-text);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    text-align: start;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.atl-bio-link:hover {
    border-color: var(--atl-accent);
    background: var(--atl-accent-bg);
}

.atl-bio-link-name { min-width: 0; }

.atl-bio-link-type {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--atl-text-muted);
}

/* ── Блок «Риджаль» ── */
.atl-bio-rijal {
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px dashed var(--atl-border);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.55;
}

.atl-bio-empty {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: var(--atl-text-muted);
    padding: 8px 0;
}

/* ── Мобильное поведение: bottom-sheet ── */
@media (max-width: 767px) {
    .atl-panel {
        top: auto;
        bottom: 0;
        inset-inline-end: auto;
        inset-inline-start: 0;
        width: 100%;
        max-width: 100%;
        height: 72vh;
        max-height: 72vh;
        border-inline-start: none;
        border-top: 1px solid var(--atl-border);
        border-radius: 16px 16px 0 0;
        animation: atl-slide-up 0.22s ease-out;
    }
    [dir="rtl"] .atl-panel { animation-name: atl-slide-up; }

    @keyframes atl-slide-up {
        from { transform: translateY(100%); opacity: 0.5; }
        to   { transform: translateY(0);    opacity: 1; }
    }
}

/* ── Биография в источниках (тарджамы табакатов → Мактаба) ── */
.atl-bio-sources { display: flex; flex-direction: column; gap: 6px; }

.atl-bio-source {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--atl-border);
    border-radius: 8px;
    background: var(--atl-bg-elevated);
    color: var(--atl-text);
    font-size: 13px;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.atl-bio-source:hover {
    border-color: var(--atl-accent);
    background: var(--atl-accent-bg);
}
.atl-bio-source-book {
    font-family: 'Amiri', 'Scheherazade New', serif;
    font-size: 15px;
    min-width: 0;
}
.atl-bio-source-num {
    color: var(--atl-text-muted);
    white-space: nowrap;
}
