/* ═══════════════════════════════════════
   Public Profile Page — 2-column layout
   ═══════════════════════════════════════ */

.profile-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.profile-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: stretch;
}

/* ── Left sidebar: identity card ── */

.profile-sidebar {
    display: flex;
    flex-direction: column;
}

.profile-card {
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 12px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.profile-card-banner {
    height: 80px;
    background: linear-gradient(135deg, #0969da 0%, #1f6feb 40%, #58a6ff 100%);
}

.profile-card-body {
    padding: 0 20px 20px;
    margin-top: -40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

/* Avatar */

.profile-avatar-wrap {
    margin-bottom: 10px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.profile-avatar--img {
    object-fit: cover;
    display: block;
}

.profile-avatar--initials {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    user-select: none;
}

/* Card text */

.profile-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #24292f;
    margin: 0;
    line-height: 1.3;
}

.profile-handle {
    font-size: 0.82rem;
    color: #656d76;
    margin-bottom: 6px;
}

.profile-bio {
    font-size: 0.85rem;
    color: #24292f;
    line-height: 1.5;
    margin: 10px 0 0;
    text-align: justify;
    width: 100%;
}

.profile-card-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: #656d76;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f2f5;
    width: 100%;
    justify-content: center;
}

.profile-card-meta svg {
    opacity: 0.5;
}

.profile-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #24292f;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s;
}

.profile-edit-btn:hover {
    background: #f6f8fa;
}

/* ── Right column ── */

.profile-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Metrics */

.profile-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.profile-metric {
    padding: 16px 12px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    text-align: center;
    transition: border-color 0.15s;
}

.profile-metric:hover {
    border-color: #0969da;
}

.profile-metric--pos { border-left: 3px solid #1a7f37; }
.profile-metric--neg { border-left: 3px solid #cf222e; }

.profile-metric-val {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #24292f;
    line-height: 1;
}

.profile-metric-lbl {
    display: block;
    font-size: 0.68rem;
    color: #656d76;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Section cards */

.profile-section {
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 12px;
    padding: 18px 20px;
}

.profile-section-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #656d76;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Category bars */

.profile-cat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-cat-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: #24292f;
    min-width: 90px;
}

.profile-cat-bar-bg {
    flex: 1;
    height: 7px;
    background: #f0f2f5;
    border-radius: 4px;
    overflow: hidden;
}

.profile-cat-bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #0969da, #58a6ff);
    border-radius: 4px;
    min-width: 4px;
    transition: width 0.4s ease;
}

.profile-cat-num {
    font-size: 0.75rem;
    font-weight: 600;
    color: #656d76;
    min-width: 20px;
    text-align: right;
}

/* Activity feed */

.profile-feed {
    display: flex;
    flex-direction: column;
}

.profile-feed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid #f0f2f5;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s;
}

.profile-feed-item:last-child { border-bottom: none; }
.profile-feed-item:hover { background: #f6f8fa; border-radius: 6px; }

.profile-feed-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.profile-feed-icon--pos { background: #dafbe1; color: #1a7f37; }
.profile-feed-icon--neg { background: #ffebe9; color: #cf222e; }

.profile-feed-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.profile-feed-title {
    font-size: 0.84rem;
    font-weight: 500;
    color: #24292f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-feed-date {
    font-size: 0.72rem;
    color: #656d76;
}

.profile-feed-tags {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Empty state */

.profile-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 12px;
    color: #656d76;
    font-size: 0.88rem;
}

/* ═══════════════════════════════
   Edit Profile: avatar upload
   ═══════════════════════════════ */

.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-upload-preview {
    flex-shrink: 0;
}

.avatar-upload-img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid #d0d7de;
}

.avatar-upload-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    border: 2px solid #d0d7de;
}

.avatar-upload-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.avatar-upload-input {
    display: none;
}

.avatar-upload-btn {
    cursor: pointer;
    width: fit-content;
}

.form-hint {
    font-size: 0.75rem;
    color: #656d76;
}

.profile-edit-actions {
    display: flex;
    gap: 10px;
    padding-top: 8px;
}

/* ═══════════════
   Responsive
   ═══════════════ */

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

    .profile-sidebar {
        position: static;
    }

    .profile-card-body {
        align-items: center;
        text-align: center;
    }

    .profile-bio {
        text-align: justify;
    }

    .profile-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-feed-tags {
        display: none;
    }
}
