/* =============================================
   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%;
}

/* --- 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;
}

.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;
}

.profile-username {
    width: 100%;
    padding: 0.85rem 1rem 0.5rem;
    font-family: 'changeling neo', sans-serif;
    font-weight: bold;
    font-size: 1.4rem;
    color: #fff;
    text-align: center;
    word-break: break-word;
    border-bottom: 1px solid #333;
}

.profile-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0.6rem 1rem 0.75rem;
    width: 100%;
    text-align: center;
}

.profile-meta span {
    font-size: 0.9rem;
    color: #ccc;
}

.profile-bio {
    width: 100%;
    padding: 0.85rem 1.1rem;
    font-size: 0.92rem;
    color: #ddd;
    border-top: 1px solid #333;
    line-height: 1.6;
    word-break: break-word;
}

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

.profile-links {
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 0.6rem 1.1rem 1.2rem;
    gap: 2px;
}

.profile-links a {
    color: #e8e8e8;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.15s;
    word-break: break-all;
    padding: 2px 0;
    display: block;
}

.profile-links a:hover {
    color: #d5171b;
    text-decoration: underline;
}

/* --- 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-bar input[type="text"] {
    flex: 1;
    min-width: 160px;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 10px;
    font-size: 0.9rem;
    border-radius: 3px;
}

.profile-search-bar input[type="text"]::placeholder {
    color: #777;
}

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

.profile-search-bar button {
    background: #d5171b;
    color: #fff;
    border: none;
    padding: 6px 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.2rem;
    padding: 8px 12px;
    margin-bottom: 4px;
}

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

.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.05);
}

.profile-post-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.65rem;
    padding: 3px 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(160px, 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.05);
}

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

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

.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: 900px) {
    .profile-wrap {
        flex-direction: column;
        align-items: center;
    }
    .profile-sidebar {
        width: 100%;
        max-width: 400px;
    }
    .profile-avatar-box {
        max-height: 320px;
        aspect-ratio: unset;
    }
    .profile-avatar-box img {
        max-height: 320px;
        object-fit: cover;
    }
}

@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;
    }
}

/* Follow button on profile page */
.profile-follower-count {
    font-size: 0.82rem;
    color: #888;
    margin-bottom: 10px;
}

.profile-follow-wrap {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-follow-btn {
    display: inline-flex;
    align-items: 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%;
    justify-content: center;
}

.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: #aaa;
    cursor: pointer;
}

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