/* ═══════════════════════════════════════════════════════════
   profile.css — User profile page + edit profile page
═══════════════════════════════════════════════════════════ */

/* ── Shared buttons ──────────────────────────────────────── */
.profileBtn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 150ms, transform 100ms, color 150ms;
    white-space: nowrap;
    font-family: inherit;
}
.profileBtn:hover{    text-decoration: none;
    color: inherit;}
    
.profileBtn:active { transform: scale(.97); }

.profileBtnPrimary {
    background: var(--accent);
    color: #fff;
}
.profileBtnPrimary:hover { background: var(--accent-soft); color: #fff; }

.profileBtnSecondary {
    background: var(--btn-bg);
    color: var(--btn-text);
    border: 1px solid var(--btn-border);
}
.profileBtnSecondary:hover { background: var(--btn-hover); }

/* ═══════════════════════════════════════════════════════════
   Profile page (@username)
═══════════════════════════════════════════════════════════ */

.profilePage {
    min-height: calc(100vh - 132px);
    background: var(--bg-main);
}

/* ── Hero ────────────────────────────────────────────────── */
.profileHero {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 32px 0 28px;
    max-width: 1000px;
    margin: auto;
}

.profileHeroInner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

/* Avatar */
.profileAvatarWrap {
    position: relative;
    flex-shrink: 0;
}

.profileAvatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    display: block;
    transition: opacity 200ms;
}

.profileAvatarOverlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    height:100%;
    justify-content: center;
    opacity: 0;
    cursor: pointer;
    transition: opacity 160ms;
    color: #fff;
}
.profileAvatarWrap:hover .profileAvatarOverlay { opacity: 1; }

/* Info */
.profileInfo {
    flex: 1;
    min-width: 0;
}

.profileNameRow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.profileName {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -.01em;
    line-height: 1.2;
}

.profilePremiumBadge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(59,130,246,.1);
    border: 1px solid rgba(59,130,246,.2);
    border-radius: 99px;
    padding: 2px 8px;
}

.profileAdminBadge {
    font-size: 10px;
    font-weight: 600;
    color: #f59e0b;
    background: rgba(245,158,11,.1);
    border: 1px solid rgba(245,158,11,.2);
    border-radius: 99px;
    padding: 2px 8px;
}

.profileHandle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.profileBio {
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.65;
    margin-bottom: 10px;
    max-width: 480px;
}

.profileStats {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}
.profileStats strong { color: var(--text-main); font-weight: 600; }
.profileStatDot      { color: var(--border-accent); }

/* Actions */
.profileActions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-left: auto;
}

/* ── Content area ────────────────────────────────────────── */
.profileContent {
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

/* ── Tabs ────────────────────────────────────────────────── */
.profileTabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.profileTabBtn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 140ms, border-color 140ms;
    margin-bottom: -1px;
    font-family: inherit;
}
.profileTabBtn:hover   { color: var(--text-main); }
.profileTabBtn.active  { color: var(--accent); border-bottom-color: var(--accent); }

.profileTabCount {
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 1px 7px;
    color: var(--text-muted);
}

.profileTabPane         { display: none; }
.profileTabPane.active  { display: block; }

/* ── Empty state ─────────────────────────────────────────── */
.profileEmpty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}
.profileEmpty svg { opacity: .3; }
.profileEmpty p   { font-size: 13px; }

/* ── Card grid ───────────────────────────────────────────── */
.profileCardGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.profileCard {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 160ms, box-shadow 160ms;
}
.profileCard:hover {
    border-color: var(--border-accent);
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.profileCardImg {
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--bg-soft);
}
.profileCardImg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 300ms ease;
}
.profileCard:hover .profileCardImg img { transform: scale(1.03); }

.profileCardBody {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profileCardCat {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
}

.profileCardTitle {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.35;
}
.profileCardTitle a { text-decoration: none; color: inherit; }
.profileCardTitle a:hover { color: var(--accent); }

.profileCardSub {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.profileCardMeta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.profileCardStatus {
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    padding: 2px 7px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.profileCardStatus.is-published { background: rgba(34,197,94,.1);  color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.profileCardStatus.is-draft     { background: rgba(245,158,11,.1); color: #fbbf24; border: 1px solid rgba(245,158,11,.2); }

.profileCardActions {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
}

.profileCardBtn {
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 6px;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    color: var(--btn-text);
    cursor: pointer;
    text-decoration: none;
    transition: background 140ms;
    font-family: inherit;
}
.profileCardBtn:hover          { background: var(--btn-hover); }
.profileCardBtn.is-danger      { color: var(--text-delete); background: var(--btn-delete); border-color: transparent; }
.profileCardBtn.is-danger:hover{ opacity: .85; }

.profileNewBtn {
    margin-top: 20px;
    display: flex;
    justify-content: flex-start;
}

/* ═══════════════════════════════════════════════════════════
   Edit profile page
═══════════════════════════════════════════════════════════ */

.editProfilePage {
    background: var(--bg-main);
    min-height: calc(100vh - 132px);
    padding: 40px 20px 80px;
}

.editProfileWrap {
    max-width: 580px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.editProfileHeader {
    display: flex;
    align-items: center;
    gap: 14px;
}

.editProfileBack {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 5px 8px;
    border-radius: 6px;
    transition: background 140ms, color 140ms;
    flex-shrink: 0;
}
.editProfileBack:hover { background: var(--bg-hover); color: var(--text-main); }

.editProfileTitle {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -.01em;
}

/* Alerts */
.editProfileAlert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
}
.editProfileAlert.is-success { background: rgba(34,197,94,.1);  color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.editProfileAlert.is-error   { background: rgba(239,68,68,.1);  color: #f87171; border: 1px solid rgba(239,68,68,.2); }

/* Avatar section */
.editAvatarSection {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.editAvatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
    transition: opacity 200ms;
}

.editAvatarInfo {
    flex: 1;
    min-width: 0;
}

.editAvatarLabel {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.editAvatarHint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 10px;
}

.editAvatarBtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--btn-text);
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 7px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 140ms;
}
.editAvatarBtn:hover { background: var(--btn-hover); }

.editAvatarStatus {
    display: block;
    font-size: 11px;
    margin-top: 6px;
    min-height: 16px;
    transition: color 200ms;
}
.editAvatarStatus.is-loading { color: var(--text-muted); }
.editAvatarStatus.is-success { color: #4ade80; }
.editAvatarStatus.is-error   { color: #f87171; }

/* Form */
.editProfileForm {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.editField {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.editField:first-child { padding-top: 0; }
.editField:last-child  { border-bottom: none; padding-bottom: 0; }

.editFieldReadonly .editInput { opacity: .55; cursor: not-allowed; }

.editLabel {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.editRequired { color: #f87171; }

.editInput,
.editTextarea {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
    transition: border-color 140ms;
    resize: vertical;
}
.editInput:focus,
.editTextarea:focus { border-color: var(--accent); }
.editInput::placeholder,
.editTextarea::placeholder { color: var(--text-muted); opacity: .6; }
.editInput:disabled { cursor: not-allowed; }

.editInputPrefix {
    display: flex;
    align-items: center;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 140ms;
}
.editInputPrefix:focus-within { border-color: var(--accent); }

.editPrefix {
    padding: 0 10px;
    font-size: 14px;
    color: var(--text-muted);
    background: var(--bg-mark);
    border-right: 1px solid var(--border);
    align-self: stretch;
    display: flex;
    align-items: center;
    font-weight: 600;
    flex-shrink: 0;
}

.editInputPrefix .editInput {
    border: none;
    border-radius: 0;
    background: transparent;
}
.editInputPrefix .editInput:focus { border: none; }

.editHint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
    line-height: 1.5;
}

.editCharCount {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

.editMembershipRow {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editMembershipBadge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    padding: 5px 10px;
}
.editMembershipBadge.is-premium { background: rgba(59,130,246,.1); color: var(--accent); border: 1px solid rgba(59,130,246,.2); }
.editMembershipBadge.is-free    { background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--border); }

.editUpgradeLink {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.editUpgradeLink:hover { text-decoration: underline; }

.editFormActions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 14px;
    margin-top: 4px;
}

/* Danger zone */
.editDangerZone {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
}

.editDangerTitle {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.editDangerRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.editDangerLabel {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 2px;
}

.editDangerSub {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 700px) {
    .profileHeroInner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .profileActions {
        flex-direction: row;
        margin-left: 0;
        width: 100%;
    }

    .profileActions .profileBtn { flex: 1; justify-content: center; }

    .profileCardGrid { grid-template-columns: 1fr; }

    .editAvatarSection { flex-direction: column; align-items: flex-start; }
    .editAvatar        { width: 70px; height: 70px; }
}

@media (max-width: 480px) {
    .editProfilePage { padding: 24px 14px 60px; }
    .profileHero     { padding: 20px 0; }
    .profileContent  { padding: 20px 14px 40px; }
}
