/* ===========================================
   Vibe In Pocket - Profile Page Styles
   User profile editing and display
   =========================================== */

/* ============ Page Layout ============ */
.profile-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #0a1628 0%, #134e6f 50%, #1a7a9e 100%);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ============ Ocean Background ============ */
.ocean-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.ocean-bg .wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 200px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'%3E%3Cpath fill='rgba(255,255,255,0.08)' d='M0,60 C300,120 600,0 900,60 C1200,120 1200,120 1200,120 L0,120 Z'/%3E%3C/svg%3E") repeat-x;
    animation: wave-move 15s linear infinite;
}

.ocean-bg .wave-1 { bottom: 0; animation-duration: 12s; opacity: 0.6; }
.ocean-bg .wave-2 { bottom: 30px; animation-duration: 18s; opacity: 0.4; animation-direction: reverse; }
.ocean-bg .wave-3 { bottom: 60px; animation-duration: 24s; opacity: 0.2; }

@keyframes wave-move {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ============ Navigation ============ */
.profile-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(10, 22, 40, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.nav-logo .logo-icon {
    font-size: 1.5rem;
}

.nav-logo .logo-accent {
    background: linear-gradient(135deg, #ff6b9d 0%, #ff9f43 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: white;
}

.nav-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 107, 157, 0.3);
    border-color: #ff6b9d;
}

/* ============ Main Container ============ */
.profile-container {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    padding: 100px 1.5rem 3rem;
}

/* ============ Loading State ============ */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: rgba(255, 255, 255, 0.7);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #06b6d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* ============ Auth Required ============ */
.auth-required {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.auth-card {
    text-align: center;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.auth-card h2 {
    color: white;
    margin-bottom: 0.5rem;
}

.auth-card p {
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1.5rem;
}

/* ============ Profile Card ============ */
.profile-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: card-enter 0.5s ease-out;
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ Profile Picture Section ============ */
.profile-picture-section {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.2) 0%, transparent 100%);
}

.profile-picture-container {
    position: relative;
    width: 150px;
    height: 150px;
    cursor: pointer;
}

.profile-picture {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.profile-picture-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.profile-picture-container:hover .profile-picture-overlay {
    opacity: 1;
}

.profile-picture-container:hover .profile-picture {
    border-color: #06b6d4;
}

.overlay-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.overlay-text {
    font-size: 0.8rem;
    color: white;
    font-weight: 500;
}

.picture-hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ============ Default Profile Pics Section ============ */
.default-pics-section {
    margin-top: 1.5rem;
    width: 100%;
    max-width: 320px;
}

.default-pics-title {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-bottom: 1rem;
}

.default-pics-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.default-pic-btn {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    overflow: visible; /* Allow checkmark to overflow outside circle */
    cursor: pointer;
    background: transparent;
    transition: all 0.3s ease;
}

.default-pic-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    clip-path: circle(50%); /* Clip image to circle */
    background: rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

.default-pic-btn:hover {
    border-color: rgba(6, 182, 212, 0.6);
    transform: scale(1.08);
    z-index: 1;
}

.default-pic-btn:hover img {
    transform: scale(1.05);
}

.default-pic-btn.selected {
    border-color: #ff6b9d;
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.3);
}

.default-pic-btn.selected::after {
    content: '✓';
    position: absolute;
    bottom: -4px;  /* Position outside the circle */
    right: -4px;   /* Position outside the circle */
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ff9f43 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    border: 2px solid rgba(13, 33, 55, 0.9); /* Dark border to separate from pic */
    z-index: 2; /* Ensure checkmark is above everything */
    font-weight: bold;
}

/* ============ Profile Info Section ============ */
.profile-info-section {
    padding: 2rem;
}

.profile-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.profile-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.profile-email {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ============ Social Stats (Following/Followers) ============ */
.social-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.social-stat-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 12px;
}

.social-stat-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.social-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff6b9d;
}

.social-stat-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.social-stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
}

/* ============ Activity Stats ============ */
.profile-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #06b6d4;
}

.stat-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ============ Profile Form ============ */
.profile-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.5rem;
}

.label-hint {
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

.input-hint {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    resize: none;
    box-sizing: border-box;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #06b6d4;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

/* ============ Bio Character Counter ============ */
.bio-counter-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.bio-counter {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    min-width: 30px;
    text-align: right;
    transition: color 0.3s ease;
}

.bio-counter.warning {
    color: #22c55e; /* Green for 90-99 */
}

.bio-counter.exact {
    color: rgba(255, 255, 255, 0.5); /* Grey for exactly 0 */
}

.bio-counter.exceeded {
    color: #ef4444; /* Red for over limit */
}

.bio-counter-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ============ Topics Selection ============ */
.topics-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.topic-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.topic-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.topic-chip.selected {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.3) 0%, rgba(255, 159, 67, 0.3) 100%);
    border-color: #ff6b9d;
}

.topic-chip.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.topic-chip.disabled:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.topic-icon {
    font-size: 1rem;
}

.topic-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
}

.topics-counter {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

#topicsCount {
    font-weight: 600;
    color: #ff6b9d;
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(6, 182, 212, 0.4);
}

.btn-full {
    width: 100%;
}

.btn-loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============ Member Since ============ */
.member-since {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============ Social Modal (Following/Followers) ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: modal-fade-in 0.2s ease-out;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.social-modal {
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    background: rgba(13, 33, 55, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    animation: modal-slide-up 0.3s ease-out;
}

@keyframes modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-tab {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.modal-tab:hover {
    color: rgba(255, 255, 255, 0.8);
}

.modal-tab.active {
    color: white;
}

.modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ff9f43 100%);
}

.modal-content {
    max-height: 400px;
    overflow-y: auto;
}

/* ============ User List ============ */
.user-list {
    padding: 0.5rem;
}

.user-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.user-list-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-list-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.user-list-info {
    flex: 1;
    min-width: 0;
}

.user-list-name {
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-list-username {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.follow-btn {
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.follow-btn.follow {
    background: linear-gradient(135deg, #ff6b9d 0%, #ff9f43 100%);
    border: none;
    color: white;
}

.follow-btn.follow:hover {
    transform: scale(1.05);
}

.follow-btn.unfollow {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.follow-btn.unfollow:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-list-empty {
    text-align: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.5);
}

.user-list-empty .empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* ============ Toast Container ============ */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    animation: toast-enter 0.3s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes toast-enter {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-exit {
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

.toast-success { border-left: 3px solid #22c55e; }
.toast-error { border-left: 3px solid #ef4444; }
.toast-info { border-left: 3px solid #06b6d4; }

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

/* ============ Utilities ============ */
.hidden {
    display: none !important;
}

/* ============ Responsive ============ */
@media (max-width: 480px) {
    .profile-nav {
        padding: 1rem;
    }
    
    .nav-links a:not(:last-child) {
        display: none;
    }
    
    .profile-container {
        padding: 80px 1rem 2rem;
    }
    
    .profile-picture-container {
        width: 120px;
        height: 120px;
    }
    
    .profile-stats {
        gap: 1rem;
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .social-stats {
        flex-direction: row;
    }
    
    .social-stat-divider {
        width: 1px;
        height: 30px;
    }
    
    .topic-chip {
        padding: 0.4rem 0.7rem;
    }
    
    .topic-name {
        font-size: 0.8rem;
    }
}
