/* ===== Profile page (scoped) ===== */
.profile-page {
    font-size: 0.9rem;
    color: var(--txt);
    background: transparent;
}

.profile-card {
    background: var(--primary-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
}

/* ГРИД: ляв/десен панел */
.profile-layout {
    display: grid;
    grid-template-columns: 390px 1fr;
    gap: 20px;
}

@media (max-width: 980px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }
}

/* ЛЯВ ПАНЕЛ */
.profile-left .profile-header {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;

    display: grid;
    grid-template-columns: 80px minmax(0, 1fr); /* 👈 важно: втората колона може да се свива */
    gap: 14px;
    align-items: center;

    min-width: 0; /* 👈 самият header да може да се свива в grid-а */
}

.profile-left .identity {
    min-width: 0; /* 👈 да не раздува картата */
}

/*.profile-left .avatar-wrap{ width: 96px; height: 96px; }*/
.profile-avatar-details {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.profile-avatar.placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: #fff;
    font-weight: 700;
    font-size: 1.5rem;
    border: 1px solid hsl(var(--p-h) 70% 72%);
}

/* Заглавието (име + бутони) */
.identity .name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px 0;
    font-size: var(--fs-sm);
    font-weight: 800;
}

/* Самото потребителско име (първият span) – чупи се, не разтяга */
.profile-header .identity .name .profile-username {
    flex: 1 1 auto; /* да расте, но да не бута бутоните */
    max-width: 100%;
    min-width: 0; /* важно за flex контейнер! */
    white-space: nowrap; /* не чупим ред */
    overflow: hidden; /* крие се излишното */
    text-overflow: ellipsis; /* показва „…“ */
}

/* Бутоните да не се свиват/деформират */
.profile-mail,
.profile-duel {
    flex-shrink: 0;
}

.profile-mail {
    color: var(--txt-dim);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 4px;
    border-radius: 6px;
    transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.profile-mail:hover {
    color: var(--primary);
    background: hsl(var(--p-h) var(--p-s) 94%);
    box-shadow: 0 2px 8px hsl(var(--p-h) var(--p-s) 35% / .18);
}

.identity .meta {
    margin: 0;
    color: var(--txt-dim);
}

/* секция с рецензии (вляво) */
.profile-left .profile-section {
    margin-top: 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 14px;
}

.profile-left .section-title {
    margin: 0 0 8px 0;
    font-size: var(--fs-lg);
    font-weight: 700;
    color: #000;
}

.reviews-list {
    display: grid;
    gap: 10px;
}

.review-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 10px 12px;
}

.review-card .small {
    font-size: .85em;
    color: var(--txt-dim);
}

.review-card a {
    color: var(--txt);
    text-decoration: none;
    /*border-bottom: 1px solid transparent;*/
    border-radius: 4px;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}

.review-card a:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: hsl(var(--p-h) var(--p-s) 94%);
}

/* ДЕСЕН ПАНЕЛ: Рафтове */
.profile-right {
    display: grid;
    gap: 16px;
}

/* Рафтове – контейнери */
.shelf {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
    overflow: hidden;
}

.shelf-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.month-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--txt);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    border-radius: 4px;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}

.month-title:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: hsl(var(--p-h) var(--p-s) 94%);
}

.shelf-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--txt);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    border-radius: 4px;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}

.shelf-title:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: hsl(var(--p-h) var(--p-s) 94%);
}

.shelf-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.icon-btn.disabled {
    opacity: .5;
    cursor: default;
}

.dropdown {
    position: relative;
}

.dropdown .dropdown-toggle {
    min-width: 96px;
}

.dropdown .dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px;
    min-width: 140px;
    display: none;
}

.dropdown:focus-within .dropdown-menu,
.dropdown .dropdown-toggle:focus + .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 8px;
    border-radius: 6px;
}

/* Маркиз: viewport + track */
.shelf-viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.shelf-track {
    display: inline-flex;
    gap: 10px;
    min-width: 100%;
    animation: shelf-scroll var(--marquee-duration, 35s) linear infinite;
    will-change: transform;
}

.shelf-track.is-static {
    animation: none;
    transform: translateX(0);
}

.shelf:hover .shelf-track {
    animation-play-state: paused;
}

@keyframes shelf-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .shelf-track {
        animation: none;
    }
}

/* Картичка книга в рафта */
.book-card {
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    width: 120px;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
    transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}

.book-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px hsl(var(--p-h) var(--p-s) 35% / .18);
    border-color: hsl(var(--p-h) 60% 60%);
}

/* Корицата — винаги IMG, стабилен размер, без „шимер“ */
.book-card .book-cover {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    background: #f2f2f2;
    animation: none !important;
}

/* Метаданни */
.book-meta {
    padding: 6px 8px 8px;
}

.book-meta .t {
    font-weight: 600;
    line-height: 1.25;
    color: var(--txt);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-meta .a {
    font-size: .85em;
    color: var(--txt-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shelf-empty {
    padding: 10px;
    color: var(--txt-dim);
}

/* Респонсив */
@media (max-width: 640px) {
    .book-card {
        width: 100px;
    }
}

/* ---- Goodreads Import Modal ---- */
.import-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    font-family: inherit;
    color: #000;
}

.import-modal.is-open {
    display: block;
}

.import-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .5);
}

.import-modal__dialog {
    position: relative;
    max-width: 880px;
    width: calc(100% - 32px);
    margin: 5vh auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
    overflow: hidden;
}

.import-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    background: #f8f8f8;
}

.import-modal__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #000;
}

.import-modal__close {
    appearance: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: #000;
}

.import-modal__close:hover {
    color: #d00;
}

.import-modal__body {
    padding: 16px;
    color: #000;
}

body.modal-open {
    overflow: hidden;
}

.btn--sm {
    font-size: .95rem;
    padding: .35rem .6rem;
    line-height: 1.1;
}

.no-books {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    font-style: italic;
    color: #777;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
    margin: 10px 0;
}

/* опционално; ако нямаш глобални стилове за .pagination */
.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 0;
    margin: 6px 0 0;
    list-style: none;
}

.pagination .page-indicator {
    padding: 6px 8px;
}

.btn.btn-sm {
    padding: 4px;
    font-size: .6rem;
}

.btn-outline-comment {
    background: transparent;
    color: var(--txt);
    border: 1px solid var(--border);
    height: 24px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    position: relative;
    z-index: 0;
    outline: none;
}

.btn-outline-comment:hover {
    background: var(--primary-soft);
    border-color: hsl(var(--p-h) 70% 60%);
}

.btn-outline-comment:focus,
.btn-outline-comment:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .06);
}

/* === Profile: re-order под 980px (header -> right -> останалото от left) === */
@media (max-width: 980px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-left {
        display: contents;
    }

    .profile-left .profile-header {
        grid-row: 1;
        grid-column: 1;
        min-width: 0;
    }

    .profile-right {
        grid-row: 2;
        grid-column: 1;
        min-width: 0;
    }
}

.has-arrows::after {
    content: "⮞⮞";
    margin-left: .35em;
    font-family: "Noto Sans Symbols 2", "Noto Sans Symbols",
    "Segoe UI Symbol", "Symbola", "DejaVu Sans",
    "Arial Unicode MS", sans-serif;
    line-height: 1;
}

.meta input[type="checkbox"] {
    accent-color: var(--primary);
    cursor: pointer;
}

.profile-duel {
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .8rem;
    font-weight: 600;
    color: #c00;
    text-decoration: none;
    line-height: 1;
}

.profile-duel .txt {
    line-height: 1;
}

.friendship-actions {
    margin-top: .45rem;
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
}

.inline-form {
    display: inline;
}

.profile-last-login-form {
    margin-top: .35rem;
}

.profile-last-login-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
}

.profile-section--mt12 {
    margin-top: 12px !important;
}

.profile-section--mt14 {
    margin-top: 14px !important;
}

.book-card.is-static {
    cursor: default;
}

.book-card.is-static:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border);
}

.profile-section--centered {
    text-align: center;
}

.profile-feature-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--txt);
}

.profile-feature-subtext {
    margin-top: 4px;
    color: var(--txt-dim);
    font-size: 0.9rem;
}

.profile-feature-action {
    margin-top: 10px;
}

.profile-feature-link {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #555;
    text-decoration: none;
}

.profile-feature-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.profile-feature-group {
    margin-top: 8px;
    text-align: left;
}

.profile-feature-group-title {
    font-weight: 600;
}

.profile-feature-list {
    margin: 4px 0 0;
    padding-left: 18px;
    text-align: left;
}

.profile-feature-list-item {
    margin-bottom: 4px;
}

.profile-feature-inline-link {
    margin-left: 4px;
    font-size: 0.8rem;
}

.profile-feature-status {
    color: #888;
    font-size: 0.8rem;
}

.profile-feature-note {
    margin-top: 8px;
}

.book-card.is-static {
    cursor: default;
}

.book-card.is-static:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border);
}

.shelf-track {
    display: flex;
    width: max-content;
    gap: 10px;
    animation: shelf-scroll var(--marquee-duration, 35s) linear infinite;
    will-change: transform;
}

.shelf-track.is-static {
    animation: none;
    transform: translateX(0);
}

.shelf-track.is-static .is-marquee-clone {
    display: none;
}
