/* ===== User Info Section ===== */
/* Modern, responsive profile header (single variation) */

.user-info-wrap {
    --ui-bg: #ffffff;
    --ui-surface: #f8fafc;
    --ui-border: rgba(0,0,0,0.06);
    --ui-text: #1a2332;
    --ui-muted: #6b7c8e;
    --ui-accent: #4a90d9;
    --ui-accent-grad-start: #667eea;
    --ui-accent-grad-end: #764ba2;
    --ui-radius: 16px;
    --ui-shadow: 0 4px 20px rgba(0,0,0,0.08);
    --ui-shadow-hover: 0 8px 32px rgba(0,0,0,0.12);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ui-text);
    line-height: 1.5;
    margin-bottom: 24px;
}

/* --------------------------------------------------------------- */
/* Base shared components                                            */
/* --------------------------------------------------------------- */

.ui-section {
    background: var(--ui-bg);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    border: 1px solid var(--ui-border);
    padding: 20px;
    transition: box-shadow 0.25s ease;
    position: relative;
}
.ui-section:hover {
    box-shadow: var(--ui-shadow-hover);
}

.ui-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    object-fit: cover;
    padding: 0 !important;
    border: none !important;
}

.ui-badge-wrap {
    position: relative;
    display: inline-block;
}
.ui-badge-wrap .badge-new {
    position: absolute;
    top: -8px;
    right: -8px;
    z-index: 2;
}
.ui-badge-wrap > div[style*="z-index"] {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
}

.ui-name {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--ui-text);
}

.ui-status-icons img {
    height: 48px;
    width: auto;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}

.ui-location {
    font-size: 13px;
    color: var(--ui-muted);
    margin-bottom: 8px;
}

.ui-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}
.ui-socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    transition: transform 0.15s ease, background 0.2s ease;
}
.ui-socials a:hover {
    transform: translateY(-2px);
    background: #fff;
}
.ui-socials a img {
    width: 20px;
    height: 20px;
    display: block;
}

.ui-actions {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ui-actions li,
.ui-actions li form {
    margin: 0;
    padding: 0;
}
.ui-actions a {
    display: block;
    padding: 8px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 100%);
    color: var(--ui-text);
    font-size: 13px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    border: 1px solid var(--ui-border);
}
.ui-actions a:hover {
    background: linear-gradient(135deg, #e1e8f0 0%, #d6dfe8 100%);
    color: var(--ui-accent);
}

.ui-status-block {
    position: relative;
}
.ui-status-text {
    font-size: 15px;
    font-style: italic;
    color: #3a4a5c;
    padding: 10px 14px;
    background: #f4f7fb;
    border-left: 3px solid var(--ui-accent);
    border-radius: 0 10px 10px 0;
    display: block;
    margin-bottom: 8px;
}
.ui-status-text small {
    display: block;
    font-size: 11px;
    color: var(--ui-muted);
    margin-top: 4px;
    font-style: normal;
}

.ui-status-edit-panel {
    display: none;
    margin-bottom: 10px;
}
.ui-status-edit-panel form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.ui-status-edit-panel input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    font-size: 14px;
}
.ui-status-edit-panel input[type="submit"] {
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    background: var(--ui-accent);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}
.ui-status-edit-panel input[type="submit"]:hover {
    opacity: 0.9;
}

.ui-edit-btns {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 4px;
}
.ui-edit-btns a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--ui-border);
    color: var(--ui-muted);
    font-size: 12px;
    text-decoration: none;
}
.ui-edit-btns a:hover {
    background: var(--ui-accent);
    color: #fff;
    border-color: var(--ui-accent);
}
.ui-edit-btns a i {
    display: inline-block;
    width: 14px;
    height: 14px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: transform 0.15s ease;
    vertical-align: middle;
}
.ui-edit-btns a:hover i {
    transform: scale(1.08);
    filter: brightness(0) invert(1);
}

.ui-info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
.ui-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 14px;
}
.ui-info-row:last-child {
    border-bottom: none;
}
.ui-info-label {
    color: var(--ui-muted);
    font-weight: 500;
}
.ui-info-value {
    color: var(--ui-text);
    font-weight: 600;
    text-align: right;
}
.ui-info-value a {
    color: var(--ui-accent);
    text-decoration: none;
}
.ui-info-value a:hover {
    text-decoration: underline;
}

.ui-activity-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}
.ui-activity-table td {
    padding: 4px 0;
    font-size: 13px;
    color: var(--ui-muted);
}
.ui-activity-table .ui-info-value {
    text-align: right;
}

.ui-contact-block {
    margin-top: 12px;
}
.ui-contact-header {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ui-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--ui-border);
}
.ui-contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 14px;
}
.ui-contact-item img {
    width: 16px;
    height: 16px;
}

.ui-photos-header,
.ui-gifts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.ui-photos-header a,
.ui-gifts-header a {
    font-size: 13px;
    font-weight: 600;
    color: var(--ui-accent);
    text-decoration: none;
}
.ui-photos-header a:hover,
.ui-gifts-header a:hover {
    text-decoration: underline;
}
.ui-photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.ui-photos-grid a {
    display: block;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: var(--ui-surface);
}
.ui-photos-grid a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}
.ui-photos-grid a:hover img {
    transform: scale(1.06);
}

.ui-gifts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.ui-gift-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    background: var(--ui-surface, #f5f7fa);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ui-gift-cell:hover {
    transform: scale(1.06);
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.ui-gift-cell img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ui-placeholder {
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    background: linear-gradient(135deg, #eef1f5 0%, #e4e9ef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa8b8;
    font-size: 12px;
}

.ui-extra-img img {
    margin-top: 8px;
    border-radius: 8px;
    max-width: 100%;
}

/* Edit profile button */
.ui-edit-profile-btn {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    background: #f0f4f8;
    color: var(--ui-muted);
    font-size: 12px;
    text-decoration: none;
    border: 1px solid var(--ui-border);
    transition: background 0.2s ease;
}
.ui-edit-profile-btn:hover {
    background: #e1e8f0;
}
.ui-edit-profile-btn i {
    margin-right: 4px;
}

/* --------------------------------------------------------------- */
/* Variation 1 — Hero Card (Banner + profile + info, bottom row)     */
/* --------------------------------------------------------------- */
.user-info-wrap.v1 {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 60%);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-shadow);
    border: 1px solid var(--ui-border);
    padding: 0;
    overflow: visible;
    align-items: start;
}

/* Banner */
.user-info-wrap.v1 .ui-banner {
    grid-column: 1 / -1;
    height: 140px;
    background: linear-gradient(135deg, var(--ui-accent-grad-start) 0%, var(--ui-accent-grad-end) 100%);
    border-radius: var(--ui-radius) var(--ui-radius) 0 0;
    box-sizing: border-box;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.user-info-wrap.v1 .ui-banner-left {
    padding-left: 40px;
}
.user-info-wrap.v1 .ui-banner-left .ui-name {
    color: #ffffff;
    font-size: 26px;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.25);
    margin: 0;
    white-space: nowrap;
}
.user-info-wrap.v1 .ui-banner-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.user-info-wrap.v1 .ui-banner-right .ui-location {
    color: rgba(255,255,255,0.92);
    font-size: 13px;
    margin: 0;
}
.user-info-wrap.v1 .ui-banner-right .ui-banner-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.user-info-wrap.v1 .ui-banner-right .ui-banner-status img {
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Banner without status icons: transparent, black text, regular padding */
.user-info-wrap.v1 .ui-banner.ui-banner-no-status {
    background: transparent;
    height: auto;
    padding: 20px 24px;
    border-bottom: 1px solid var(--ui-border);
}
.user-info-wrap.v1 .ui-banner.ui-banner-no-status .ui-banner-left .ui-name {
    color: var(--ui-text);
    text-shadow: none;
}
.user-info-wrap.v1 .ui-banner.ui-banner-no-status .ui-banner-right .ui-location {
    color: var(--ui-muted);
}

/* Main info sections (status, details, contacts) in right column */
.user-info-wrap.v1 .ui-section {
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: transparent;
}
.user-info-wrap.v1 .ui-profile {
    grid-column: 1;
    grid-row: 2 / span 99;
    text-align: center;
    padding: 24px;
    padding-top: 36px;
}
.user-info-wrap.v1 .ui-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    margin: 0 auto;
    padding: 0;
    border: none;
}
.user-info-wrap.v1 .ui-actions {
    margin-top: 16px;
}
.user-info-wrap.v1 .ui-actions a {
    background: #fff;
    border: 1px solid var(--ui-border);
}
.user-info-wrap.v1 .ui-section:not(.ui-profile) {
    grid-column: 2;
    padding: 24px;
    padding-top: 36px;
}

/* Bottom row: Photos + Gifts side-by-side, visually separated */
.ui-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
.ui-bottom-row .ui-photos,
.ui-bottom-row .ui-gifts {
    background: #ffffff;
    border: 1px solid var(--ui-border);
    border-top: 2px solid var(--ui-accent);
    box-shadow: 0 6px 24px rgba(0,0,0,0.10);
    border-radius: var(--ui-radius);
    padding: 20px;
    margin-top: 0;
}
.ui-bottom-row .ui-photos-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* Responsive v1 */
@media (max-width: 680px) {
    .user-info-wrap.v1 {
        grid-template-columns: 1fr;
        align-items: center;
        text-align: center;
    }
    .user-info-wrap.v1 .ui-banner {
        min-height: 110px;
        padding: 0 16px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }
    .user-info-wrap.v1 .ui-banner-left {
        padding-left: 0;
    }
    .user-info-wrap.v1 .ui-banner-left .ui-name {
        font-size: 20px;
        white-space: normal;
    }
    .user-info-wrap.v1 .ui-banner-right {
        align-items: center;
        gap: 4px;
    }
    .user-info-wrap.v1 .ui-banner-right .ui-location {
        font-size: 12px;
    }
    .user-info-wrap.v1 .ui-banner-right .ui-banner-status img {
        height: 40px;
    }
    .user-info-wrap.v1 .ui-banner.ui-banner-no-status {
        padding: 16px;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }
    .user-info-wrap.v1 .ui-banner.ui-banner-no-status .ui-banner-left {
        padding-left: 0;
    }
    .user-info-wrap.v1 .ui-profile {
        grid-column: 1;
        grid-row: auto;
        padding-top: 32px;
    }
    .user-info-wrap.v1 .ui-section:not(.ui-profile) {
        grid-column: 1;
        padding-top: 16px;
    }
    .user-info-wrap.v1 .ui-avatar img {
        width: 180px;
        height: 180px;
    }
    .ui-bottom-row {
        grid-template-columns: 1fr;
        margin-top: 16px;
    }
    .ui-bottom-row .ui-photos,
    .ui-bottom-row .ui-gifts {
        padding: 16px;
    }
    .ui-bottom-row .ui-photos-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --------------------------------------------------------------- */
/* Global responsive breakpoints                                     */
/* --------------------------------------------------------------- */
@media (max-width: 680px) {
    .ui-photos-grid,
    .ui-gifts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 420px) {
    .ui-photos-grid,
    .ui-gifts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ui-name {
        font-size: 18px;
    }
}

/* ===== Avatar overlay (change photo trigger) ===== */
.ui-avatar {
    position: relative;
    display: inline-block;
    overflow: hidden;
    line-height: 0;
}
.ui-avatar-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(transparent, rgba(0,0,0,0.55));
    border-radius: 0 0 16px 16px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 14px;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.25s ease;
    z-index: 1;
}
.ui-avatar:hover .ui-avatar-overlay {
    opacity: 1;
}
.ui-avatar-overlay i {
    color: #fff;
    font-size: 22px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}
.user-info-wrap.v1 .ui-avatar-overlay {
    border-radius: 0 0 20px 20px;
}

#avatar-photo-trigger {
    display: block;
    cursor: pointer;
}
.ui-avatar:hover #avatar-photo-trigger img {
    filter: brightness(0.85);
    transition: filter 0.25s ease;
}

/* ============================================================ */
/* Photo Selection Popup (avatar click → choose / upload photo)  */
/* ============================================================ */

.ps-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.ps-overlay.open {
    display: flex;
}

.ps-dialog {
    background: #fff;
    border-radius: 16px;
    width: 92vw;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: psSlideIn 0.25s ease-out;
}
@keyframes psSlideIn {
    from { transform: translateY(24px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.ps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}
.ps-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1a2332;
}
.ps-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f2f5;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.ps-close:hover {
    background: #e4e7eb;
    color: #333;
}
.ps-close:focus-visible {
    outline: 2px solid var(--ui-accent, #4a90d9);
    outline-offset: 2px;
    background: #e4e7eb;
    color: #333;
}

.ps-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.ps-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}
.ps-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: #6b7c8e;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    border-bottom: 2px solid transparent;
}
.ps-tab.active {
    color: var(--ui-accent, #4a90d9);
    border-bottom-color: var(--ui-accent, #4a90d9);
}
.ps-tab:hover:not(.active) {
    color: #333;
}
.ps-tab:focus-visible {
    outline: 2px solid var(--ui-accent, #4a90d9);
    outline-offset: -2px;
    color: #333;
}

.ps-tab-content {
    padding: 16px 20px 20px;
}

.ps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
@media (min-width: 480px) {
    .ps-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.ps-photo {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: #f0f2f5;
    transition: transform 0.2s, box-shadow 0.2s;
}
.ps-photo:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.ps-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ps-photo-main {
    outline: 3px solid var(--ui-accent, #4a90d9);
    outline-offset: -3px;
}
.ps-main-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--ui-accent, #4a90d9);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    pointer-events: none;
}
.ps-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.ps-photo:hover .ps-photo-overlay {
    opacity: 1;
}
.ps-photo-main:hover .ps-photo-overlay {
    opacity: 0;
    cursor: default;
}
.ps-photo-action {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    padding: 6px 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
}

.ps-empty, .ps-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 16px;
    color: #888;
    font-size: 14px;
}

.ps-go-photos {
    grid-column: 1 / -1;
    text-align: center;
    padding: 10px;
    color: var(--ui-accent, #4a90d9);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid rgba(0,0,0,0.06);
    margin-top: 4px;
}
.ps-go-photos:hover {
    text-decoration: underline;
}

/* Upload tab */
.ps-upload-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.ps-upload-zone:hover,
.ps-upload-zone.dragover {
    border-color: var(--ui-accent, #4a90d9);
    background: #f0f7ff;
}
.ps-upload-icon {
    font-size: 40px;
    margin-bottom: 8px;
}
.ps-upload-text {
    font-size: 14px;
    color: #555;
    margin-bottom: 4px;
}
.ps-upload-zone small {
    color: #999;
    font-size: 12px;
}

.ps-upload-preview {
    text-align: center;
    margin-bottom: 16px;
}
.ps-upload-preview img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.ps-upload-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
}

.ps-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}
.ps-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.ps-btn:focus-visible {
    outline: 2px solid var(--ui-accent, #4a90d9);
    outline-offset: 2px;
}
.ps-btn-primary {
    background: var(--ui-accent, #4a90d9);
    color: #fff;
}
.ps-btn-primary:hover:not(:disabled) {
    background: #3a7bc8;
}
.ps-btn-secondary {
    background: #f0f2f5;
    color: #555;
}
.ps-btn-secondary:hover {
    background: #e4e7eb;
}

@media (max-width: 480px) {
    .ps-dialog {
        width: 96vw;
        max-height: 90vh;
    }
    .ps-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .ps-tab-content {
        padding: 12px 14px 16px;
    }
}
