/* =============================================================================
   PROFILE PAGE STYLES
   Version: 2.0 (Optimized)
   
   Table of Contents:
   1. Page Layout
   2. Profile Container & Loading
   3. Profile Header & Picture
   4. Profile Stats & Meta
   5. Edit Profile Forms
   6. Social Links & Song Player
   7. Posts Section
   8. Glitch Effect Animation
   9. Mobile Navigation
   10. Responsive Design
   ============================================================================= */

/* --- PAGE LAYOUT --- */
.content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 80px 20px;
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.page-header h1 {
    font-size: clamp(2.5rem, 8vw, 5rem);
    text-transform: uppercase;
    margin-bottom: 1rem;
    text-shadow: none;
    animation: none;
}

/* --- PROFILE CONTAINER --- */
#profile-content {
    background: rgba(26, 26, 26, 0.7);
    border: 1px solid #ff5555;
    border-radius: 10px;
    padding: 30px;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 15px rgba(255, 85, 85, 0.3);
    min-height: 200px;
    position: relative;
    text-align: center;
}

/* --- LOADING STATE --- */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    min-height: 200px;
    position: relative;
}

.loading-container::after {
    content: '';
    width: 40px;
    height: 40px;
    margin-top: 20px;
    border: 4px solid rgba(255, 85, 85, 0.2);
    border-top-color: #ff5555;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- PROFILE HEADER --- */
.profile-header {
    position: relative;
    margin-bottom: 30px;
}

.profile-view-count {
    position: absolute;
    top: 0;
    left: 0;
    color: #ccc;
    font-size: 0.9rem;
}

.pfp-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.profile-pfp {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ff5555;
}

.profile-pfp-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: #333;
    border: 3px solid #ff5555;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.3;
}

.profile-username {
    font-size: 2.5rem;
    color: #ff5555;
    text-shadow: 0 0 10px #ff5555;
    margin: 0 0 20px 0;
}

.profile-last-seen {
    color: #888;
    font-size: 0.9rem;
    margin: -10px 0 20px 0;
}

/* --- EDIT PROFILE BUTTON --- */
.edit-profile-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: #333;
    color: #eee;
    border: 1px solid #555;
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.edit-profile-btn:hover {
    background-color: #ff5555;
    box-shadow: 0 0 10px #ff5555;
}

/* --- PROFILE STATS --- */
.profile-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.stat-item {
    font-size: 1rem;
    color: #ccc;
}

.stat-item strong {
    font-size: 1.2rem;
    color: #fff;
}

/* --- FOLLOW BUTTON --- */
.follow-btn {
    background-color: #ff5555;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.follow-btn:hover {
    background-color: #ff7777;
    box-shadow: 0 0 10px #ff5555;
}

.follow-btn.unfollow {
    background-color: #555;
    color: #ccc;
}

.follow-btn.unfollow:hover {
    background-color: #777;
    box-shadow: none;
}

/* --- PROFILE SONG PLAYER --- */
.profile-song-player {
    margin: 15px auto;
    background: #2a2a2a;
    border-radius: 5px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 350px;
}

.profile-song-play-btn {
    background: #ff5555;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-song-title-container {
    overflow: hidden;
    white-space: nowrap;
    flex-grow: 1;
    text-align: left;
}

.profile-song-title {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    max-width: 100%;
    font-size: 0.9rem;
}

.profile-song-title.scrolling {
    animation: marquee 12s linear infinite;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
}

@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.youtube-player-hidden {
    display: none;
}

/* --- SOCIAL LINKS --- */
.profile-socials {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.social-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #222;
    border: 1px solid #444;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.social-icon-link:hover {
    background-color: #333;
    border-color: #ff5555;
}

.social-icon-link img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.social-icon-link[title="X / Twitter"] img {
    filter: invert(1);
}

/* --- BIO SECTION --- */
.profile-bio-section {
    margin-top: 20px;
    border-top: 1px solid #444;
    padding: 20px 0;
}

.profile-bio-label {
    text-align: left;
    color: #ccc;
    font-weight: bold;
    margin-bottom: 10px;
}

.profile-bio-content {
    text-align: left;
    min-height: 50px;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #ddd;
}

.profile-bio-empty {
    font-style: italic;
    color: #888;
}

/* --- POSTS SECTION --- */
#posts-section {
    margin-top: 40px;
}

.posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.posts-header h3 {
    font-size: 2rem;
    color: #ff5555;
    margin: 0;
}

.sort-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.sort-container label {
    font-weight: bold;
    font-size: 0.9rem;
}

.sort-select {
    background: #222;
    color: #eee;
    border: 1px solid #444;
    border-radius: 5px;
    padding: 5px;
    cursor: pointer;
}

.posts-empty {
    color: #888;
    font-style: italic;
}

/* --- POST ITEM --- */
.post-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    text-align: left;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
    margin-bottom: 15px;
}

.post-author-pfp {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #444;
    flex-shrink: 0;
}

.post-author-pfp-placeholder {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #333;
    border: 2px solid #444;
    flex-shrink: 0;
}

.post-author-info {
    display: flex;
    flex-direction: column;
}

.post-author-name {
    font-weight: 700;
    color: #eee;
    font-size: 1.1rem;
}

.post-timestamp {
    font-size: 0.8rem;
    color: #888;
}

.post-edited-date {
    color: #aaa;
    font-style: italic;
    font-size: 0.85rem;
}

.post-actions {
    margin-left: auto;
    display: flex;
    gap: 5px;
}

.post-body {
    margin-bottom: 15px;
}

.post-title {
    color: #eee;
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.post-content {
    margin: 0;
    color: #ddd;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
}

/* --- VOTE COMPONENT --- */
.vote-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.vote-btn {
    background: none;
    border: 1px solid #555;
    color: #999;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.vote-btn:hover {
    background-color: #333;
    color: #fff;
}

.vote-count {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ccc;
    min-width: 20px;
    text-align: center;
}

.vote-btn.up.active {
    background-color: #1e4620;
    color: #55ff55;
    border-color: #55ff55;
    text-shadow: 0 0 5px #55ff55;
}

.vote-btn.down.active {
    background-color: #4d1c1c;
    color: #ff5555;
    border-color: #ff5555;
    text-shadow: 0 0 5px #ff5555;
}

.vote-points-only {
    font-size: 1rem;
    color: #ccc;
}

/* --- POST FOOTER & STATS --- */
.post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #333;
    gap: 15px;
    flex-wrap: wrap;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    min-width: 0;
}

.post-date {
    color: #888;
    font-size: 0.85rem;
    white-space: nowrap;
}

.post-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #aaa;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.view-post-btn {
    background: var(--main-red);
    color: white;
    padding: 6px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.view-post-btn:hover {
    background: var(--hover-red);
    box-shadow: 0 0 10px rgba(255, 59, 59, 0.4);
    transform: translateY(-1px);
}

.post-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
}

.post-admin-buttons {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.post-action-btn {
    background: #333;
    color: #eee;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.post-action-btn:hover {
    background: #444;
    border-color: #777;
}

.post-action-btn.delete {
    color: #ff5555;
    border-color: #ff5555;
}

.post-action-btn.delete:hover {
    background: rgba(255, 85, 85, 0.1);
}

.pin-badge {
    display: inline-block;
    background: #ff5555;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.post-item.pinned {
    border-color: #ff5555;
    box-shadow: 0 0 15px rgba(255, 59, 59, 0.2);
}

/* --- EDIT FORMS --- */
.profile-edit-form {
    text-align: left;
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}

.form-input,
.form-textarea {
    width: 100%;
    background: #111;
    color: #eee;
    border: 1px solid #ff5555;
    border-radius: 5px;
    padding: 10px;
    font-family: 'Inter', sans-serif;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--hover-red);
    box-shadow: 0 0 10px rgba(255, 59, 59, 0.3);
}

.form-divider {
    border: none;
    border-top: 1px solid #333;
    margin: 10px 0;
}

.form-section-title {
    margin-bottom: 10px;
    color: #ff5555;
}

.form-helper-text {
    color: #888;
    font-size: 0.8rem;
    margin-top: 5px;
}

/* --- FORMATTING TOOLBAR --- */
.formatting-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    border: 1px solid #333;
}

.format-btn {
    background: #333;
    color: #eee;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 8px 16px;
    min-width: 44px;
    min-height: 44px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.format-btn:hover {
    background: var(--main-red);
    border-color: var(--hover-red);
    box-shadow: 0 0 8px rgba(255, 59, 59, 0.4);
    transform: translateY(-1px);
}

.format-btn:active {
    transform: translateY(0);
}

.format-btn strong {
    font-weight: 900;
}

.format-btn em {
    font-style: italic;
    font-family: Georgia, serif;
}

.format-btn u {
    text-decoration: underline;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

.form-cancel-btn {
    background: #555;
    border-color: #777;
}

.form-cancel-btn:hover {
    background: #666;
}

/* --- POST FORMS --- */
.post-form-container {
    text-align: left;
    margin-top: 20px;
}

.post-form-title {
    font-size: 2rem;
    color: #ff5555;
    margin-bottom: 20px;
}

.format-toolbar {
    margin-bottom: 5px;
    display: flex;
    gap: 5px;
}

.format-toolbar button {
    font-weight: bold;
    width: 30px;
    height: 30px;
    border: 1px solid #555;
    background: #333;
    color: #eee;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.2s;
}

.format-toolbar button:hover {
    background: #ff5555;
}

.format-toolbar button:nth-child(2) {
    font-style: italic;
}

.format-toolbar button:nth-child(3) {
    text-decoration: underline;
}

/* --- GLITCH EFFECT --- */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-bg);
    overflow: hidden;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--main-red);
    animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #2AABEE, 2px 2px var(--main-red);
    animation: glitch-anim-2 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% { clip: rect(42px, 9999px, 44px, 0); }
    5% { clip: rect(12px, 9999px, 60px, 0); }
    10% { clip: rect(40px, 9999px, 40px, 0); }
    15% { clip: rect(30px, 9999px, 50px, 0); }
    20% { clip: rect(50px, 9999px, 20px, 0); }
    25% { clip: rect(35px, 9999px, 55px, 0); }
    30% { clip: rect(45px, 9999px, 45px, 0); }
    35% { clip: rect(55px, 9999px, 35px, 0); }
    40% { clip: rect(45px, 9999px, 65px, 0); }
    45% { clip: rect(65px, 9999px, 45px, 0); }
    50% { clip: rect(25px, 9999px, 55px, 0); }
    55% { clip: rect(60px, 9999px, 30px, 0); }
    60% { clip: rect(30px, 9999px, 70px, 0); }
    65% { clip: rect(70px, 9999px, 50px, 0); }
    70% { clip: rect(50px, 9999px, 80px, 0); }
    75% { clip: rect(80px, 9999px, 60px, 0); }
    80% { clip: rect(60px, 9999px, 90px, 0); }
    85% { clip: rect(90px, 9999px, 70px, 0); }
    90% { clip: rect(70px, 9999px, 100px, 0); }
    95% { clip: rect(100px, 9999px, 80px, 0); }
    100% { clip: rect(80px, 9999px, 120px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(85px, 9999px, 90px, 0); }
    5% { clip: rect(35px, 9999px, 95px, 0); }
    10% { clip: rect(90px, 9999px, 25px, 0); }
    15% { clip: rect(25px, 9999px, 65px, 0); }
    20% { clip: rect(65px, 9999px, 15px, 0); }
    25% { clip: rect(15px, 9999px, 75px, 0); }
    30% { clip: rect(75px, 9999px, 5px, 0); }
    35% { clip: rect(5px, 9999px, 85px, 0); }
    40% { clip: rect(85px, 9999px, 25px, 0); }
    45% { clip: rect(25px, 9999px, 95px, 0); }
    50% { clip: rect(95px, 9999px, 35px, 0); }
    55% { clip: rect(35px, 9999px, 105px, 0); }
    60% { clip: rect(105px, 9999px, 45px, 0); }
    65% { clip: rect(45px, 9999px, 115px, 0); }
    70% { clip: rect(115px, 9999px, 55px, 0); }
    75% { clip: rect(55px, 9999px, 125px, 0); }
    80% { clip: rect(125px, 9999px, 65px, 0); }
    85% { clip: rect(65px, 9999px, 135px, 0); }
    90% { clip: rect(135px, 9999px, 75px, 0); }
    95% { clip: rect(75px, 9999px, 145px, 0); }
    100% { clip: rect(145px, 9999px, 85px, 0); }
}

/* --- MOBILE NAVIGATION (HIDDEN ON DESKTOP) --- */
/* CRITICAL: These styles ensure hamburger menu only appears on mobile devices.
   The default state hides all mobile navigation elements on desktop.
   They are shown only within the @media (max-width: 768px) breakpoint below. */

.buy-btn-mobile,
.hamburger {
    display: none;
}

.mobile-menu {
    display: none;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    .content-wrapper {
        padding: 60px 10px;
    }

    .posts-header {
        flex-direction: column;
        gap: 15px;
    }

    .posts-header .cta-button {
        width: 100%;
        max-width: 300px;
    }

    .social-icon-link {
        width: 40px;
        height: 40px;
    }

    .social-icon-link img {
        width: 25px;
        height: 25px;
    }

    .edit-profile-btn {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .profile-view-count {
        position: static;
        display: block;
        text-align: center;
        margin-bottom: 10px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }

    /* Mobile Navigation */
    .buy-btn-mobile,
    .hamburger {
        display: flex;
        align-items: center;
    }

    .buy-btn-mobile {
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 1100;
        background-color: var(--main-red);
        color: white;
        padding: 8px 15px;
        border-radius: 5px;
        text-decoration: none;
        font-family: 'Inter', sans-serif;
        font-weight: 700;
        font-size: 0.9rem;
        transition: background-color 0.3s ease;
    }

    .buy-btn-mobile:hover {
        background-color: var(--hover-red);
    }

    .hamburger {
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 22px;
        cursor: pointer;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1100;
        padding: 5px;
        background-color: rgba(13, 13, 13, 0.8);
        border: 1px solid var(--border-color);
        border-radius: 5px;
    }

    .hamburger div {
        width: 20px;
        height: 2px;
        background-color: #eee;
        margin: 0 auto;
        transition: all 0.3s ease;
    }

    .hamburger.active div:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active div:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active div:nth-child(3) {
        transform: rotate(-45deg) translate(4px, -4px);
    }

    .mobile-menu {
        position: fixed;
        top: 60px;
        left: 15px;
        width: 180px;
        background-color: rgba(13, 13, 13, 0.9);
        backdrop-filter: blur(10px);
        border-radius: 8px;
        border: 1px solid var(--border-color);
        z-index: 1099;
        padding: 10px 0;
        max-height: 80vh;
        overflow-y: auto;
    }

    .mobile-menu a {
        display: block;
        color: var(--text-primary);
        padding: 12px 20px;
        text-decoration: none;
        font-weight: 700;
        transition: color 0.3s, background-color 0.3s;
    }

    .mobile-menu a:hover {
        color: var(--main-red);
        background-color: rgba(255, 255, 255, 0.05);
    }

    /* Post Footer - Mobile Responsive */
    .post-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .view-post-btn {
        width: 100%;
        text-align: center;
    }

    /* Format Buttons - Mobile */
    .format-btn {
        min-width: 48px;
        min-height: 48px;
        padding: 10px 18px;
    }

    /* Post Header - Mobile Fix */
    .post-header-row {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .post-title {
        font-size: 1.15rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .post-admin-buttons {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    .post-action-btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    /* Post Content - Mobile */
    .post-content {
        font-size: 0.95rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Post Date & Edited - Mobile Fix */
    .post-date {
        font-size: 0.75rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .post-edited-date {
        display: block;
        margin-top: 4px;
        font-size: 0.75rem;
    }

    /* Pin Badge - Mobile */
    .pin-badge {
        font-size: 0.8rem;
        padding: 3px 8px;
    }
}
