/**
 * Profile Page Styles for NatureConnect
 *
 * This stylesheet handles:
 * - User profile components
 * - User cards and grids
 * - Profile tabs and sections
 * - Follow/following interactions
 * - Bio editing functionality
 */

/* User card text truncation */
.user-card .user-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.7em;
    line-height: 1.35em;
    word-break: break-word;
    white-space: normal;
}

/* Duplicate rule - removed in favor of consolidated styling */
.user-card .user-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.7em;
    line-height: 1.35em;
    word-break: break-word;
    white-space: normal;
}
/* Responsive flex grid for following/followers */
.user-grid.following-grid,
.user-grid.followers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    box-sizing: border-box;
    padding: 0.5rem 0;
    justify-content: space-evenly;
    width: 100%;
}

.user-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e0e0e0;
    padding: 1.25rem 1rem 1rem 1rem;
    width: 180px; /* Fixed width instead of min/max */
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: box-shadow 0.2s;
    position: relative;
    box-sizing: border-box;
}

.user-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border-color: #b3e5fc;
}

.user-avatar {
    width: 64px;
    height: 64px;
    margin-bottom: 0.75rem;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #b3e5fc;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.25rem 0 0.15rem 0;
    color: #222;
    text-align: center;
}

.user-handle {
    font-size: 0.95rem;
    color: #888;
    margin-bottom: 0.7rem;
    text-align: center;
}

.user-card .btn {
    margin-top: 0.3rem;
    width: 90%;
    font-size: 0.95rem;
    border-radius: 0.7rem;
    padding: 0.4rem 0;
    box-sizing: border-box;
}

/* Button state for when user is being followed */
.user-card .btn.following,
.btn.following {
    background-color: #3a7d44;
    color: #fff;
    border-color: #3a7d44;
}

/* Button hover state when already following - shows unfollow state */
.user-card .btn.following:hover,
.btn.following:hover {
    background-color: #d32f2f;
    border-color: #d32f2f;
}

.user-card .btn.following:hover .action-text {
    content: "Unfollow";
}

/* --- End moved from profile.php --- */
/* Responsive flex grid for following/followers */
.user-grid.following-grid,
.user-grid.followers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    box-sizing: border-box;
    padding: 0.5rem 0;
    justify-content: space-evenly;
    width: 100%;
}

/* User card styling (inherits from .user-card in style.css, but tweaks for grid) */
.user-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e0e0e0;
    padding: 1.25rem 1rem 1rem 1rem;
    min-width: 180px;
    max-width: 220px;
    flex: 1 1 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: box-shadow 0.2s, border-color 0.2s;
    box-sizing: border-box;
    margin-bottom: 0;
}

.user-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border-color: #b3e5fc;
}

.user-card .user-avatar {
    width: 64px;
    height: 64px;
    margin-bottom: 0.75rem;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #b3e5fc;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-card .user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-card .user-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.25rem 0 0.15rem 0;
    color: #222;
    text-align: center;
}

.user-card .user-handle {
    font-size: 0.95rem;
    color: #888;
    margin-bottom: 0.7rem;
    text-align: center;
}

.user-card .btn,
.user-card button.btn {
    margin-top: 0.3rem;
    width: 90%;
    font-size: 0.95rem;
    border-radius: 0.7rem;
    padding: 0.4rem 0;
    box-sizing: border-box;
    /* Use main button styles from style.css */
}

/* Link styles for user card */
.user-card-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
    cursor: pointer;
    padding-bottom: 0.5rem;
}

.user-card-link:hover {
    text-decoration: none;
    color: inherit;
}

.user-card-link:hover .user-name {
    color: #3a7d44;
}

.user-card-link:hover .user-avatar {
    border-color: #3a7d44;
    transform: scale(1.05);
}

.user-card-link:focus {
    outline: none;
}

.user-card .btn-follow {
    margin-top: auto;
    width: 90%;
    z-index: 1;
}

/* Profile bio editing styles */
#profileBioEdit {
    width: 100%;
    background-color: #f8f8f8 !important; /* Light subtle background */
    border-radius: 8px !important;
    padding: 12px !important;
    margin-top: 5px;
    border: 1px solid #e0e0e0 !important;
    box-shadow: none !important;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    color: #333 !important;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

#profileBioEdit:focus {
    background-color: #fff !important;
    border-color: #3a7d44 !important;
    outline: none;
}

.profile-bio {
    width: 100%;
}

/* Responsive tweaks for mobile */
@media (max-width: 767.98px) {
    .user-grid.following-grid,
    .user-grid.followers-grid {
        gap: 1rem;
        justify-content: center;
    }
    .user-card {
        min-width: 140px;
        max-width: 180px;
        padding: 1rem 0.5rem;
    }
    .user-card .user-avatar {
        width: 48px;
        height: 48px;
    }
    .user-card .user-name {
        font-size: 1rem;
    }
    .user-card .user-handle {
        font-size: 0.9rem;
    }
}
