/* ═══════════════════════════════════════════════════════════════
   BUMAGA SERVICE — Public User Profile Styles v3.0
   ═══════════════════════════════════════════════════════════════
   
   Depends on: tokens.css (--bp-* design tokens, loaded in header.php)
   
   Dynamic colors are set via CSS custom properties on .user-page:
     --user-role-color     (from RoleMetadata::color)
     --user-accent-color   (from user accent_color)
   
   v3.0 — Visual Redesign:
     - Header → card with accent top-line (matches profile.css)
     - Stats  → compact inline row in single card
     - Badges → tighter, enterprise feel
     - Tabs   → cab-tabs visual pattern
     - Overall tighter spacing
   
   ═══════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════
   1. BASE LAYOUT
   ═══════════════════════════════════════════════ */

.user-page {
    min-height: calc(100vh - var(--cab-header-h));
    background: var(--bp-surface);
    padding: 24px 0 60px;
}

.user-page .profile-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}


/* ═══════════════════════════════════════════════
   2. HEADER CARD
   ═══════════════════════════════════════════════ */

.user-page .profile-header {
    background: var(--bp-card);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    padding: 24px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

/* Accent top-line (matches profile.css pattern) */
.user-page .profile-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--user-role-color, var(--bp-accent)), var(--user-accent-color, var(--bp-accent)));
}

.user-page .profile-header-inner {
    display: flex;
    gap: 20px;
    align-items: center;
}

@media (max-width: 768px) {
    .user-page .profile-header-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* Avatar — compact */
.user-page .profile-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.user-page .profile-avatar-img,
.user-page .profile-avatar-letter {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--user-accent-color, var(--bp-accent));
    box-shadow: 0 0 20px color-mix(in srgb, var(--user-accent-color, var(--bp-accent)) 25%, transparent);
    transition: all var(--bp-transition);
}

.user-page .profile-avatar-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: var(--bp-text);
    background: linear-gradient(135deg, var(--bp-border-hover) 0%, var(--bp-border) 100%);
}

.user-page .profile-online-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--bp-success);
    border: 3px solid var(--bp-card);
    border-radius: 50%;
}

/* Main Info */
.user-page .profile-main-info {
    flex: 1;
    min-width: 0;
}

.user-page .profile-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

@media (max-width: 768px) {
    .user-page .profile-name-row {
        justify-content: center;
    }
}

.user-page .profile-display-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--bp-text);
    margin: 0;
    letter-spacing: -0.3px;
}

.user-page .profile-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: color-mix(in srgb, var(--user-role-color, var(--bp-accent)) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--user-role-color, var(--bp-accent)) 31%, transparent);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--user-role-color, var(--bp-accent));
}

.user-page .profile-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--bp-green-dim);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bp-success);
}

.user-page .profile-username {
    color: var(--bp-text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
}

/* Bio */
.user-page .profile-bio {
    color: var(--bp-text-secondary);
    font-size: 13px;
    line-height: 1.5;
    max-width: 500px;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .user-page .profile-bio {
        max-width: 100%;
    }
}

/* Meta info */
.user-page .profile-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--bp-text-muted);
    font-size: 12px;
}

@media (max-width: 768px) {
    .user-page .profile-meta {
        justify-content: center;
    }
}

.user-page .profile-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-page .profile-meta-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

/* Online meta */
.user-page .profile-meta-item--online {
    color: var(--bp-success);
}

.user-page .profile-meta-online-dot {
    width: 6px;
    height: 6px;
    background: var(--bp-success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px var(--bp-success);
}

/* Right Side - Rating & Actions */
.user-page .profile-right-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .user-page .profile-right-side {
        align-items: center;
        width: 100%;
    }
}

/* Rating */
.user-page .profile-rating-box {
    text-align: right;
}

@media (max-width: 768px) {
    .user-page .profile-rating-box {
        text-align: center;
    }
}

.user-page .rating-stars-large {
    display: flex;
    gap: 2px;
    justify-content: flex-end;
    margin-bottom: 4px;
}

@media (max-width: 768px) {
    .user-page .rating-stars-large {
        justify-content: center;
    }
}

.user-page .rating-star-large {
    font-size: 18px;
    color: var(--bp-border-hover);
}

.user-page .rating-star-large.filled {
    color: #FFD700;
}

.user-page .rating-value-large {
    font-size: 20px;
    font-weight: 700;
    color: var(--bp-text);
}

.user-page .rating-count-link {
    color: var(--bp-accent);
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
}

.user-page .rating-count-link:hover {
    text-decoration: underline;
}

.user-page .rating-empty {
    color: var(--bp-text-muted);
    font-size: 13px;
}

/* Action Buttons */
.user-page .profile-actions-header {
    display: flex;
    gap: 8px;
}

.user-page .btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--bp-radius-xs);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--bp-transition);
    cursor: pointer;
    border: 1px solid var(--bp-border);
    background: var(--bp-card);
    color: var(--bp-text-secondary);
    font-family: var(--bp-sans);
}

.user-page .btn-action:hover {
    border-color: var(--bp-accent-border-strong);
    color: var(--bp-text);
    background: var(--bp-card-hover);
}

.user-page .btn-action-primary {
    background: var(--bp-accent);
    color: #fff !important;
    border-color: var(--bp-accent);
}

.user-page .btn-action-primary:hover {
    background: var(--bp-accent-hover);
    border-color: var(--bp-accent-hover);
}

.user-page .btn-action-telegram {
    background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
    color: #fff;
    border-color: transparent;
}

.user-page .btn-action-telegram:hover {
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

.user-page .tg-verified-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--bp-success);
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    margin-left: 2px;
}

.user-page .btn-action svg {
    width: 16px;
    height: 16px;
}


/* ═══════════════════════════════════════════════
   3. BADGES SECTION (compact)
   ═══════════════════════════════════════════════ */

.user-page .profile-badges {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.user-page .badge-card {
    background: var(--bp-card);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-page .badge-card-trusted {
    border-left: 3px solid var(--bp-success);
}

.user-page .badge-card-escrow {
    border-left: 3px solid var(--user-accent-color, var(--bp-accent));
}

.user-page .badge-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.user-page .badge-content {
    flex: 1;
}

.user-page .badge-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bp-text);
    margin-bottom: 2px;
}

.user-page .badge-card-trusted .badge-title {
    color: var(--bp-success);
}

.user-page .badge-card-escrow .badge-title {
    color: var(--user-accent-color, var(--bp-accent));
}

.user-page .badge-subtitle {
    font-size: 12px;
    color: var(--bp-text-muted);
}

.user-page .badge-stats {
    display: flex;
    gap: 20px;
    flex-shrink: 0;
}

.user-page .badge-stat {
    text-align: center;
}

.user-page .badge-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--bp-text);
    font-family: var(--bp-mono);
}

.user-page .badge-stat-label {
    font-size: 10px;
    color: var(--bp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* ═══════════════════════════════════════════════
   4. ACHIEVEMENTS SECTION (compact)
   ═══════════════════════════════════════════════ */

.user-page .achievements-section {
    background: var(--bp-card);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    padding: 18px;
    margin-bottom: 16px;
}

.user-page .achievements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.user-page .achievements-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bp-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-page .achievements-count {
    font-size: 12px;
    color: var(--bp-text-muted);
    font-family: var(--bp-mono);
}

.user-page .achievements-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.user-page .achievement-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bp-accent-dim);
    border: 1px solid var(--bp-accent-border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--bp-text-secondary);
    transition: all var(--bp-transition);
    cursor: default;
}

.user-page .achievement-badge:hover {
    background: rgba(74, 158, 255, 0.15);
    border-color: var(--bp-accent-border-strong);
    color: var(--bp-text);
}

.user-page .achievement-badge .ach-icon {
    font-size: 14px;
}

.user-page .achievement-badge .ach-name {
    font-weight: 500;
}

.user-page .achievements-empty {
    color: var(--bp-text-muted);
    font-size: 13px;
    text-align: center;
    padding: 16px;
}


/* ═══════════════════════════════════════════════
   5. STATS — compact inline row in card
   ═══════════════════════════════════════════════ */

.user-page .profile-stats {
    display: flex;
    background: var(--bp-card);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.user-page .stat-card {
    flex: 1;
    padding: 16px 12px;
    text-align: center;
    transition: background var(--bp-transition-fast);
    border-right: 1px solid var(--bp-border);
}

.user-page .stat-card:last-child {
    border-right: none;
}

.user-page .stat-card:hover {
    background: var(--bp-card-hover);
}

.user-page .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--bp-text);
    margin-bottom: 3px;
    font-family: var(--bp-mono);
}

.user-page .stat-label {
    font-size: 10px;
    color: var(--bp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

@media (max-width: 480px) {
    .user-page .profile-stats {
        flex-wrap: wrap;
    }

    .user-page .stat-card {
        flex: 1 1 calc(50% - 1px);
        border-bottom: 1px solid var(--bp-border);
    }

    .user-page .stat-card:nth-child(2) {
        border-right: none;
    }

    .user-page .stat-card:nth-child(n+3) {
        border-bottom: none;
    }
}


/* ═══════════════════════════════════════════════
   6. TABS — cab-tabs visual pattern
   ═══════════════════════════════════════════════ */

.user-page .profile-tabs {
    margin-bottom: 20px;
}

.user-page .tabs-header {
    display: flex;
    gap: 0;
    background: var(--bp-card);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius-sm);
    overflow: hidden;
    margin-bottom: 20px;
    width: fit-content;
}

.user-page .tab-btn {
    padding: 10px 22px;
    background: transparent;
    border: none;
    color: var(--bp-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--bp-transition-fast);
    position: relative;
    font-family: var(--bp-sans);
    white-space: nowrap;
}

.user-page .tab-btn:hover {
    color: var(--bp-text);
    background: rgba(255, 255, 255, 0.02);
}

.user-page .tab-btn.active {
    color: var(--bp-text);
    background: var(--bp-accent-dim);
}

.user-page .tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--user-accent-color, var(--bp-accent));
    border-radius: 1px;
}

.user-page .tab-count {
    font-family: var(--bp-mono);
    font-size: 11px;
    font-weight: 700;
    margin-left: 5px;
    opacity: 0.7;
}

.user-page .tab-content {
    display: none;
}

.user-page .tab-content.active {
    display: block;
}


/* ═══════════════════════════════════════════════
   7. LISTINGS GRID
   ═══════════════════════════════════════════════ */

.user-page .listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.user-page .listing-card {
    background: var(--bp-card);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    overflow: hidden;
    transition: all var(--bp-transition);
    text-decoration: none;
    color: inherit;
    display: block;
}

.user-page .listing-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--user-accent-color, var(--bp-accent)) 25%, transparent);
    box-shadow: var(--bp-shadow);
}

.user-page .listing-card-image {
    height: 140px;
    background: linear-gradient(135deg, var(--bp-surface) 0%, var(--bp-card-raised) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    overflow: hidden;
}

.user-page .listing-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-page .listing-card-body {
    padding: 14px 16px;
}

.user-page .listing-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bp-text);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.user-page .listing-card-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--user-accent-color, var(--bp-accent));
    margin-bottom: 6px;
    font-family: var(--bp-mono);
}

.user-page .listing-card-category {
    font-size: 11px;
    color: var(--bp-text-muted);
}

.user-page .empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--bp-text-secondary);
}

.user-page .empty-state-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.user-page .see-all-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--user-accent-color, var(--bp-accent));
    text-decoration: none;
    font-size: 13px;
}

.user-page .see-all-link:hover {
    text-decoration: underline;
}

/* "Show all" wrapper */
.user-page .see-all-wrap {
    text-align: center;
    margin-top: 20px;
}


/* ═══════════════════════════════════════════════
   8. REVIEWS SECTION
   ═══════════════════════════════════════════════ */

.user-page .review-form-card {
    background: var(--bp-card);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    padding: 20px;
    margin-bottom: 16px;
}

.user-page .review-form-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bp-text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bp-border);
}

.user-page .review-form-error {
    background: var(--bp-red-dim);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--bp-radius-xs);
    padding: 12px 16px;
    color: var(--bp-red);
    font-size: 13px;
    margin-bottom: 16px;
}

.user-page .review-pending-notice {
    background: var(--bp-orange-dim);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--bp-radius-xs);
    padding: 12px 16px;
    color: var(--bp-orange);
    font-size: 13px;
    margin-bottom: 16px;
}

.user-page .star-rating-input {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
}

.user-page .star-rating-input label {
    cursor: pointer;
    font-size: 28px;
    color: var(--bp-border-hover);
    transition: all var(--bp-transition-fast);
}

.user-page .star-rating-input label:hover,
.user-page .star-rating-input label.active {
    color: #FFD700;
    transform: scale(1.1);
}

.user-page .star-rating-input input {
    display: none;
}

.user-page .review-textarea {
    width: 100%;
    min-height: 100px;
    background: var(--bp-surface);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius-xs);
    padding: 12px 16px;
    color: var(--bp-text);
    font-size: 14px;
    resize: vertical;
    margin-bottom: 12px;
    font-family: var(--bp-sans);
    box-sizing: border-box;
    outline: none;
    transition: border-color var(--bp-transition);
}

.user-page .review-textarea:focus {
    border-color: var(--user-accent-color, var(--bp-accent));
    box-shadow: 0 0 0 3px var(--bp-accent-dim);
}

.user-page .review-textarea::placeholder {
    color: var(--bp-text-muted);
}

.user-page .review-form-actions {
    display: flex;
    gap: 10px;
}

.user-page .btn-submit-review {
    background: var(--user-accent-color, var(--bp-accent));
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--bp-radius-xs);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--bp-transition);
    font-family: var(--bp-sans);
}

.user-page .btn-submit-review:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 16px color-mix(in srgb, var(--user-accent-color, var(--bp-accent)) 25%, transparent);
}

.user-page .btn-submit-review:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
}

/* Review Items */
.user-page .reviews-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-page .review-item {
    background: var(--bp-card);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    padding: 16px;
    transition: border-color var(--bp-transition);
}

.user-page .review-item:hover {
    border-color: var(--bp-border-hover);
}

.user-page .review-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.user-page .review-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-page .review-avatar-letter {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}

.user-page .review-author-info {
    flex: 1;
}

.user-page .review-author-name {
    font-weight: 600;
    color: var(--bp-text);
    font-size: 13px;
}

/* Verified check */
.user-page .review-verified-check {
    color: var(--bp-success);
}

.user-page .review-author-role {
    font-size: 11px;
    color: var(--bp-text-muted);
}

.user-page .review-date {
    font-size: 11px;
    color: var(--bp-text-muted);
}

.user-page .review-rating {
    display: flex;
    gap: 2px;
    margin-bottom: 8px;
}

.user-page .review-star {
    color: var(--bp-border-hover);
    font-size: 13px;
}

.user-page .review-star.filled {
    color: #FFD700;
}

.user-page .review-text {
    color: var(--bp-text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.user-page .reviews-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--bp-text-muted);
}

/* Reviews empty icon */
.user-page .reviews-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Login link in reviews */
.user-page .review-login-wrap {
    text-align: center;
    padding: 16px;
}

.user-page .review-login-wrap a {
    color: var(--user-accent-color, var(--bp-accent));
}
