/* ======================================================
   Friendbook - HIGHLIGHTS (Instagram-style)
   ======================================================
   Highlight circles under the profile bio + create/edit
   dialog + full-screen auto-playing viewer.
   Loaded on profile.html only.
   ====================================================== */


/* ---------- HIGHLIGHTS BAR ---------- */

.highlights-bar {
    display: flex;

    align-items: flex-start;

    gap: 22px;

    padding: 14px 24px 6px;

    overflow-x: auto;

    scrollbar-width: none;
}


.highlights-bar::-webkit-scrollbar {
    display: none;
}


.highlight-tile {
    width: 68px;

    flex-shrink: 0;

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 6px;

    cursor: pointer;
}


.highlight-ring {
    width: 66px;

    height: 66px;

    border-radius: 50%;

    background: linear-gradient(
        135deg,
        #f09433,
        #dc2743,
        #7c3aed,
        #2563eb
    );

    padding: 2px;

    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.12);
}


.highlight-cover {
    width: 100%;

    height: 100%;

    border-radius: 50%;

    background-color: #e4e6eb;

    background-size: cover;

    background-position: center;

    display: flex;

    align-items: center;

    justify-content: center;

    color: #fff;

    font-weight: 800;

    font-size: 22px;

    border: 2px solid #ffffff;

    box-sizing: border-box;

    overflow: hidden;
}


.highlight-cover img {
    width: 100%;

    height: 100%;

    object-fit: cover;
}


.highlight-tile span {
    max-width: 100%;

    font-size: 11px;

    font-weight: 500;

    text-align: center;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


/* ---------- NEW HIGHLIGHT TILE ---------- */

.highlight-tile.new .highlight-ring {
    background: none;

    padding: 0;
}


.highlight-tile.new .highlight-cover {
    background: none;

    border: 1px dashed #a0a4ab;

    color: #a0a4ab;

    font-size: 26px;

    font-weight: 400;
}


.highlight-tile:hover .highlight-cover {
    filter: brightness(0.95);
}


/* ---------- CREATE / EDIT MODAL ---------- */

.highlight-create-modal {
    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, 0.6);

    display: none;

    align-items: center;

    justify-content: center;

    padding: 20px;

    z-index: 9999;
}


.highlight-create-modal.active {
    display: flex;
}


.highlight-create-box {
    width: 100%;

    max-width: 620px;

    height: min(640px, 90vh);

    display: flex;

    flex-direction: column;

    background: #ffffff;

    border-radius: 16px;

    overflow: hidden;

    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.35);
}


.highlight-create-header {
    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 14px 18px;

    border-bottom: 1px solid #ced0d4;
}


.highlight-create-header h2 {
    margin: 0;

    font-size: 20px;

    font-weight: 700;
}


.highlight-create-body {
    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding: 20px 24px;
}


.highlight-create-body label {
    display: block;

    font-size: 13px;

    font-weight: 600;

    color: #65676b;

    margin: 12px 0 7px;
}


.highlight-create-body label:first-child {
    margin-top: 0;
}


#highlightNameInput {
    width: 100%;

    box-sizing: border-box;

    height: 40px;

    padding: 10px 14px;

    border: 1px solid #ccd0d5;

    border-radius: 6px;

    font-size: 15px;

    font-family: inherit;

    outline: none;

    background: #ffffff;

    color: #1c1e21;
}


#highlightNameInput:focus {
    border-color: #1877f2;

    box-shadow:
        0 0 0 2px rgba(24, 119, 242, 0.15);
}


.highlight-create-hint {
    margin: 4px 0 10px;

    font-size: 13px;

    color: #65676b;
}


/* ---------- POST PICKER GRID ---------- */

.highlight-posts-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(92px, 1fr));

    gap: 10px;
}


.highlight-post-pick {
    position: relative;

    aspect-ratio: 1;

    border-radius: 8px;

    overflow: hidden;

    cursor: pointer;

    border: 2px solid transparent;
}


.highlight-post-pick img {
    width: 100%;

    height: 100%;

    object-fit: cover;

    display: block;
}


.highlight-post-pick-text {
    width: 100%;

    height: 100%;

    display: flex;

    align-items: center;

    justify-content: center;

    text-align: center;

    font-size: 12px;

    font-weight: 600;

    padding: 6px;

    box-sizing: border-box;

    color: #fff;
}


.highlight-post-pick .highlight-check {
    position: absolute;

    top: 6px;

    right: 6px;

    width: 22px;

    height: 22px;

    border-radius: 50%;

    background: #1877f2;

    color: #fff;

    font-size: 12px;

    display: none;

    align-items: center;

    justify-content: center;
}


.highlight-post-pick.selected {
    border-color: #1877f2;
}


.highlight-post-pick.selected .highlight-check {
    display: flex;
}


.highlight-posts-empty {
    grid-column: 1 / -1;

    text-align: center;

    padding: 26px 0;

    color: #65676b;

    font-size: 14px;
}


/* ---------- MODAL ACTIONS ---------- */

.highlight-create-actions {
    flex-shrink: 0;

    display: flex;

    align-items: center;

    gap: 8px;

    padding: 12px 16px;

    border-top: 1px solid #ced0d4;
}


.highlight-create-actions button {
    height: 36px;

    padding: 0 18px;

    border: none;

    border-radius: 6px;

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;

    background: #e4e6eb;

    color: #050505;
}


.highlight-create-actions button:hover {
    background: #d8dadf;
}


.highlight-create-actions .primary-btn {
    background: #1877f2;

    color: #ffffff;
}


.highlight-create-actions .primary-btn:hover {
    background: #166fe5;
}


.highlight-create-actions .highlight-delete-btn {
    background: #ffe9e9;

    color: #c0392b;
}


.highlight-create-actions .highlight-delete-btn:hover {
    background: #ffd7d7;
}


.highlight-create-spacer {
    flex: 1;
}


/* ---------- VIEWER ---------- */

.highlight-viewer {
    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, 0.92);

    display: none;

    align-items: center;

    justify-content: center;

    z-index: 100000;
}


.highlight-viewer.active {
    display: flex;

    animation: socialhubHighlightViewerIn 0.25s ease;
}


@keyframes socialhubHighlightViewerIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


.highlight-viewer-stage {
    position: relative;

    width: 100%;

    max-width: 420px;

    height: 100%;

    max-height: 100vh;

    overflow: hidden;
}


/* ---------- PROGRESS BAR ---------- */

.highlight-progress-row {
    position: absolute;

    top: 10px;

    left: 0;

    right: 0;

    display: flex;

    gap: 4px;

    padding: 0 8px;

    z-index: 6;
}


.highlight-progress-seg {
    flex: 1;

    height: 3px;

    border-radius: 2px;

    background: rgba(255, 255, 255, 0.3);

    overflow: hidden;
}


.highlight-progress-seg .highlight-progress-fill {
    height: 100%;

    width: 0;

    background: #fff;
}


.highlight-progress-seg.active .highlight-progress-fill {
    width: 100%;

    transition: width 4s linear;
}


/* ---------- VIEWER TOP BAR ---------- */

.highlight-viewer-top {
    position: absolute;

    top: 22px;

    left: 0;

    right: 0;

    display: flex;

    align-items: center;

    gap: 10px;

    padding: 0 14px;

    z-index: 7;

    color: #fff;
}


.highlight-viewer-user {
    flex: 1;

    min-width: 0;

    display: flex;

    align-items: center;

    gap: 9px;
}


.highlight-viewer-user img {
    width: 34px;

    height: 34px;

    border-radius: 50%;

    object-fit: cover;

    background: rgba(255, 255, 255, 0.2);
}


.highlight-viewer-user .hv-user-fallback {
    width: 34px;

    height: 34px;

    border-radius: 50%;

    background: linear-gradient(135deg, #f09433, #dc2743, #7c3aed);

    display: flex;

    align-items: center;

    justify-content: center;

    font-weight: 800;

    font-size: 15px;
}


.highlight-viewer-user div {
    min-width: 0;
}


.highlight-viewer-user strong {
    display: block;

    font-size: 14px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


.highlight-viewer-user span {
    display: block;

    font-size: 12px;

    opacity: 0.75;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


.highlight-viewer-top button {
    width: 34px;

    height: 34px;

    border: none;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.18);

    color: #fff;

    font-size: 15px;

    cursor: pointer;

    flex-shrink: 0;
}


.highlight-viewer-top button:hover {
    background: rgba(255, 255, 255, 0.32);
}


/* ---------- SLIDE CONTENT ---------- */

.highlight-slide {
    position: absolute;

    inset: 0;

    display: flex;

    align-items: center;

    justify-content: center;
}


.highlight-slide-img {
    width: 100%;

    height: 100%;

    object-fit: contain;
}


.highlight-slide-text {
    width: 100%;

    height: 100%;

    display: flex;

    align-items: center;

    justify-content: center;

    text-align: center;

    padding: 40px;

    box-sizing: border-box;

    color: #fff;

    font-size: 19px;

    font-weight: 600;

    line-height: 1.5;
}


/* ---------- NAV ZONES ---------- */

.highlight-nav-left,
.highlight-nav-right {
    position: absolute;

    top: 0;

    bottom: 0;

    width: 45%;

    z-index: 5;

    cursor: pointer;
}


.highlight-nav-left {
    left: 0;
}


.highlight-nav-right {
    right: 0;
}


/* ---------- DARK MODE (modal only) ---------- */

body.dark-mode .highlight-create-box {
    background: #242526;

    color: #e4e6eb;
}


body.dark-mode .highlight-create-header,
body.dark-mode .highlight-create-actions {
    border-color: #3a3b3c;
}


body.dark-mode .highlight-create-body label,
body.dark-mode .highlight-create-hint,
body.dark-mode .highlight-posts-empty {
    color: #b0b3b8;
}


body.dark-mode #highlightNameInput {
    background: #3a3b3c;

    border-color: #4e4f52;

    color: #e4e6eb;
}


body.dark-mode .highlight-create-actions button {
    background: #3a3b3c;

    color: #e4e6eb;
}


body.dark-mode .highlight-create-actions button:hover {
    background: #4e4f52;
}


body.dark-mode .highlight-create-actions .highlight-delete-btn {
    background: rgba(192, 57, 43, 0.2);

    color: #ff8a7a;
}


body.dark-mode .highlight-create-actions .highlight-delete-btn:hover {
    background: rgba(192, 57, 43, 0.32);
}


body.dark-mode .highlight-tile span {
    color: #e4e6eb;
}


body.dark-mode .highlight-cover {
    border-color: #242526;
}


/* ---------- RESPONSIVE ---------- */

@media (max-width: 600px) {

    .highlights-bar {
        gap: 16px;

        padding: 12px 14px 4px;
    }


    .highlight-create-box {
        height: 92vh;
    }

}
