.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 20px;
    gap: 40px;
}

/* Left section (profile info) */
.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px; /* 7px between different things */
    text-align: center;
    max-width: 300px; /* Set maximum width to prevent expansion */
    width: 300px; /* Fixed width for consistency */
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    .profile-info {
        max-width: 100%;
        width: 100%;
    }
}

/* Remove gap between username and user info */
.profile-info #profile-username + #profile-user-info {
    margin-top: 0px; /* Allow normal spacing between username and user info */
}

/* Friends section on the left */
.friends-section-left {
    width: 80%; /* Less wide */
    max-width: 300px; /* Maximum width */
    margin-top: 10px;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    .friends-section-left {
        width: 100%;
        max-width: 100%;
    }
}

.friends-title-left {
    font-size: 15px !important; /* Small but readable title */
    margin-bottom: 6px;
    color: var(--text-color-secondary); /* Lighter color */
    text-align: center;
    font-weight: normal; /* Not bold */
    cursor: pointer;
    transition: color 0.2s ease;
}

.friends-title-left:hover {
    color: var(--link-color); /* Blue on hover to indicate it's clickable */
}

.friends-list-left {
    list-style-type: none;
    padding: 0;
    margin: 0;
    max-height: 200px; /* Height for approximately 5 friends */
    overflow-y: auto;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.friends-list-left li {
    margin-bottom: 6px;
    font-size: 0.85rem; /* Smaller list items */

    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.friends-list-left li:last-child {
    margin-bottom: 0;
}

.profile-user-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    background-color: var(--background-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.profile-username {
    font-size: 1.8rem;
    font-weight: bold;
}

/* Right section (favorites only) */
.profile-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Favorites section */
.favorites-section-container {
    width: 100%;
    margin-top: 20px; /* Add some space from the top */
}

.favorites-container {
    display: flex;
    flex-direction: column;
    gap: 30px; /* Space between books and authors sections */
}

.favorites-card {
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
}

.favorites-card-title {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--text-color);
    border-bottom: 2px solid var(--link-color);
    padding-bottom: 8px;
}

.favorites-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.favorite-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 120px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.favorite-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Style for clickable favorite item links */
.favorite-item-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    height: 100%;
}

.favorite-item-link:hover {
    text-decoration: none;
    color: inherit;
}

.favorite-item-image {
    width: 80px;
    height: 100px;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.favorite-author-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.favorite-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.favorite-item-author {
    font-size: 0.75rem;
    color: var(--text-color-secondary);
    margin-top: 4px;
    font-style: italic;
}

.favorites-empty-message {
    font-style: italic;
    color: var(--text-color-secondary);
    text-align: center;
    padding: 20px;
    margin: 0;
}

.friends-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.friends-list li {
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* User profile info styles */
.user-profile-info {
    margin-top: 0px; /* Remove top margin to eliminate gap with username */
    margin-bottom: 0px; /* Remove bottom margin to eliminate gap with friend request section */
    width: 100%; /* Take full width of parent container */
    word-wrap: break-word; /* Break long words if needed */
    overflow-wrap: break-word; /* Modern alternative for word wrapping */
}

.user-email,
.user-join-date,
.user-bio {
    margin: 3px 0; /* 3px between items that belong together */
    color: var(--text-color-secondary);
    font-size: 0.9rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.user-bio {
    margin-bottom: 10px; /* Extra spacing between bio and stats */
    color: var(--text-color); /* Make bio more visible with darker color */
    font-size: 1rem; /* Slightly larger font size */
}

/* Friend item styles */
.friend-item {
    display: flex;
    align-items: center;
}

.friend-link {
    display: flex;
    align-items: center;
    width: 100%;
    color: var(--text-color);
    text-decoration: none;
}

.friend-link:hover {
    color: var(--link-color);
}

.friend-avatar {
    margin-right: 10px;
}

.friend-name {
    font-weight: 500;
    font-size: 1.1rem; /* Bigger username */
}

.no-friends {
    color: var(--text-color-secondary);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Friend request section */
.friend-request-section {
    margin-top: 0px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.btn-send-friend-request,
.btn-remove-friend {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-send-friend-request {
    background: #007bff;
    color: var(--button-text-color);
}

.btn-send-friend-request:hover {
    background: #0056b3;
}

.btn-remove-friend {
    background: #dc3545;
    color: var(--button-text-color);
}

.btn-remove-friend:hover {
    background: #c82333;
}

/* Tab styles */
.profile-tab {
    font-size: 1rem !important;
    font-weight: 450 !important;
    padding: 12px 12px !important;
    background: var(--secondary-bg) !important;
    color: var(--text-color) !important;
    border: none !important;
    border-radius: 8px 8px 0 0 !important;
    margin-right: 5px;
    transition: background 0.2s;
}

.tab-section-title {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    margin-bottom: 15px !important;
}

.tab-empty-message {
    font-size: 1.1rem !important;
}

/* General profile text improvements */
.profile-username {
    font-size: 2.2rem !important;
}

.user-bio {
    font-size: 1.1rem !important;
    font-weight: 500 !important;
}

.user-email,
.user-join-date {
    font-size: 1rem !important;
    font-weight: 500 !important;
}


.favorites-card-title {
    font-size: 1.5rem !important;
}

/* Profile level badge */
.profile-level-badge {
    display: flex;
    justify-content: center;
}

.profile-level-badge .level-badge {
    background: linear-gradient(135deg, var(--link-color), var(--link-hover));
    color: var(--button-text-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.profile-level-badge .level-badge.level-5 {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.profile-level-badge .level-badge.level-10 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
}

/* Mobile Responsive Styles */
@media (max-width: 1024px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .profile-info {
        max-width: 100%;
        width: 100%;
        order: -1; /* Put profile info above tabs */
    }

    .profile-user-image {
        width: 120px;
        height: 120px;
        border-width: 2px;
    }

    .profile-username {
        font-size: 1.4rem;
    }

    .friends-section-left {
        margin-top: 15px;
        max-height: 150px; /* Reduce height on mobile */
        opacity: 0.8; /* Make less prominent */
        width: 100%; /* Full width on mobile */
        max-width: none; /* Remove max-width on mobile */
    }

    .friends-list-left {
        max-height: 120px; /* Smaller list height */
        padding: 8px; /* Less padding */
    }

    .friends-list-left li {
        font-size: 0.8rem; /* Smaller list items on mobile */
    }

    .profile-right {
        width: 100%;
        order: 1; /* Put tabs below profile info */
    }





    /* Mobile adjustments for favorites */
    .favorites-list {
        gap: 5px; /* Reduce gap between items */
        justify-content: center; /* Center the cards */
    }

    .favorite-item {
        width: 80px; /* Smaller card width */
        padding: 5px; /* Reduce padding */
    }

    .favorite-item-image {
        width: 60px; /* Smaller image */
        height: 80px; /* Maintain aspect ratio */
        margin-bottom: 4px; /* Reduce margin */
    }

    .favorite-author-image {
        width: 60px; /* Smaller author image */
        height: 60px; /* Square */
        margin-bottom: 4px; /* Reduce margin */
    }

    .favorite-item-title {
        font-size: 0.75rem; /* Smaller title */
        line-height: 1.2; /* Tighter line height */
    }

    .favorite-item-author {
        font-size: 0.65rem; /* Smaller author text */
        margin-top: 2px; /* Reduce margin */
    }

    /* Mobile styles for completed books */
    .completed-book-card {
        width: 80px !important; /* Smaller card width like favorites */
        height: 200px !important; /* Reduced height */
        padding: 5px !important; /* Less padding */
    }

    .completed-book-card .completed-book-cover {
        width: 60px !important; /* Smaller image */
        height: 80px !important; /* Maintain aspect ratio */
    }

    .completed-book-card h4 {
        font-size: 0.75rem !important; /* Smaller title */
        margin: 5px 0 0 0 !important; /* Less margin */
        line-height: 1.2 !important;
    }

    .completed-book-card div {
        font-size: 0.65rem !important; /* Smaller text */
        margin-top: 2px !important;
    }

    /* Mobile styles for completed books grid */
    .completed-books-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)) !important;
        gap: 5px !important; /* Smaller gap like favorites */
    }
}

/* Utility classes for inline styles */
.text-link { color: var(--link-color); }
.text-secondary { color: var(--text-color-secondary); }
.text-primary { color: var(--text-color); }
.text-muted { color: #6c757d; }
.bg-light { background-color: #f8f9fa; }
