
/* ui/profile/menu.css */

/* --- Wrapper for User Card & Carousel --- */
#user-profile-wrapper {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1005; /* Increased z-index */
    transform: translateY(100%); /* Initially fully hidden */
    /* Added visibility transition to prevent click blocking when hidden */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.4s;
    visibility: hidden;
    pointer-events: none; 
    display: flex;
    flex-direction: column;
}
#user-profile-wrapper.visible {
    transform: translateY(0); /* Slides fully into view */
    visibility: visible;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s;
}

/* CRITICAL FIX: Only enable pointer events on children when the wrapper itself is visible.
   This prevents invisible layers from blocking map interactions. */
#user-profile-wrapper.visible > * {
    pointer-events: auto; 
}

/* User Profile Card Container */
#user-profile-card-container {
    position: relative;
    height: 150px; /* Initial collapsed state height */
    touch-action: none; 
    transform: translateZ(0);
    flex-shrink: 0;
}
#user-profile-card-container.expanded {
    height: 85vh;
}

.user-profile-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    overflow: hidden;
    background: #1c1c1e;
    padding-bottom: env(safe-area-inset-bottom); /* <<< FIX: Add padding to the card itself */
}

/* Gradient overlay for collapsed card */
.user-profile-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(28,28,30, 1) 10%, rgba(28,28,30, 0.8) 50%, transparent 100%);
    z-index: 5; /* Above photo, below text */
    pointer-events: none; /* Make sure it doesn't block clicks */
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Hide the collapsed gradient when the card is expanded */
#user-profile-card-container.expanded .user-profile-card::after {
    opacity: 0;
}

#user-profile-card-container.expanded .content-header-collapsed {
    opacity: 0;
}

.dragger-handle {
    position: absolute; top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 5px;
    background: rgba(255,255,255,0.3);
    border-radius: 2.5px; z-index: 20;
}

.user-card-photo {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background-size: cover; background-position: center;
    z-index: 1;
}

.card-badges-right {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.content-header-collapsed {
    position: absolute;
    bottom: 30px;
    left: 20px;
    right: 20px;
    z-index: 15;
    opacity: 1;
    transition: opacity 0.2s ease;
    color: white;
    pointer-events: none; 
}
.content-header-collapsed .name-and-badge-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.user-card-name-collapsed { font-size: 2rem; font-weight: 700; margin: 0; line-height: 1.2; overflow-wrap: break-word; }

.user-card-status-collapsed {
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100vw - 80px); /* Adjust for padding */
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    display: none; /* Hide by default */
}

.card-bottom-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 20px;
    /* <<< FIX: Remove safe area padding from here */
    background: linear-gradient(to top, rgba(28,28,30, 1) 10%, rgba(28,28,30, 0.8) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
#user-profile-card-container.expanded .card-bottom-content {
    opacity: 1;
    pointer-events: auto;
}

.content-header-expanded {
    flex-shrink: 0;
}
.user-card-name-expanded {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    color: white;
    overflow-wrap: break-word;
}

.user-card-name-container {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#user-profile-card-container.expanded .user-card-name-container {
    opacity: 1;
    pointer-events: auto;
}

.user-card-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.card-top-left-info {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.district-and-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-card-district-container-absolute {
    position: static; /* No longer absolute positioned */
    display: none; 
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    transition: background 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0;
}

.user-card-district-container-absolute.online {
    background: linear-gradient(45deg, rgba(29, 185, 84, 0.65), rgba(83, 214, 131, 0.65));
    border-color: rgba(255, 255, 255, 0.6);
}

.user-card-online-status-container {
    display: none; /* Managed by JS */
    color: white;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    font-size: calc(1rem / 1.5);
    font-weight: 500;
    white-space: nowrap;
}

.user-card-district {
    font-size: calc(1rem / 1.5);
    font-weight: 500;
    color: white;
    overflow-wrap: break-word;
}

.name-and-badge-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-card-vip-badge {
    display: none;
    align-items: center;
    background: var(--vip-gradient, linear-gradient(135deg, #FF4D4D, #FFA1A1));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 4px 12px;
    border-radius: 16px;
}

.user-card-vip-badge span {
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 1rem;
    line-height: 1.5;
}

.user-card-mayor-badge {
    display: none;
    padding: 4px 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: linear-gradient(45deg, #3b82f6, #60a5fa);
}

.user-card-mayor-badge span {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    line-height: 1.5;
}

.user-card-age-container {
    display: none;
    width: fit-content;
}
.user-card-age-expanded {
    font-size: 1rem;
    font-weight: 500;
    color: white;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.user-details { color: white; margin-top: 1rem; }
.user-details-fixed {
    margin-bottom: 0;
}
.goal-label {
    font-size: 0.9rem; text-transform: uppercase;
    letter-spacing: 1px; color: rgba(255,255,255,0.6);
    margin: 0;
}
.user-goal-expanded { font-size: 1.2rem; font-weight: 500; margin: 4px 0 0; overflow-wrap: break-word; }

.mood-and-pet-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
    width: 100%;
}
.card-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.about-me-button {
    width: auto;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    padding: 12px 20px;
    border-radius: 50px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s;
}
.about-me-button:hover { background: rgba(255, 255, 255, 0.2); }

.extra-photos-badge {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 16px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: background-color 0.2s;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.extra-photos-badge:hover { background-color: rgba(255, 255, 255, 0.2); }

.like-btn, .chat-btn, .avatar-btn, .gift-btn, .card-pet-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
    color: white;
    flex-shrink: 0;
    text-decoration: none; /* For <a> tag */
}
.like-btn:hover, .chat-btn:hover, .avatar-btn:hover, .gift-btn:hover, .card-pet-toggle-btn:hover { background: rgba(255, 255, 255, 0.2); }
.chat-btn svg, .chat-btn img, .avatar-btn img, .gift-btn img, .card-pet-toggle-btn img { width: 24px; height: 24px; filter: brightness(0) invert(1); }
.like-btn img {
    width: 34px;
    height: 34px;
    filter: brightness(0) invert(1);
}
.like-btn.liked {
    background: #ff453a;
    border-color: rgba(255, 255, 255, 0.4);
}

.user-card-likes-container {
    display: none; /* Hidden by default */
    align-items: center;
    gap: 6px;
    background: rgba(255, 69, 58, 0.8); /* Red like color */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 4px 10px;
    border-radius: 50px;
    color: white;
    font-size: 0.8rem;
}
.user-card-likes-container .like-count {
    font-weight: 700;
}
.user-card-likes-container .heart-icon {
    width: 14px;
    height: 14px;
    fill: white;
}