/* Meetgle Profile Modal Styles */

/* Hide scrollbar on profile modal while keeping it scrollable */
.profile-modal-content {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}
.profile-modal-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Hide scrollbar on edit profile modal while keeping it scrollable */
.edit-profile-modal-content {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}
.edit-profile-modal-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.meetgle-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

/* ── Shared modal header primitives (Phase 2: one source so every modal's title
   + close button render pixel-identical). Applied to the centered chat-page
   modals. NOTE: distinct from `.meetgle-modal-close` below, which is the profile
   modal's own absolute close button.
   !important is REQUIRED: these were inline styles before (inline beats Elementor's
   external button/h2 styles); as a class they'd otherwise lose to Elementor's
   default button background (showed up as a pink close button) and h2 typography. ── */
.mg-mtitle {
    color: #fff !important;
    margin: 0 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    line-height: 1.2 !important;
}
.mg-mclose {
    flex-shrink: 0;
    width: 32px !important;
    height: 32px !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.mg-mclose:hover,
.mg-mclose:focus {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

.meetgle-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.meetgle-modal-content {
    background: white;
    border-radius: 16px;
    padding: 0;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.meetgle-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    line-height: 0;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-weight: 300;
}

.meetgle-modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.meetgle-modal-close:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

.meetgle-profile-modal-body {
    padding: 0;
}

/* Loading State */
.meetgle-profile-loading {
    text-align: center;
    padding: 48px 20px;
}

/* Dark loading text for profile modal */
.profile-modal-content .meetgle-profile-loading p {
    color: rgba(255,255,255,0.35);
    font-size: 13px;
    margin: 0;
}

/* Dark loading text for edit profile modal */
.edit-profile-modal-content .meetgle-profile-loading p {
    color: rgba(255,255,255,0.4);
    font-size: 14px;
}

/* Light loading text fallback */
.meetgle-profile-loading p {
    color: #6b7280;
    font-size: 14px;
}

/* Spinner for edit profile / send sparks (light theme) */
.profile-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: var(--theme-button-primary, #8b5cf6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

/* Edit profile avatar upload */
.edit-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
    display: block;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}
.edit-avatar-img {
    width: 90px !important;
    height: 90px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
    border: 3px solid rgba(255,255,255,0.15) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3) !important;
    transition: opacity 0.2s;
}
.edit-avatar-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 50%;
}
.edit-avatar-wrap:hover .edit-avatar-overlay,
.edit-avatar-wrap:active .edit-avatar-overlay {
    opacity: 1;
}
/* Always show overlay on touch devices */
@media (hover: none) {
    .edit-avatar-overlay {
        opacity: 1;
        background: rgba(0,0,0,0.3);
    }
}

/* Dark glass input styling for edit profile */
.edit-profile-modal-content input,
.edit-profile-modal-content select,
.edit-profile-modal-content textarea {
    box-sizing: border-box;
}

.edit-profile-modal-content input:focus,
.edit-profile-modal-content select:focus,
.edit-profile-modal-content textarea:focus {
    outline: none;
    border-color: rgba(255,200,61,0.45) !important;
}

.edit-profile-modal-content input::placeholder,
.edit-profile-modal-content textarea::placeholder {
    color: rgba(255,255,255,0.3);
}

/* Dark select option styling */
.edit-profile-modal-content select option {
    background: #1c1c22;
    color: white;
}

/* Dark error for edit profile modal */
.edit-profile-modal-content .meetgle-profile-error {
    color: #EF4444;
}

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

/* Error State */
.meetgle-profile-error {
    text-align: center;
    padding: 40px 20px;
}

/* Dark error for profile modal */
.profile-modal-content .meetgle-profile-error {
    color: #EF4444;
}

/* (edit profile error styling is above with dark glass rules) */

/* Profile Content - these are used by edit profile modal (keep for backwards compat) */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #f3f4f6;
}

.profile-header-info {
    flex: 1;
}

.profile-header-info h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: #111827;
}

/* Profile Badges */
.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    vertical-align: middle;
}

.profile-badge.verified {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
}

.profile-badge.premium {
    background: rgba(251, 191, 36, 0.4);
    color: white;
    border: 2px solid rgba(251, 191, 36, 0.6);
    backdrop-filter: blur(10px);
}

.profile-badge.gender {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(10px);
    font-size: 14px;
}

.profile-badge.external {
    background: rgba(251, 191, 36, 0.4);
    color: white;
    border: 2px solid rgba(251, 191, 36, 0.6);
    backdrop-filter: blur(10px);
}

/* Profile Sections */
.profile-section {
    margin-bottom: 16px;
}

.profile-section:last-child {
    margin-bottom: 0;
}

.profile-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #111827;
    font-weight: 600;
}

.profile-section p {
    margin: 0;
    color: #4b5563;
    line-height: 1.6;
}

.profile-section p em {
    color: #9ca3af;
    font-style: italic;
}

/* Interests (base - used by edit profile) */
.profile-interests {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Dark glass interest tags for edit profile modal */
.edit-profile-modal-content .profile-interest-tag {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
}

.edit-profile-modal-content .profile-interest-tag:hover {
    transform: none;
    box-shadow: none;
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #EF4444;
}

/* Light theme interest tags (public profile view) */
.profile-interest-tag {
    padding: 8px 16px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--theme-button-primary, #8b5cf6) 15%, white) 0%,
        color-mix(in srgb, var(--theme-button-primary, #8b5cf6) 25%, white) 100%
    );
    border: 2px solid color-mix(in srgb, var(--theme-button-primary, #8b5cf6) 50%, white);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: color-mix(in srgb, var(--theme-button-primary, #8b5cf6) 85%, black);
    transition: all 0.2s ease;
}

.profile-interest-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--theme-button-primary, #8b5cf6) 20%, transparent);
}

/* Stats Grid (used by old layout, kept for backwards compat) */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.profile-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    background: #f9fafb;
    border-radius: 16px;
    border: 2px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.profile-stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.stat-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

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

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 2px;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Mobile fullscreen - Send Sparks */
@media (max-width: 900px) {
    #sendSparksModal { padding: 0 !important; }
    #sendSparksModal > .send-sparks-modal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100svh !important;
        max-height: 100vh !important;
        max-height: 100svh !important;
        border-radius: 0 !important;
    }
}

/* Mobile fullscreen - Edit Profile */
@media (max-width: 900px) {
    #meetgleEditProfileModal { padding: 0 !important; }
    #meetgleEditProfileModal > .edit-profile-modal-content {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100svh !important;
        max-height: 100vh !important;
        max-height: 100svh !important;
        border-radius: 0 !important;
    }
}

/* Photo Viewer Loading State */
.photo-viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 5;
}

.photo-viewer-loading .profile-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: rgba(255,255,255,0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.photo-viewer-loading span {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-weight: 500;
}

/* Hide image while loading in photo viewer */
#photoViewerImage.loading {
    opacity: 0;
}

#photoViewerImage {
    transition: opacity 0.2s ease;
}

/* ============================================================
   Edit Profile modal — flat Stage design (.epf-*). Surface #141417,
   fixed header · scrollable body · sticky Save footer. Form controls are
   scoped under .edit-profile-modal-content with !important so theme/Elementor
   input/button styling can't override them (the old markup used inline styles).
   ============================================================ */

/* loading overlay spinner + text */
.edit-profile-modal-content .epf-spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1); border-top-color: rgba(255,255,255,0.6); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 16px; }
.edit-profile-modal-content .epf-loading-txt { margin: 0; color: rgba(255,255,255,0.45); font-size: 14px; font-weight: 500; }

/* header / body / footer */
/* header scrolls with the body (no fixed bar / divider) — matches the other modals */
.epf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.epf-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px; scrollbar-width: none; -ms-overflow-style: none; }
.epf-body::-webkit-scrollbar { display: none; }
.epf-foot { flex: none; padding: 14px 24px 18px; border-top: 1px solid rgba(255,255,255,0.06); background: #141417; }

/* avatar */
.epf-avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.epf-avatar-wrap { position: relative; flex: none; cursor: pointer; display: block; width: 76px; height: 76px; -webkit-tap-highlight-color: transparent; }
.edit-profile-modal-content .epf-avatar { width: 76px !important; height: 76px !important; border-radius: 50% !important; object-fit: cover !important; display: block !important; border: 2px solid rgba(255,255,255,0.12) !important; box-shadow: none !important; transition: border-color 0.16s; }
.epf-avatar-wrap:hover .epf-avatar { border-color: rgba(255,255,255,0.25) !important; }
.epf-avatar-badge { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--button-color, #ff2e68); border: 3px solid #141417; display: grid; place-items: center; color: #fff; }
.epf-avatar-badge svg { width: 14px; height: 14px; }
.epf-avatar-meta .nm { font-size: 18px; font-weight: 800; color: #fff; }
.epf-avatar-meta .hint { font-size: 12.5px; color: rgba(255,255,255,0.4); margin-top: 3px; }

/* fields */
.epf-field { margin-bottom: 18px; }
.epf-field:last-child { margin-bottom: 0; }
.epf-label { display: block; color: rgba(255,255,255,0.5); font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; margin: 0 0 8px; }
.epf-hint { color: rgba(255,255,255,0.35); font-size: 12px; margin: -3px 0 9px; line-height: 1.45; }

/* form controls — theme-proofed */
.edit-profile-modal-content .epf-input,
.edit-profile-modal-content .epf-select,
.edit-profile-modal-content .epf-textarea {
    width: 100% !important;
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 12px !important;
    padding: 12px 14px !important;
    font-family: inherit !important;
    font-size: 14px !important;
    color: #fff !important;
    outline: none !important;
    box-shadow: none !important;
    transition: border-color .16s, background .16s;
}
.edit-profile-modal-content .epf-textarea { min-height: 92px !important; resize: vertical !important; line-height: 1.5 !important; }
.edit-profile-modal-content .epf-select { -webkit-appearance: none !important; appearance: none !important; cursor: pointer; padding-right: 38px !important;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%2212%22 viewBox=%220 0 12 12%22%3E%3Cpath fill=%22rgba(255,255,255,0.4)%22 d=%22M2 4l4 4 4-4%22/%3E%3C/svg%3E'); background-repeat: no-repeat; background-position: right 14px center; }
.edit-profile-modal-content input[type=date].epf-input { color-scheme: dark; cursor: pointer; }
/* focus AFTER base so the gold border wins (both !important) */
.edit-profile-modal-content .epf-input:focus,
.edit-profile-modal-content .epf-select:focus,
.edit-profile-modal-content .epf-textarea:focus { border-color: rgba(255,200,61,0.45) !important; background: rgba(255,255,255,0.06) !important; }

/* two-column group */
.epf-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* gender selector — theme-proofed buttons */
.epf-gender { display: flex; gap: 10px; }
.edit-profile-modal-content .epf-gender-btn {
    flex: 1; background: rgba(255,255,255,0.04) !important; border: 1px solid rgba(255,255,255,0.08) !important; border-radius: 12px !important;
    padding: 14px !important; cursor: pointer; display: flex !important; flex-direction: column; align-items: center; gap: 7px;
    transition: border-color .16s, background .16s, color .16s; color: rgba(255,255,255,0.4) !important; font-family: inherit; box-shadow: none !important;
}
.epf-gender-btn svg { width: 24px; height: 24px; }
.epf-gender-btn .lbl { font-size: 13px; font-weight: 700; }
.edit-profile-modal-content .epf-gender-btn:hover { border-color: rgba(255,255,255,0.16) !important; background: rgba(255,255,255,0.06) !important; }
.edit-profile-modal-content .epf-gender-btn.selected.male { border-color: rgba(56,151,240,0.45) !important; background: rgba(56,151,240,0.12) !important; color: #7bbcff !important; }
.edit-profile-modal-content .epf-gender-btn.selected.female { border-color: rgba(255,46,104,0.45) !important; background: rgba(255,46,104,0.12) !important; color: #ff7aa3 !important; }

/* bio counter */
.epf-counter { text-align: right; font-size: 11px; color: rgba(255,255,255,0.35); margin-top: 5px; }

/* interest chips */
.epf-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.edit-profile-modal-content .epf-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,200,61,0.12); border: 1px solid rgba(255,200,61,0.25); color: #ffc83d; font-size: 12.5px; font-weight: 600; padding: 5px 8px 5px 12px; border-radius: 999px; cursor: pointer; transition: background .16s; user-select: none; }
.edit-profile-modal-content .epf-chip:hover { background: rgba(255,200,61,0.2); }
.epf-chip .x { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: rgba(0,0,0,0.18); font-size: 12px; line-height: 1; }

/* premium photos card */
.epf-photos { display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; padding: 14px 16px; cursor: pointer; transition: background .16s, border-color .16s; }
.epf-photos:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.15); }
.epf-photos-ic { width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center; background: rgba(255,46,104,0.12); color: #ff7aa3; }
.epf-photos-ic svg { width: 21px; height: 21px; }
.epf-photos-main { flex: 1; min-width: 0; }
.epf-photos-t { color: #fff; font-size: 14px; font-weight: 700; }
.epf-photos-d { color: rgba(255,255,255,0.4); font-size: 12px; margin-top: 2px; }
.epf-photos-chev { color: rgba(255,255,255,0.3); flex: none; display: inline-flex; }
.epf-photos-chev svg { width: 18px; height: 18px; }

/* sticky save button — pink primary, theme-proofed */
.edit-profile-modal-content .epf-save {
    width: 100% !important; border: 0 !important; border-radius: 14px !important; padding: 14px !important; font-family: inherit !important;
    font-size: 15px !important; font-weight: 800 !important; cursor: pointer; color: #fff !important;
    background: var(--button-color, #ff2e68) !important; box-shadow: 0 10px 26px -10px var(--accent-glow, rgba(255,46,104,0.45)) !important;
    text-transform: none !important; letter-spacing: normal !important; transition: filter .16s;
}
.edit-profile-modal-content .epf-save:hover,
.edit-profile-modal-content .epf-save:focus { background: var(--button-color, #ff2e68) !important; color: #fff !important; filter: brightness(1.06); }

/* responsive: 2-col → 1-col */
@media (max-width: 560px) {
    .epf-grid2 { grid-template-columns: 1fr; }
}
