/* PROFILE MODULE STYLES */

.profile-header-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.profile-top {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: #E2E8F0;
    overflow: hidden;
    position: relative;
    transition: background-color 0.3s ease;
}

.skeleton-text {
    background-color: #E2E8F0;
    color: transparent !important;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    user-select: none;
    display: inline-block;
}

.skeleton-text::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: skeleton-pulse 1.5s infinite;
}

.profile-avatar.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: skeleton-pulse 1.5s infinite;
}

@keyframes skeleton-pulse {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.profile-avatar img.loaded {
    opacity: 1;
}

.profile-info {
    flex: 1;
}

.profile-name {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-dark);
    line-height: 1.2;
}

.profile-handle {
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
}

.profile-stats {
    display: flex;
    gap: 20px;
    border-top: 1px solid #F1F5F9;
    padding-top: 15px;
}

.profile-stats .stat {
    font-size: 14px;
    color: var(--text);
}

.profile-stats .stat strong {
    font-weight: 700;
    color: var(--brand-dark);
}

.profile-stats .stat span {
    color: var(--muted);
}

/* Avatar Upload Overlay */
.avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
    color: white;
}

.profile-avatar:hover .avatar-overlay {
    opacity: 1;
}

/* Only show overlay if it's my profile (handled by JS toggling a class usually, but for now CSS hover is fine, we'll hide it in JS if not me) */
/* Better: We will add 'editable' class to .profile-avatar via JS if it's me */
.profile-avatar:not(.editable) .avatar-overlay {
    display: none !important;
}

.profile-posts-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-date-picker-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 140px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
}

.profile-date-picker-label {
    flex: 1;
    min-width: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.view-profile #view-profile #profileFeed {
    background: #fff;
    border: 0;
    border-radius: 0;
    gap: 0;
    overflow: visible;
}

body.view-profile #view-profile #profileFeed>.post {
    background: #fff !important;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    border: 0;
    border-radius: 18px;
    box-shadow: none !important;
    padding: 14px 26px 0;
    transition: none;
}

body.view-profile #view-profile #profileFeed>.post::after {
    content: '';
    position: absolute;
    left: 26px;
    right: 26px;
    bottom: 0;
    height: 1px;
    background: #E5E7EB;
}

body.view-profile #view-profile #profileFeed>.post:last-child::after {
    display: none;
}

body.view-profile #view-profile #profileFeed>.post:hover {
    background: #F4F6F8 !important;
    box-shadow: none !important;
}

body.view-profile #view-profile #profileFeed>.post .p-head {
    margin-bottom: 8px;
}

body.view-profile #view-profile #profileFeed>.post .p-user {
    gap: 7px;
    align-items: center;
}

body.view-profile #view-profile #profileFeed>.post .avatar {
    width: 26px;
    height: 26px;
}

body.view-profile #view-profile #profileFeed>.post .who {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    flex-wrap: wrap;
    line-height: 1.2;
}

body.view-profile #view-profile #profileFeed>.post .who .name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    color: #0F1A1C;
}

body.view-profile #view-profile #profileFeed>.post .meta-line {
    font-size: 12px;
    font-weight: 400;
    gap: 5px;
    margin-top: 0;
    color: #576F76;
    line-height: 1.2;
}

body.view-profile #view-profile #profileFeed>.post .title {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.32;
    letter-spacing: 0;
    color: #101214;
    margin: 0 0 8px 0 !important;
}

body.view-profile #view-profile #profileFeed>.post .desc {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.48;
    color: #1f2933;
    margin: 0 0 12px 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body.view-profile #view-profile #profileFeed>.post[data-has-media="true"] .desc {
    display: none;
}

body.view-profile #view-profile #profileFeed>.post .post-foot {
    background: transparent !important;
    border-top: 0 !important;
    border-radius: 0 !important;
    border-top: 0;
    border-radius: 0;
    justify-content: flex-start !important;
    gap: 12px;
    margin-top: 14px;
    margin-bottom: 0;
    margin-left: -26px;
    margin-right: -26px;
    padding-top: 4px;
    padding-bottom: 14px;
    padding-left: 26px;
    padding-right: 26px;
}

body.view-profile #view-profile #profileFeed>.post .post-foot>div:first-child {
    display: flex;
    align-items: center;
    gap: 6px !important;
}

body.view-profile #view-profile #profileFeed>.post .posts-card-actions {
    margin-left: 0;
}

body.view-profile #view-profile #profileFeed>.post .posts-card-actions--full {
    gap: 0;
}

body.view-profile #view-profile #profileFeed>.post .like-btn,
body.view-profile #view-profile #profileFeed>.post .view-btn,
body.view-profile #view-profile #profileFeed>.post .posts-share-btn {
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #EEF2F5;
    color: #0F1A1C;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    transition: background-color 0.14s ease, color 0.14s ease;
}

body.view-profile #view-profile #profileFeed>.post .like-btn:hover,
body.view-profile #view-profile #profileFeed>.post .posts-share-btn:hover {
    background: #E2E8F0;
    color: #0F172A;
}

body.view-profile #view-profile #profileFeed>.post .like-btn:hover {
    background: #FEECEF;
    color: #E11D48;
}

body.view-profile #view-profile #profileFeed>.post .like-btn.active {
    background: #EEF2F5;
    color: #E11D48;
}

body.view-profile #view-profile #profileFeed>.post .like-btn.active:hover {
    background: #FEECEF;
    color: #E11D48;
}

body.view-profile #view-profile #profileFeed>.post .posts-meta-chip,
body.view-profile #view-profile #profileFeed>.post .posts-recommendation-chip {
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
}

body.view-profile #view-profile #profileFeed>.post .posts-recommendation-chip {
    background: rgba(37, 99, 235, 0.06);
    border-color: rgba(37, 99, 235, 0.12);
}

@media (max-width: 900px) {
    body.view-profile #view-profile #profileFeed>.post {
        padding: 16px 16px 0;
    }

    body.view-profile #view-profile #profileFeed>.post::after {
        left: 16px;
        right: 16px;
    }

    body.view-profile #view-profile #profileFeed>.post .p-head {
        margin-bottom: 7px;
    }

    body.view-profile #view-profile #profileFeed>.post .p-user {
        gap: 7px;
        align-items: flex-start;
    }

    body.view-profile #view-profile #profileFeed>.post .who {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 2px;
    }

    body.view-profile #view-profile #profileFeed>.post .avatar {
        width: 26px;
        height: 26px;
    }

    body.view-profile #view-profile #profileFeed>.post .who .name,
    body.view-profile #view-profile #profileFeed>.post .meta-line {
        font-size: 12px;
    }

    body.view-profile #view-profile #profileFeed>.post .meta-line {
        line-height: 1.4;
    }

    body.view-profile #view-profile #profileFeed>.post .title {
        font-size: 16.5px;
        font-weight: 600;
        line-height: 1.32;
    }

    body.view-profile #view-profile #profileFeed>.post .desc {
        font-size: 14.5px;
        line-height: 1.48;
        -webkit-line-clamp: 2;
    }

    body.view-profile #view-profile #profileFeed>.post .post-foot {
        gap: 8px;
        margin-top: 12px;
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
        padding-top: 4px;
        padding-bottom: 12px;
    }
}

.profile-date-placeholder {
    flex: 1;
    display: grid;
    place-items: center;
    background: #f8fafc;
    border: 1px dashed #e2e8f0;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 12px;
}

.profile-feed-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px 0 8px;
}

.profile-feed-footer[hidden] {
    display: none !important;
}

.profile-load-more-btn {
    border: 1px solid var(--border, #cbd5e1);
    background: #fff;
    color: #0f172a;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.profile-load-more-btn:hover {
    background: #f8fafc;
}

.profile-load-more-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.profile-feed-loading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid var(--border, #e2e8f0);
    color: var(--muted, #64748b);
    font-size: 13px;
    font-weight: 600;
}

.profile-feed-loading[hidden] {
    display: none !important;
}

.profile-feed-status-card {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted, #64748b);
}

.profile-feed-status-text {
    margin: 0;
    font-size: 14px;
}

.profile-feed-spinner {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid #cbd5e1;
    border-top-color: #0ea5e9;
    animation: profile-spin 0.8s linear infinite;
}

.profile-feed-skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-feed-skeleton-card {
    background: #fff;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.profile-feed-skeleton-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.profile-feed-skeleton-avatar,
.profile-feed-skeleton-line,
.profile-feed-skeleton-pill {
    animation: profile-skeleton-shimmer 1.2s linear infinite;
    background: linear-gradient(90deg, #f1f5f9 20%, #e2e8f0 40%, #f1f5f9 60%);
    background-size: 220% 100%;
}

.profile-feed-skeleton-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.profile-feed-skeleton-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.profile-feed-skeleton-line {
    display: block;
    height: 12px;
    border-radius: 999px;
}

.profile-feed-skeleton-line-title {
    width: 38%;
    min-width: 140px;
}

.profile-feed-skeleton-line-sub {
    width: 56%;
    min-width: 180px;
}

.profile-feed-skeleton-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.profile-feed-skeleton-line-full {
    width: 100%;
}

.profile-feed-skeleton-line-short {
    width: 72%;
}

.profile-feed-skeleton-foot {
    display: flex;
    gap: 12px;
}

.profile-feed-skeleton-pill {
    width: 84px;
    height: 12px;
    border-radius: 999px;
}

.profile-empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--muted, #64748b);
}

.profile-empty-state-icon {
    margin-bottom: 12px;
    opacity: 0.6;
}

.profile-empty-state-icon-primary {
    color: var(--primary);
}

.profile-empty-state-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.profile-empty-state-title-muted {
    font-weight: 500;
    color: var(--text);
}

.profile-empty-state-copy {
    margin: 6px 0 20px;
    font-size: 14px;
    opacity: 0.8;
}

.profile-empty-state-copy-tight {
    margin-top: 4px;
    margin-bottom: 0;
}

.profile-empty-state-action {
    margin: 0 auto;
}

@keyframes profile-skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

@keyframes profile-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .profile-feed-spinner,
    .profile-feed-skeleton-avatar,
    .profile-feed-skeleton-line,
    .profile-feed-skeleton-pill {
        animation: none;
    }
}
