/* 
   👤 APEX PROFILE - Premium Mobile Experience V2
   Refined Layout: Stacked Hero, Centered Info, Fixed Scroll
*/

:root {
    --ap-bg: #000000;
    --ap-card-bg: #111111;
    --ap-surface: #1c1c1e;
    --ap-primary: #ec4899;
    --ap-secondary: #3b82f6;
    --ap-text: #ffffff;
    --ap-text-dim: rgba(255, 255, 255, 0.5);
    --ap-border: rgba(255, 255, 255, 0.1);
}

/* 🔓 FORCE SCROLL UNLOCK */
html,
body {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh !important;
    -webkit-overflow-scrolling: touch !important;
}

.app-wrapper {
    overflow: visible !important;
    height: auto !important;
    position: relative !important;
}

.ap-container {
    padding-bottom: 90px;
    background: var(--ap-bg);
    min-height: 100vh;
    overflow-y: visible !important;
}

/* --- HERO SECTION (REMASTERED) --- */
.ap-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.ap-cover {
    width: 100%;
    height: 150px;
    object-fit: cover;
    opacity: 0.6;
    mask-image: linear-gradient(to bottom, black 20%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 20%, transparent 100%);
}

.ap-profile-info {
    position: relative;
    width: 100%;
    margin-top: -100px;
    /* Pull up to overlap cover */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    text-align: center;
    z-index: 2;
}

.ap-avatar-container {
    position: relative;
}

.ap-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 5px solid var(--ap-bg);
    /* Seamless blend with bg */
    background: #222;
    object-fit: cover;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.ap-edit-badge {
    position: absolute;
    bottom: 5px;
    right: 0;
    background: var(--ap-surface);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--ap-bg);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.ap-names {
    width: 100%;
    margin-top: 5px;
}

.ap-fullname {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 5px;
}

.ap-username {
    font-size: 14px;
    color: var(--ap-text-dim);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ap-level-badge {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    color: #000;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

/* --- STATS ROW --- */
.ap-stats-row {
    display: flex;
    justify-content: space-around;
    padding: 18px 10px;
    margin: 15px 20px 25px 20px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 20px;
    border: 1px solid var(--ap-border);
}

.ap-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ap-stat-val {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}

.ap-stat-label {
    font-size: 10px;
    color: var(--ap-text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* --- GAMIFICATION --- */
.ap-xp-container {
    padding: 0 30px;
    margin-bottom: 25px;
}

.ap-xp-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--ap-text-dim);
    margin-bottom: 8px;
    font-weight: 700;
}

.ap-xp-bar-bg {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.ap-xp-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--ap-primary), var(--ap-secondary));
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.4);
}

/* --- TABS --- */
.ap-tabs {
    display: flex;
    border-bottom: 1px solid var(--ap-border);
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 100;
    padding-top: 5px;
}

.ap-tab {
    flex: 1;
    text-align: center;
    padding: 15px 0;
    color: var(--ap-text-dim);
    font-size: 13px;
    font-weight: 600;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.ap-tab i {
    font-size: 18px;
    margin-bottom: 4px;
    display: block;
}

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

.ap-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 3px;
    background: white;
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -2px 10px rgba(255, 255, 255, 0.5);
}

/* --- GRID CONTENT --- */
.ap-content-area {
    padding: 2px;
    min-height: 50vh;
}

.ap-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.ap-post-card {
    position: relative;
    aspect-ratio: 1/1;
    background: #222;
    overflow: hidden;
    cursor: pointer;
}

.ap-post-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.ap-post-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    align-items: flex-end;
    padding: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.ap-post-stats {
    font-size: 10px;
    color: white;
    font-weight: 700;
    display: flex;
    gap: 8px;
}

/* --- SETTINGS SHEET --- */
.ap-settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

.ap-settings-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.ap-settings-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70vh;
    background: #1c1c1e;
    border-radius: 25px 25px 0 0;
    transform: translateY(100%);
    transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 10000;
    overflow-y: auto;
    padding-bottom: 40px;
}

.ap-settings-sheet.active {
    transform: translateY(0);
}

.ap-set-group {
    background: #2c2c2e;
    margin: 20px;
    border-radius: 12px;
    overflow: hidden;
}

.ap-set-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 14px;
}

.ap-set-item:last-child {
    border-bottom: none;
}

.ap-set-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #3a3a3c;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 14px;
}

/* --- TOGGLE SWITCH --- */
.ap-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}

.ap-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ap-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3a3a3c;
    transition: .4s;
    border-radius: 26px;
}

.ap-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.ap-slider {
    background-color: #34c759;
}

input:checked+.ap-slider:before {
    transform: translateX(20px);
}