/* =====================================================
   PROFILE V2 — Premium Redesign
   Aesthetic: Refined dark luxury, dating-app quality
   ===================================================== */

/* ── Font ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,500;0,9..40,700;1,9..40,400&display=swap');

/* ── Variables ── */
:root {
    --pv2-bg:             #0D0A0F;
    --pv2-surface:        #161218;
    --pv2-surface-2:      #1C1620;
    --pv2-border:         rgba(255,255,255,0.06);
    --pv2-border-focus:   rgba(233,30,99,0.45);
    --pv2-text:           #f0eef5;
    --pv2-text-2:         rgba(240,238,245,0.55);
    --pv2-text-3:         rgba(240,238,245,0.28);
    --pv2-accent:         #E91E63;
    --pv2-accent-soft:    rgba(233,30,99,0.12);
    --pv2-accent-glow:    rgba(233,30,99,0.35);
    --pv2-danger:         #ef4444;
    --pv2-radius:         14px;
    --pv2-radius-lg:      20px;
}

/* ── Suppress old profile styles that may leak from other CSS files ── */
#profileScreen .profile-top-card,
#profileScreen .profile-hero {
    display: none !important;
}

/* ── Screen base ── */
#profileScreen {
    background: var(--pv2-bg) !important;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

#profileScreen .profile-scroll-body {
    display: flex;
    flex-direction: column;
}

/* =====================================================
   HERO — Full-width portrait photo area (2:3 aspect)
   ===================================================== */

.pv2-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 68vh;
    min-height: 300px;
    overflow: hidden;
    cursor: pointer;
    background: var(--pv2-bg);
    -webkit-tap-highlight-color: transparent;
}

.pv2-hero-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    transition: opacity 0.5s ease, transform 0.4s ease;
}

/* Long, smooth fade from image into the dark page background */
.pv2-hero-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 40%,
        rgba(13,10,15,0.15) 55%,
        rgba(13,10,15,0.45) 70%,
        rgba(13,10,15,0.80) 85%,
        var(--pv2-bg) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* Upload progress overlay */
.pv2-upload-progress {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(13,10,15,0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 5;
}
.pv2-upload-progress.active {
    display: flex;
}
.pv2-upload-progress svg {
    width: 56px;
    height: 56px;
    transform: rotate(-90deg);
}
#profileUploadRing {
    transition: stroke-dashoffset 0.25s ease;
}

/* ── Empty state ── */
.pv2-hero-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 2;
    transition: opacity 0.35s ease;
}
.pv2-hero.has-photo .pv2-hero-empty {
    opacity: 0;
    pointer-events: none;
}

.pv2-hero-empty-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px dashed rgba(233,30,99,0.4);
    background: rgba(233,30,99,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(233,30,99,0.7);
    animation: pv2-pulse 2.5s ease-in-out infinite;
}
@keyframes pv2-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(233,30,99,0.25); }
    50%      { box-shadow: 0 0 0 14px rgba(233,30,99,0); }
}

.pv2-hero-empty-t {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    letter-spacing: 0.01em;
}
.pv2-hero-empty-s {
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

/* ── Change pill ── */
.pv2-hero-change {
    position: absolute;
    bottom: 60px;
    right: 16px;
    z-index: 3;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 16px 8px 12px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 24px;
    background: rgba(13,10,15,0.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.pv2-hero-change:active {
    transform: scale(0.95);
    background: rgba(233,30,99,0.25);
}
.pv2-hero.has-photo .pv2-hero-change {
    display: flex;
}

/* =====================================================
   IDENTITY CARD
   ===================================================== */

.pv2-identity {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 20px 8px;
    position: relative;
    z-index: 2;
    margin-top: -48px;
    background: transparent;
}

.pv2-identity-inner {
    flex: 1;
    min-width: 0;
}

.pv2-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--pv2-text);
    margin: 0;
    letter-spacing: -0.4px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pv2-email {
    display: block;
    font-size: 13px;
    color: var(--pv2-text-2);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Auto-save badge */
.pv2-autosave {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 4px 12px 4px 8px;
    border-radius: 20px;
    background: rgba(52,211,153,0.12);
    color: #34d399;
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}
.pv2-autosave.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Credits button */
.pv2-credits-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(135deg, #E91E63 0%, #d81557 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(233,30,99,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
    margin-top: 2px;
}
.pv2-credits-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(233,30,99,0.25);
}

/* =====================================================
   CONTENT AREA
   ===================================================== */

.pv2-content {
    padding: 16px 18px 110px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* =====================================================
   FORM
   ===================================================== */

.pv2-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: var(--pv2-surface);
    border: 1px solid var(--pv2-border);
    border-radius: var(--pv2-radius-lg);
    padding: 22px 18px 20px;
}

.pv2-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.pv2-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--pv2-text-2);
    padding-left: 2px;
}

.pv2-input {
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--pv2-radius);
    border: 1.5px solid var(--pv2-border);
    background: var(--pv2-surface-2);
    color: var(--pv2-text);
    font-size: 15px;
    font-family: inherit;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    box-sizing: border-box;
}
.pv2-input::placeholder {
    color: var(--pv2-text-3);
}
.pv2-input:focus {
    border-color: var(--pv2-border-focus);
    box-shadow: 0 0 0 3px rgba(233,30,99,0.08);
}

.pv2-input--disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pv2-textarea {
    resize: none;
    min-height: 80px;
    line-height: 1.5;
}

/* Save button */
.pv2-save-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--pv2-radius);
    background: linear-gradient(135deg, #E91E63, #d81557);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
    box-shadow: 0 4px 16px rgba(233,30,99,0.3);
    -webkit-tap-highlight-color: transparent;
    margin-top: 4px;
}
.pv2-save-btn:active {
    transform: scale(0.97);
}
.pv2-save-btn.saving {
    opacity: 0.6;
    pointer-events: none;
}

/* =====================================================
   MENU GROUPS
   ===================================================== */

.pv2-menu-group {
    background: var(--pv2-surface);
    border: 1px solid var(--pv2-border);
    border-radius: var(--pv2-radius-lg);
    overflow: hidden;
}

.pv2-menu-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--pv2-border);
    -webkit-tap-highlight-color: transparent;
}
.pv2-menu-row:last-child {
    border-bottom: none;
}
.pv2-menu-row:active {
    background: rgba(255,255,255,0.03);
}

.pv2-menu-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--pv2-text-2);
}
.pv2-menu-icon svg {
    stroke: currentColor;
}
.pv2-menu-icon--pink {
    background: var(--pv2-accent-soft);
    color: var(--pv2-accent);
}
.pv2-menu-icon--muted {
    background: rgba(255,255,255,0.04);
    color: var(--pv2-text-3);
}
.pv2-menu-icon--danger {
    background: rgba(239,68,68,0.1);
    color: var(--pv2-danger);
}

.pv2-menu-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pv2-menu-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--pv2-text);
}
.pv2-menu-desc {
    font-size: 12px;
    color: var(--pv2-text-3);
}

.pv2-menu-row--danger .pv2-menu-label {
    color: var(--pv2-danger);
}
.pv2-menu-row--danger .pv2-menu-desc {
    color: rgba(239,68,68,0.5);
}

.pv2-menu-chevron {
    stroke: var(--pv2-text-3);
    flex-shrink: 0;
}
.pv2-menu-row--danger .pv2-menu-chevron {
    stroke: rgba(239,68,68,0.4);
}

/* =====================================================
   FOOTER
   ===================================================== */

.pv2-footer {
    text-align: center;
    padding: 8px 0 4px;
}
.pv2-footer-ver {
    font-size: 11px;
    color: var(--pv2-text-3);
    margin: 0 0 3px;
}
.pv2-footer-tag {
    font-size: 12px;
    color: var(--pv2-text-2);
    margin: 0;
}

/* =====================================================
   ANIMATIONS
   ===================================================== */

@keyframes pv2-fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pv2-identity  { animation: pv2-fadeUp 0.4s ease-out both; }
.pv2-form      { animation: pv2-fadeUp 0.45s ease-out 0.05s both; }
.pv2-menu-group:nth-child(2) { animation: pv2-fadeUp 0.45s ease-out 0.10s both; }
.pv2-menu-group:nth-child(3) { animation: pv2-fadeUp 0.45s ease-out 0.15s both; }
.pv2-menu-group:nth-child(4) { animation: pv2-fadeUp 0.45s ease-out 0.20s both; }

/* =====================================================
   MOBILE TWEAKS
   ===================================================== */

@media (max-width: 380px) {
    .pv2-hero {
        max-height: 60vh;
        min-height: 260px;
    }
    .pv2-name {
        font-size: 21px;
    }
    .pv2-credits-btn {
        padding: 9px 14px;
        font-size: 12px;
    }
    .pv2-form {
        padding: 18px 14px 16px;
    }
}

@media (min-width: 500px) {
    .pv2-hero {
        max-height: 60vh;
    }
    .pv2-content {
        max-width: 460px;
        margin: 0 auto;
        width: 100%;
    }
    .pv2-identity {
        max-width: 460px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }
}

/* =====================================================
   REDUCED MOTION
   ===================================================== */

@media (prefers-reduced-motion: reduce) {
    .pv2-identity,
    .pv2-form,
    .pv2-menu-group,
    .pv2-hero-empty-ring,
    .pv2-autosave {
        animation: none !important;
        transition: none !important;
    }
}
