/* =============================================
   Profile Page
   ============================================= */

.profile-page-wrap {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.profile-wrap {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    width: 100%;
}

.profile-notfound {
    text-align: center;
    color: #666;
    padding: 4rem 0;
    font-size: 1rem;
}

/* --- Sidebar --- */
.profile-sidebar {
    width: 290px;
    flex-shrink: 0;
    background: #1a1a1a;
    border-top: 4px solid #d5171b;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

/* Avatar */
.profile-avatar-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #111;
}

.profile-avatar-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

/* Identity */
.profile-identity {
    width: 100%;
    padding: 0.9rem 1rem 0.6rem;
    text-align: center;
    border-bottom: 1px solid #2a2a2a;
}

.profile-username {
    font-family: 'changeling neo', sans-serif;
    font-weight: bold;
    font-size: 1.4rem;
    color: #fff;
    word-break: break-word;
    line-height: 1.2;
    margin-bottom: 6px;
}

.profile-role-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 2px 10px;
    border-radius: 20px;
}

.profile-role-artist { background: rgba(213,23,27,0.18); color: #d5171b; border: 1px solid #d5171b; }
.profile-role-mod    { background: rgba(255,193,7,0.18);  color: #ffc107; border: 1px solid #ffc107; }
.profile-role-admin  { background: rgba(108,117,125,0.2); color: #adb5bd; border: 1px solid #666; }

/* Stats row */
.profile-stats-row {
    display: flex;
    width: 100%;
    border-bottom: 1px solid #2a2a2a;
    padding: 0.75rem 0;
}

.profile-stat-item {
    flex: 1;
    text-align: center;
}

.profile-stat-num {
    font-family: 'changeling neo', sans-serif;
    font-size: 1.4rem;
    font-weight: bold;
    color: #d5171b;
    line-height: 1;
}

.profile-stat-label {
    font-size: 0.7rem;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 3px;
}

.profile-stat-divider {
    width: 1px;
    background: #2a2a2a;
    margin: 4px 0;
}

/* Bio */
.profile-bio {
    width: 100%;
    padding: 0.85rem 1.1rem;
    font-size: 0.92rem;
    color: #ccc;
    border-top: 1px solid #2a2a2a;
    line-height: 1.65;
    word-break: break-word;
}

/* Links */
.profile-links-title {
    width: 100%;
    background: #d5171b;
    color: #fff;
    font-family: 'changeling neo', sans-serif;
    font-weight: bold;
    font-size: 0.95rem;
    padding: 6px 12px;
    margin-top: 0.25rem;
}

.profile-links {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem 1.2rem;
    gap: 4px;
}

.profile-links a {
    color: #ccc;
    font-size: 0.88rem;
    text-decoration: none;
    transition: color 0.15s;
    word-break: break-all;
    padding: 3px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-links a i {
    color: #555;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.profile-links a:hover { color: #d5171b; }
.profile-links a:hover i { color: #d5171b; }

/* Follow */
.profile-follow-wrap {
    width: 100%;
    padding: 0.85rem 1rem;
    border-top: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-follow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 20px;
    border-radius: 4px;
    font-family: 'changeling neo', sans-serif;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid #d5171b;
    background: rgba(213,23,27,0.12);
    color: #d5171b;
    transition: background 0.15s;
    width: 100%;
}

.profile-follow-btn:hover { background: rgba(213,23,27,0.25); }

.profile-following-btn {
    background: #d5171b;
    color: #fff;
}

.profile-following-btn:hover { background: #b01015; }

.profile-follow-form { margin: 0; }

.profile-notify-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    color: #888;
    cursor: pointer;
    padding: 0 2px;
}

.profile-notify-label input[type="checkbox"] {
    accent-color: #d5171b;
}

/* --- Right content --- */
.profile-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Search bar */
.profile-search-bar {
    width: 100%;
    background: #1a1a1a;
    padding: 0.75rem 1rem;
    border-top: 4px solid #d5171b;
}

.profile-search-bar form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.profile-search-icon {
    color: #666;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.profile-search-bar input[type="text"] {
    flex: 1;
    min-width: 160px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    color: #fff;
    padding: 7px 10px;
    font-size: 0.9rem;
    border-radius: 3px;
    outline: none;
    transition: border-color 0.15s;
}

.profile-search-bar input[type="text"]:focus { border-color: #d5171b; }
.profile-search-bar input[type="text"]::placeholder { color: #666; }

.profile-search-bar select {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    color: #fff;
    padding: 7px 10px;
    font-size: 0.9rem;
    border-radius: 3px;
    cursor: pointer;
    outline: none;
}

.profile-search-bar button {
    background: #d5171b;
    color: #fff;
    border: none;
    padding: 7px 18px;
    font-family: 'changeling neo', sans-serif;
    font-weight: bold;
    font-size: 0.9rem;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s;
}

.profile-search-bar button:hover { background: #b01015; }

/* Section */
.profile-section {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profile-section-title {
    width: 100%;
    background: #d5171b;
    color: #fff;
    font-family: 'changeling neo', sans-serif;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 8px 12px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-section-count {
    background: rgba(0,0,0,0.25);
    font-size: 0.8rem;
    padding: 1px 8px;
    border-radius: 10px;
    font-family: sans-serif;
    font-weight: normal;
    margin-left: 2px;
}

.profile-section-viewall {
    margin-left: auto;
    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: normal;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: color 0.15s;
}

.profile-section-viewall:hover { color: #fff; text-decoration: underline; }

/* Recent posts grid */
.profile-posts-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.profile-posts-grid li {
    position: relative;
    overflow: hidden;
    height: 140px;
    background: #111;
}

.profile-posts-grid li a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.profile-posts-grid li img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
    display: block;
}

.profile-posts-grid li:hover img { transform: scale(1.06); }

.profile-post-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 0.65rem;
    padding: 4px 6px;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-posts-grid li:hover .profile-post-overlay { opacity: 1; }

/* Galleries grid */
.profile-gallery-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 4px;
}

.profile-gallery-grid li {
    position: relative;
    overflow: hidden;
    height: 180px;
    background: #111;
}

.profile-gallery-grid li a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.profile-gallery-grid li img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    transition: transform 0.2s ease;
    display: block;
}

.profile-gallery-grid li:hover img { transform: scale(1.06); }

.profile-gal-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(213, 23, 27, 0.88);
    color: #fff;
    padding: 5px 7px;
    transition: background 0.2s;
}

.profile-gallery-grid li:hover .profile-gal-info { background: rgba(176, 16, 21, 0.97); }

.profile-gal-name {
    font-weight: bold;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-gal-meta {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.8);
}

/* =============================================
   Responsive
   ============================================= */
@media only screen and (max-width: 1100px) {
    .profile-posts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media only screen and (max-width: 900px) {
    .profile-wrap {
        flex-direction: column;
        align-items: center;
    }
    .profile-sidebar {
        width: 100%;
        max-width: 420px;
    }
    .profile-avatar-box {
        max-height: 320px;
        aspect-ratio: unset;
    }
    .profile-avatar-box img {
        max-height: 320px;
        object-fit: cover;
    }
    .profile-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media only screen and (max-width: 500px) {
    .profile-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .profile-posts-grid li {
        height: 110px;
    }
    .profile-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    .profile-gallery-grid li {
        height: 150px;
    }
}

/* Social platform list */
.profile-social-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem 0.75rem;
    gap: 6px;
}

.profile-social-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.88rem;
    padding: 5px 8px;
    border-radius: 4px;
    text-decoration: none;
    color: #ddd;
    background: #111;
    border: 1px solid #2a2a2a;
    transition: border-color 0.15s, color 0.15s;
    word-break: break-all;
}

.profile-social-item i { font-size: 1rem; flex-shrink: 0; width: 18px; text-align: center; }
.profile-social-item:hover { color: #fff; text-decoration: none; }

.profile-social-telegram  i { color: #229ED9; }
.profile-social-discord   i { color: #5865F2; }
.profile-social-fa        i { color: #FAAF3A; }
.profile-social-ib        i { color: #8BC34A; }
.profile-social-e621      i { color: #00549E; }
.profile-social-other     i { color: #aaa; }

.profile-social-telegram:hover  { border-color: #229ED9; }
.profile-social-discord:hover   { border-color: #5865F2; }
.profile-social-fa:hover        { border-color: #FAAF3A; }
.profile-social-ib:hover        { border-color: #8BC34A; }
.profile-social-e621:hover      { border-color: #00549E; }
.profile-social-other:hover     { border-color: #888; }
