/* Profile page styles */
/* Honor HTML hidden attribute (overrides any display rule below) */
[hidden] { display: none !important; }

.profile-body {
    background: #0a0a0a;
    color: rgba(255, 255, 255, 0.88);
    min-height: 100vh;
}

.profile-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 88px 24px 64px;
}

/* Back link (replaces .article-back; profile.html does not load article.css) */
.profile-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 16px;
    text-decoration: none;
    transition: color 0.2s, background 0.2s;
    width: fit-content;
}
.profile-back:hover { color: #22d3ee; background: rgba(34, 211, 238, 0.08); }
.profile-back svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Gate (logged-out fallback) */
.profile-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 20px;
}
.profile-gate__inner {
    text-align: center;
    max-width: 360px;
}
.profile-gate__icon {
    color: rgba(255, 255, 255, 0.35);
    margin: 0 auto 18px;
    width: 56px;
    height: 56px;
}
.profile-gate__icon svg { width: 56px; height: 56px; }
.profile-gate__title {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 8px;
}
.profile-gate__desc {
    color: rgba(255, 255, 255, 0.55);
    font-size: 14px;
    margin: 0 0 22px;
}
.profile-gate__actions {
    display: inline-flex;
    gap: 10px;
}

/* Header */
.profile-header {
    margin-bottom: 28px;
}
.profile-header__title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.profile-header__sub {
    color: rgba(255, 255, 255, 0.55);
    font-size: 14px;
}

/* Sections */
.profile-section {
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}
.profile-section__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(34, 211, 238, 0.15);
}
.profile-section__title svg {
    width: 20px;
    height: 20px;
    color: var(--accent, #22d3ee);
}

/* Personal info */
.profile-info { display: flex; flex-direction: column; gap: 14px; }
.profile-info__row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}
.profile-info__label {
    flex: 0 0 80px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    text-align: right;
}
.profile-info__value {
    flex: 1;
    color: rgba(255, 255, 255, 0.92);
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.stat-pill {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 999px;
    color: var(--accent, #22d3ee);
    font-size: 13px;
    font-weight: 500;
}

/* Tabs */
.profile-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.profile-tab {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 15px;
    font-weight: 500;
    padding: 10px 20px;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}
.profile-tab:hover { color: rgba(255, 255, 255, 0.85); }
.profile-tab.is-active {
    color: var(--accent, #22d3ee);
}
.profile-tab.is-active::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: -1px;
    height: 2px;
    background: var(--accent, #22d3ee);
    border-radius: 2px 2px 0 0;
}

/* List */
.profile-list {
    display: flex;
    flex-direction: column;
}
.profile-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-radius: 6px;
}
.profile-item:hover {
    background: rgba(34, 211, 238, 0.06);
    color: #fff;
}
.profile-item__cat {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent, #22d3ee);
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
}
.profile-item__title {
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-item__date {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    white-space: nowrap;
}
.profile-empty {
    padding: 40px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
}
.profile-empty--err { color: #f87171; }

/* =========================================
   Tab badge (reply count on "我的回复")
   ========================================= */
.profile-tab__badge {
    display: inline-block;
    margin-left: 6px;
    min-width: 18px;
    padding: 0 6px;
    height: 18px;
    line-height: 18px;
    border-radius: 9px;
    background: var(--accent, #22d3ee);
    color: #042f33;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
}

/* =========================================
   Thread cards (我的回复 tab)
   ========================================= */
.thread-card {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.thread-card:last-child { border-bottom: none; }

.thread-card--replied {
    background: rgba(34, 211, 238, 0.04);
    border-left: 2px solid var(--accent, #22d3ee);
}
.thread-card--unread.thread-card--replied {
    background: rgba(34, 211, 238, 0.08);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.15);
}
.thread-card--read {
    opacity: 0.7;
}
.thread-card--read:hover {
    opacity: 1;
}
.thread-card__unread {
    color: var(--accent, #22d3ee);
    font-size: 10px;
    line-height: 1;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.thread-card__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.thread-card__read {
    color: var(--accent, #22d3ee);
    border-color: var(--accent, #22d3ee);
}
.thread-card__read:hover {
    background: rgba(34, 211, 238, 0.12);
}
.thread-card__read-tag {
    display: inline-block;
    padding: 4px 10px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}
.thread-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

/* Follow-up input (continue the conversation) */
.thread-followup {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(34,211,238,0.04);
    border: 1px dashed rgba(34,211,238,0.25);
    border-radius: 8px;
}
.thread-followup--disabled {
    background: rgba(255,255,255,0.02);
    border-color: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.55);
    font-size: 13px;
    text-align: center;
}
.thread-followup--disabled a { color: var(--accent, #22d3ee); }
.thread-followup__input {
    width: 100%;
    min-height: 50px;
    padding: 6px 10px;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--bd);
    border-radius: 6px;
    font: inherit;
    font-size: 13.5px;
    line-height: 1.55;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}
.thread-followup__input:focus {
    border-color: var(--accent, #22d3ee);
    box-shadow: 0 0 0 2px rgba(34,211,238,0.12);
}
.thread-followup__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}
.thread-followup__send {
    color: var(--accent, #22d3ee);
    border-color: var(--accent, #22d3ee);
}
.thread-followup__send:hover {
    background: rgba(34,211,238,0.12);
}

.thread-card__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.thread-card__title {
    flex: 1;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.thread-card__title:hover { color: var(--accent, #22d3ee); }
.thread-card__link {
    display: inline-block;
    margin-top: 10px;
    color: var(--accent, #22d3ee);
    text-decoration: none;
    font-size: 13px;
}
.thread-card__link:hover { text-decoration: underline; }

.thread-card__date {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    white-space: nowrap;
}

.thread-card__my-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.7;
    margin: 4px 0 10px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-left: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 4px 4px 0;
}

.thread-card__status {
    margin-top: 4px;
}

.thread-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}
.thread-badge--replied {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent, #22d3ee);
}
.thread-badge--pending {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
}

/* Replies (indented under my comment) */
.thread-replies {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(34, 211, 238, 0.06);
    border-left: 2px solid var(--accent, #22d3ee);
    border-radius: 0 6px 6px 0;
}
.thread-reply {
    padding: 6px 0;
}
.thread-reply + .thread-reply {
    border-top: 1px dashed rgba(34, 211, 238, 0.15);
    margin-top: 6px;
}
.thread-reply__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.thread-reply__author {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent, #22d3ee);
}
.thread-reply__date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}
.thread-reply__text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Profile "active" avatar (override default gray) */
.nav__profile--active .nav__profile-avatar svg circle,
.nav__profile--active .nav__profile-avatar svg path {
    fill: var(--accent, #22d3ee);
}

/* Responsive */
@media (max-width: 640px) {
    .profile-main { padding: 72px 16px 40px; }
    .profile-section { padding: 18px 16px; }
    .profile-info__row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .profile-info__label { text-align: left; flex: none; }
    .profile-item { grid-template-columns: 60px 1fr; row-gap: 4px; }
    .profile-item__date { grid-column: 2; }
    .profile-tab { padding: 8px 12px; font-size: 14px; }
}

/* Change-password form (EHS PATCH) */
.pf-pwd-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 480px;
}
.pf-pwd-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pf-pwd-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.5px;
}
.pf-pwd-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.9);
    font: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.pf-pwd-input:focus {
    border-color: #22d3ee;
    background: rgba(34, 211, 238, 0.06);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}
.pf-pwd-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}
.pf-pwd-submit {
    background: linear-gradient(180deg, #22d3ee, #06b6d4);
    color: #052e36;
    border: 0;
    border-radius: 8px;
    padding: 10px 22px;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s;
}
.pf-pwd-submit:hover { filter: brightness(1.08); }
.pf-pwd-submit:active { transform: translateY(1px); }
.pf-pwd-submit:disabled {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
    transform: none;
    filter: none;
}
.pf-pwd-msg {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 6px;
}
.pf-pwd-msg.is-ok {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.pf-pwd-msg.is-err {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.pf-pwd-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin: 4px 0 0;
    line-height: 1.5;
}
