@media (max-width: 768px) {
    #profile-header .col-12.col-lg-auto .profile-info-panel {
        padding: 16px 10px !important;
        min-height: 120px !important;
        height: 120px !important;
        max-height: 140px !important;
        font-size: 1em;
        box-shadow: 0 1px 3px rgba(0,0,0,0.10);
    }
    #profile-header .col-12.col-lg-auto .profile-info-panel .row.g-3.mb-2 {
        margin-bottom: 0 !important;
        gap: 0 !important;
    }
    #profile-header .stat-item, #profile-header .stat-link {
        padding: 0 !important;
        margin: 0 !important;
    }
    #profile-header .stat-item .h4, #profile-header .stat-link .h4 {
        font-size: 1.1rem !important;
        margin-bottom: 0 !important;
    }
    #profile-header .stat-item small, #profile-header .stat-link small {
        font-size: 0.75em !important;
        margin-bottom: 0 !important;
    }
    #profile-header .profile-socials {
        margin-bottom: 0 !important;
        gap: 0.5em !important;
    }
}
@media (max-width: 768px) {
    #profile-header .profile-picture-wrapper {
        margin-left: auto !important;
        margin-right: auto !important;
        display: block !important;
        text-align: center;
    }
}
@media (max-width: 768px) {
    #profile-header .d-flex.flex-row.flex-wrap.align-items-stretch.gap-4.w-100 {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
    }
    #profile-header .col-auto,
    #profile-header .col {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        display: block !important;
    }
    #profile-header .profile-info-panel {
        margin-top: 12px;
    }
}
/* Visually center stat numbers and labels using flex column layout */
.stat-item,
.stat-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.stat-item .h4,
.stat-link .h4,
.stat-item small,
.stat-link small {
    text-align: center;
    width: 100%;
}
/* Edit Profile Modal Socials List */
#edit-socials-list .input-group {
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 0.25em 0.5em;
    gap: 0.5em;
}
#edit-socials-list .input-group .input-group-text {
    background: transparent;
    color: var(--text-primary);
    border: none;
}
#edit-socials-list .form-control[readonly] {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--bg-secondary);
    box-shadow: none;
    font-size: 1em;
}
#edit-socials-list .btn-outline-danger {
    border: none;
    color: var(--accent-color);
    background: transparent;
    font-size: 1.1em;
    padding: 0.25em 0.7em;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
#edit-socials-list .btn-outline-danger:hover {
    background: var(--accent-color);
    color: var(--bg-primary);
}
/* Custom badge grid for profile edit modal */
#edit-badges-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 768px) {
    #edit-badges-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        align-items: start;
        max-height: 420px;
        min-height: 320px;
        overflow-y: auto;
    }
}

.badge-tooltip-custom {
    position: absolute;
    z-index: 50000;
    background: var(--panel-bg, #23232b);
    color: var(--text-primary, #fff);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    padding: 0.7em 1.1em 0.7em 1.1em;
    font-size: 1em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    min-width: 180px;
    max-width: 320px;
    text-align: center;
    line-height: 1.35;
    border: 2px solid var(--accent-color, #e74c3c);
    font-weight: 400;
    white-space: normal;
    word-break: break-word;
}
/* Ensure badge grid cell has no border or box-shadow */
.badge-select-cell {
    border: none !important;
    box-shadow: none !important;
    background: none;
    width: 100%;
    max-width: 110px;
    min-width: 90px;
    margin: 0 auto;
}
/* Badge selection grid improvements */
.badge-select-img-wrap {
    border: 2px solid transparent;
    border-radius: 8px;
    transition: border 0.2s, box-shadow 0.2s;
}
.edit-profile-modal #edit-badges-grid .badge-select-img-wrap.selected {
    border: 2px solid var(--accent-color, #e74c3c) !important;
    box-shadow: 0 0 0 3px var(--accent-color, #e74c3c55);
}
.badge-select-img-wrap.selected {
    border: 2px solid transparent !important;
    box-shadow: none !important;
}
/* Social icon style for both SVG and FA icons */
.social-icon {
    width: 1.725em;
    height: 1.725em;
    display: grid;
    place-items: center;
    margin: 0;
    vertical-align: -0.125em;
    fill: currentColor;
}

#profile-socials-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5em;
}

.profile-info-panel {
    display: flex;
    flex-direction: column;
    min-height: 220px;
    height: 100%;
    flex: 1 1 0;
    box-sizing: border-box;
    border-radius: 8px;
}

.profile-info-panel {
    justify-content: space-between;
    height: 100%;
    min-height: 220px;
    overflow: auto;
}
@media (min-width: 992px) {
    .profile-info-panel {
        min-height: 220px;
        height: 100%;
    }
}

#show-all-socials-btn.social-link {
    background: var(--text-secondary) !important;
    color: var(--bg-primary) !important;
    border: none;
    min-width: 0;
    box-shadow: none;
    font-size: 1.22em;
}
#show-all-socials-btn.social-link:hover {
    background: var(--accent-color) !important;
    color: #fff !important;
}
/* Socials Styling */
.profile-socials .social-link {
    display: grid;
    place-items: center;
    gap: 0.5em;
    font-size: 1.22em;
    color: #fff !important;
    background: #555;
    border-radius: 50%;
    width: 2.3em;
    height: 2.3em;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    text-decoration: none !important;
    position: relative;
    vertical-align: middle;
    overflow: hidden;
}
.profile-socials .social-link span {
    font-size: 0.9em;
    margin-left: 0.3em;
    color: #fff;
    display: none;
}
.profile-socials .social-link i {
    font-size: 1.15em;
    width: 1.15em;
    height: 1.15em;
    display: grid;
    place-items: center;
    margin: 0;
}
.profile-socials .social-link[title="Twitter"] {
    background: #1D9BF0;
}
.profile-socials .social-link[title="Bluesky"] {
    background: linear-gradient(0deg, #0B7CFE, #57B8FF);
}
.profile-socials .social-link[title="Mastodon"] {
    background: #615CF6;
}
.profile-socials .social-link[title="Instagram"] {
    background: linear-gradient(45deg, #FFCC00, #FE6804, #FF143A, #FC01D7, #7D0CFE);
}
.profile-socials .social-link[title="YouTube"] {
    background: #FF0000;
}
.profile-socials .social-link[title="Wattpad"] {
    background: #FF5722;
}
.profile-socials .social-link[title="AO3"] {
    background: #970000;
}
.profile-socials .social-link[title="Fur Affinity"] {
    background: #FAAF3A;
}
.profile-socials .social-link[title="Facebook"] {
    background: #0866FF;
}
.profile-socials .social-link[title="Tumblr"] {
    background: #314358;
}
.profile-socials .social-link[title="Telegram"] {
    background: linear-gradient(0deg, #00B0E5, #0098CC);
}
.profile-socials .social-link[title="Other"] {
    background: #2d2f33;
}
.profile-socials .social-link:hover {
    filter: brightness(1.1) drop-shadow(0 2px 8px rgba(0,0,0,0.18));
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    text-decoration: none;
}
.profile-socials .social-link:hover span {
    display: inline;
    font-weight: 500;
}
.profile-socials .social-link:active {
    filter: brightness(0.95);
}
/* Badge Popover (Tooltip Style) */
.badge-popover {
    position: absolute;
    z-index: 40000;
    min-width: 220px;
    max-width: 320px;
    /* Use Bootstrap modal/card/panel classes for layout and structure. Keep only theme-specific overrides below. */
    background: var(--panel-bg, #23232b) !important;
    color: var(--text-primary, #fff);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    padding: 1.1rem 1.1rem 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 1 !important;
    overflow: visible;
    pointer-events: auto;
    transition: opacity 0.15s;
}

.badge-popover-caret {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 14px solid var(--panel-bg, #23232b);
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.18));
}

.badge-popover-img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    margin-bottom: 0.7rem;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.badge-popover-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    text-align: center;
}
.badge-popover-desc {
    font-size: 0.98rem;
    color: var(--text-secondary, #bbb);
    text-align: center;
}
.badge-popover-date {
    font-size: 0.88rem;
    color: var(--text-secondary, #bbb);
    text-align: center;
    margin-top: 0.4rem;
    opacity: 0.85;
}
/* Profile Badges Row */
#profile-badges-row {
    min-height: 40px;
    margin-bottom: 0.5rem;
}
.profile-badge-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color, #e74c3c);
    background: var(--bg-primary, #222);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.15s, box-shadow 0.15s;
    margin-right: 2px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.profile-badge-icon:last-child {
    margin-right: 0;
}
.profile-badge-icon:hover {
    transform: scale(1.12) rotate(-3deg);
    box-shadow: 0 4px 16px rgba(233,119,117,0.2);
    z-index: 2;
}
/* Reading list links styling */
.reading-list-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s, text-decoration 0.2s;
}
.reading-list-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}
/* Profile picture and frame overlay layout */
.profile-picture-wrapper {
    position: relative;
    display: inline-block;
    width: 120px;
    height: 120px;
}

.edit-pfp-trigger .edit-pfp-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 3;
    pointer-events: none;
}

.edit-pfp-trigger:hover .edit-pfp-overlay {
    opacity: 1;
}
.profile-picture {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
}
.profile-frame-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 180px;
    height: 180px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 3 !important;
}
/* Theme primary background for user cards on followers/following */
.theme-bg-primary {
    background: var(--bg-primary) !important;
}

/* Panel behind profile info and stats */
.profile-info-panel {
    background: var(--panel-bg, rgba(30, 30, 32, 0.82));
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(2.5px);
    z-index: 2;
}


/* Edit Profile Modal Style Tab Customizations */
.edit-profile-modal .form-control-color {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 8px;
    background: var(--bg-primary, #181a1b);
    margin-top: 0.25rem;
    cursor: pointer;
}

.edit-profile-modal #profile-frame-grid {
    margin-top: 0.5rem;
}
.edit-profile-modal .profile-frame-option {
    border: none;
    transition: none;
    background: var(--bg-primary, #181a1b);
    aspect-ratio: 1 / 1;
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    max-width: 180px;
    min-width: 120px;
    /* Remove min/max-height to let aspect-ratio control height */
}
.edit-profile-modal .profile-frame-option.selected {
    border: 3px solid var(--accent-color, #4fa3ff);
    box-shadow: 0 0 0 2px var(--accent-color, #4fa3ff33);
    z-index: 1;
}
.edit-profile-modal .profile-frame-option img {
    pointer-events: none;
    max-width: 96%;
    max-height: 96%;
    width: 96%;
    height: 96%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.edit-profile-modal #profile-banner-preview img {
    margin-top: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
/* Edit Profile Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    z-index: 20000 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.edit-profile-modal-bg {
    background: transparent;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-profile-modal {
    background: var(--bg-secondary, #23272b);
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    padding: 2.5rem 2rem 1.5rem 2rem;
    width: 480px;
    min-width: 340px;
    max-width: 95vw;
    min-height: 520px;
    max-height: 90vh;
    overflow-y: auto;
    color: var(--text-primary);
    border: none;
    display: flex;
    flex-direction: column;
}

.edit-profile-modal .tab-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.edit-profile-modal .tab-pane {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.edit-profile-modal .modal-header {
    border-bottom: 1px solid var(--border-color, #444);
    margin-bottom: 1rem;
}

.edit-profile-modal .modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--accent-color, #e63946);
    cursor: pointer;
    transition: color 0.2s;
}
.edit-profile-modal .modal-close:hover {
    color: var(--text-primary);
}

.edit-profile-modal .nav-tabs .nav-link {
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    transition: color 0.2s, border-color 0.2s;
}
.edit-profile-modal .nav-tabs .nav-link.active {
    color: var(--accent-color, #e63946);
    border-bottom: 2px solid var(--accent-color, #e63946);
    background: none;
}

.edit-profile-modal .form-group label {
    color: var(--text-primary);
    font-weight: 500;
}
.edit-profile-modal .form-control {
    background: var(--bg-primary, #181a1b);
    color: var(--text-primary);
    border-radius: 8px;
    margin-top: 0.25rem;
}
.edit-profile-modal .form-control:focus {
    border-color: var(--accent-color, #e63946);
    box-shadow: 0 0 0 2px rgba(230,57,70,0.15);
}

.edit-profile-modal .char-counter {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    text-align: right;
}

.edit-profile-modal .modal-actions {
    border-top: 1px solid var(--border-color, #444);
    padding-top: 1rem;
    margin-top: 1rem;
}

/* Profile page specific text overrides */
/* Fix profile name alignment - override global h1 center alignment */
#profile-name
{
    text-align: left !important;
}

/* Profile actions container */
.profile-actions
{
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.profile-actions .btn
{
    margin-bottom: 0;
}

/* Follow button styles */
.follow-btn
{
    transition: all 0.3s ease;
}

.follow-btn.following
{
    background-color: var(--bg-secondary) !important;
    border-color: var(--text-secondary) !important;
    color: var(--text-secondary) !important;
    position: relative;
}

.follow-btn.following:hover {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: var(--text-primary) !important;
}

.follow-btn .follow-plus {
    display: inline;
}
.follow-btn .following-text,
.follow-btn .unfollow-text {
    display: none;
}
.follow-btn.following .follow-plus {
    display: none;
}
.follow-btn.following .following-text {
    display: inline;
}
.follow-btn.following .unfollow-text {
    display: none;
}
.follow-btn.following:hover .following-text {
    display: none;
}
.follow-btn.following:hover .unfollow-text {
    display: inline;
}





/* Clickable stats styling */

.stat-link {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 4px;
}

.stat-link:hover
{
    color: inherit;
    background: rgba(233, 119, 117, 0.1);
    transform: translateY(-2px);
}

.stat-link:hover .h4
{
    color: var(--accent-color) !important;
}

.stat-link:active
{
    transform: translateY(0);
}

/* Non-clickable stats styling - matches stat-link base appearance */

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 4px;
}

/* User card styling for followers/following pages */
.user-card
{
    border: 1px solid rgba(233, 119, 117, 0.2);
    transition: all 0.2s ease;
}

.user-card:hover
{
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(233,119,117,0.2);
}

.user-avatar
{
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
}

.user-name
{
    color: var(--text-primary) !important;
    font-weight: 600;
    margin-bottom: 4px !important;
}

.user-bio
{
    font-size: 0.9rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tab content text styling */
.tab-content .text-light
{
    color: var(--text-primary) !important;
}

.tab-content .text-muted
{
    color: var(--text-secondary) !important;
}

/* List group items text */
/* Button overrides removed — using global styles.css definitions */

.btn-outline-danger
{
    color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus
{
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: var(--text-primary) !important;
}

.btn-outline-secondary
{
    color: var(--text-secondary) !important;
    border-color: var(--text-secondary) !important;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus
{
    background-color: var(--text-secondary) !important;
    border-color: var(--text-secondary) !important;
    color: var(--bg-primary) !important;
}

/* Profile Page Styles */

/* Modal Styles */
.modal
{
    background: var(--bg-secondary);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    border: 1px solid var(--border-color);
}

.modal *
{
    color: var(--text-primary);
}

.modal input,
.modal textarea
{
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
}

.modal-header
{
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.modal-header h3
{
    margin: 0;
    color: var(--accent-color);
}

.modal-close
{
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover
{
    color: var(--text-primary);
}

.form-group
{
    margin-bottom: 20px;
}

.form-group label
{
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group input,
.form-group textarea
{
    width: 100%;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus
{
    outline: none;
    border-color: var(--accent-color);
}

.char-counter
{
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.modal-actions
{
    padding: 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    margin-top: 24px;
}