/* ===== Profile Page ===== */
body.profile-page { background: var(--bg); }
.profile-main {
    margin-top:20px;
    padding: 0 20px;
}
.profile-container {
    background: var(--bg-card); border-radius: var(--radius);
    border: 1px solid var(--border); padding: 32px;
}

.profile-title { font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.profile-subtitle { font-size: 18px; font-weight: 700; margin: 8px 0 16px; }
.profile-divider { height: 1px; background: var(--border); margin: 28px 0; }

/* Section */
.profile-section { margin-bottom: 20px; }
.profile-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

.profile-input {
    width: 100%; padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 15px; outline: none; background: var(--bg-card); transition: border-color .2s;
}
.profile-input:focus { border-color: var(--accent); }
.profile-input[readonly] { background: var(--bg); color: var(--text-muted); cursor: default; }

.profile-textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 15px; outline: none; resize: vertical; background: var(--bg-card); transition: border-color .2s;
}
.profile-textarea:focus { border-color: var(--accent); }

/* Avatar */
.profile-avatar-row { display: flex; align-items: center; gap: 16px; }
.profile-avatar {
    width: 80px; height: 80px; border-radius: 50%; overflow: hidden; position: relative;
    cursor: pointer; border: 2px solid var(--border);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-placeholder {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 40px; background: var(--bg-hover);
}
.profile-avatar-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.4); color: #fff; font-size: 13px; font-weight: 600;
    opacity: 0; transition: opacity .2s;
}
.profile-avatar:hover .profile-avatar-overlay { opacity: 1; }

/* Buttons */
.profile-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.profile-btn {
    padding: 9px 22px; border-radius: 20px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background .2s, opacity .2s; border: none;
}
.profile-btn:disabled { opacity: .5; cursor: default; }
.profile-btn-primary { background: var(--accent); color: #fff; }
.profile-btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.profile-btn-outline {
    background: transparent; color: var(--accent); border: 1px solid var(--accent);
}
.profile-btn-outline:hover:not(:disabled) { background: var(--accent-light); }

.profile-hint { font-size: 13px; color: var(--text-muted); }

.profile-toggle-row,
.profile-check-row {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}
.profile-toggle-row {
    justify-content: space-between;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
}
.profile-toggle-row strong { display: block; font-size: 15px; margin-bottom: 4px; }
.profile-toggle-row small { display: block; color: var(--text-muted); font-size: 13px; }
.profile-toggle-row input { display: none; }
.profile-toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    flex: 0 0 44px;
    border-radius: 999px;
    background: var(--border);
    transition: background .2s;
}
.profile-toggle-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
    transition: transform .2s;
}
.profile-toggle-row input:checked + .profile-toggle-slider { background: var(--accent); }
.profile-toggle-row input:checked + .profile-toggle-slider::before { transform: translateX(20px); }
.profile-check-row {
    margin: 8px 0;
    font-size: 14px;
}
.profile-check-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.profile-public-link {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
    word-break: break-all;
}
.profile-public-link a { color: var(--accent); }

/* Code row */
.profile-code-row { display: flex; gap: 12px; }
.profile-code-input { flex: 1; max-width: 200px; }

/* Toast */
.profile-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    padding: 10px 24px; border-radius: 20px; font-size: 14px; font-weight: 600;
    z-index: 5000; pointer-events: none;
    transition: opacity .3s, transform .3s;
    opacity: 0; transform: translateX(-50%) translateY(8px);
}
.profile-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.profile-toast.success { background: #2d8a4e; color: #fff; }
.profile-toast.error { background: #e5484d; color: #fff; }

@media (max-width: 768px) {
    .profile-main { margin-top: calc(var(--header-h) + 16px); }
    .profile-container { padding: 20px; }
}

/* ===== Public Profile Page ===== */
.profile-public-main {
    max-width: 980px;
    margin: 24px auto 56px;
    padding: 0 20px;
}
.profile-public-hero {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}
.profile-public-avatar {
    width: 96px;
    height: 96px;
    flex: 0 0 96px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-hover);
}
.profile-public-avatar img,
.profile-public-avatar .avatar-placeholder {
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
    font-size: 48px;
}
.profile-public-info h1 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.25;
}
.profile-public-info p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}
.profile-public-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
    font-size: 14px;
    color: var(--text-muted);
}
.profile-public-meta a { color: var(--accent); }
.profile-public-section {
    margin-top: 28px;
}
.profile-public-section h2 {
    margin: 0 0 16px;
    font-size: 20px;
}
.profile-public-posts {
    display: grid;
    gap: 18px;
}
.profile-public-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.profile-public-image {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-hover);
    border: 1px solid var(--border);
}
.profile-public-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s;
}
.profile-public-image:hover img { transform: scale(1.03); }
.profile-public-empty {
    padding: 20px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    background: var(--bg-card);
}

@media (max-width: 768px) {
    .profile-public-main { margin-top: calc(var(--header-h) + 16px); }
    .profile-public-hero {
        align-items: flex-start;
        padding: 20px;
    }
    .profile-public-avatar,
    .profile-public-avatar img,
    .profile-public-avatar .avatar-placeholder {
        width: 72px;
        height: 72px;
    }
    .profile-public-avatar { flex-basis: 72px; }
    .profile-public-info h1 { font-size: 22px; }
}
