/**
 * Profile Page CSS - Theme-Aware Design
 * Uses CSS variables from base-modern.html
 * Respects data-theme attribute on html element
 */

/* ========================================
   PROFILE CONTAINER
   ======================================== */

.profile-container {
    width: 100%;
    margin: 0 auto;
    padding: 0 !important;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 80px !important;
    transition: background var(--transition-base), color var(--transition-base);
}

/* Desktop Centering */
@media (min-width: 768px) {
    .profile-container {
        max-width: 680px;
    }
}

/* ========================================
   FIXED HEADER (shows on scroll)
   ======================================== */

.profile-fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease, background var(--transition-base);
    border-bottom: 1px solid var(--border-color);
}

.profile-fixed-header.visible {
    transform: translateY(0);
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    text-align: center;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.header-btn:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

/* ========================================
   COVER PHOTO SECTION
   ======================================== */

.profile-cover {
    position: relative;
    width: 100%;
    height: 130px;
    overflow: hidden;
    /* background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%); */
}

.profile-cover .cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-cover .cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* Cover Header (buttons over cover photo) */
.cover-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
}

.cover-actions {
    display: flex;
    gap: 8px;
}

.cover-header .header-btn {
    background: rgba(0, 0, 0, 0.4);
    color: #ffffff;
    backdrop-filter: blur(10px);
}

.cover-header .header-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

/* ========================================
   PROFILE HEADER (Avatar LEFT + Stats RIGHT)
   ======================================== */

.profile-header {
    position: relative;
    background: transparent;
    padding: 12px 20px 12px;
    margin-top: -60px;
    transition: background var(--transition-base);
}

.profile-header-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.profile-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid var(--bg-primary);
    object-fit: cover;
    display: block;
    box-shadow: var(--shadow-lg);
    transition: border-color var(--transition-base);
  
}

/* ========================================
   STATS ROW (RIGHT SIDE)
   ======================================== */

.profile-stats {
    display: flex;
    gap: 12px;
    flex: 1;
    justify-content: flex-end;
    margin-top: 50px;
}

.profile-stat-item {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    min-width: 50px;
   
}

.profile-stat-item:hover {
    transform: translateY(-2px);
}

.profile-stat-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 8px 0px 6px 0px;
    line-height: 1;
}

.profile-stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1;
    text-transform: none;
}

/* ========================================
   PROFILE INFO
   ======================================== */

.profile-info {
    background: var(--bg-primary);
    padding: 14px 20px;
    transition: background var(--transition-base);
}

.profile-name-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 6px;
}

.profile-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem;
    line-height: 1.25;
}

.profile-username {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

.profile-bio {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.35;
    margin: 0 0 8px 0;
}

.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.meta-item {
    display: flex;
    align-items: flex-start;
    font-size: 12px;
    color: var(--text-primary);
    gap: 6px;
    line-height: 1.3;
}

.meta-item i {
    font-size: 15px;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-top: 0px;
}

.meta-item strong {
    font-weight: 600;
    color: var(--primary);
}

/* ========================================
   ACTION BUTTONS
   ======================================== */

.profile-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-action {
    flex: 1;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-action i {
    font-size: 16px;
}

.btn-edit, .btn-share {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-edit:hover, .btn-share:hover {
    background: var(--bg-tertiary);
}

.btn-follow {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-follow:hover {
    background: var(--bg-tertiary);
}

.btn-unfollow-full {
    width: 100%;
    font-weight: 500;
}

/* ========================================
   TABS NAVIGATION
   ======================================== */

.profile-tabs {
    margin-top: 20px;
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    transition: background var(--transition-base), border-color var(--transition-base);
}

.profile-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    white-space: nowrap;
}

.tab-btn span {
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    line-height: 1.1;
}

.tab-btn i {
    font-size: 18px;
}

.profile-events-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.profile-event-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-primary);
    text-decoration: none;
    color: inherit;
}

.profile-event-cover {
    aspect-ratio: 16 / 10;
    background: linear-gradient(145deg, #0b1f2a 0%, #046fad 100%);
    overflow: hidden;
}

.profile-event-cover img,
.profile-event-fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.6rem;
}

.profile-event-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-event-body strong {
    font-size: 0.88rem;
    line-height: 1.3;
}

.profile-event-card.is-draft {
    border-style: dashed;
}

.profile-event-cover {
    position: relative;
}

.profile-event-draft-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: #b45309;
    color: #fff;
}

.profile-event-continue {
    margin-top: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary, #046fad);
}

.profile-subchips {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    margin: 0;
    padding: 0;
}

.profile-subchip {
    border: 1px solid var(--border-color, #e5e7eb);
    background: var(--bg-secondary, #f3f4f6);
    color: var(--text-secondary, #6b7280);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}

.profile-subchip.active {
    background: var(--primary, #046fad);
    border-color: var(--primary, #046fad);
    color: #fff;
}

.profile-media-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
}

.profile-media-tile {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-secondary, #e5e7eb);
    cursor: pointer;
}

.profile-media-tile img,
.profile-media-fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #9ca3af);
    font-size: 1.4rem;
}

.profile-media-video {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.profile-loading {
    padding: 28px 12px;
    text-align: center;
    color: var(--text-secondary, #6b7280);
    font-size: 0.9rem;
}

#media.content-panel {
    padding: 0 0 96px;
}

#events.content-panel {
    padding-bottom: 96px !important;
}

#products.content-panel,
#properties.content-panel {
    padding-bottom: 96px;
}

.profile-event-body span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

@media (max-width: 520px) {
    .profile-events-grid {
        grid-template-columns: 1fr;
    }
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ========================================
   TAB CONTENT HEADER
   ======================================== */

.tab-content-header {
    background: var(--bg-primary);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-base), border-color var(--transition-base);
}

.tab-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

.tab-header-right .profile-subchips {
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
}

.tab-header-right .profile-subchips[hidden] {
    display: none !important;
}

.tab-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    text-transform: none;
    flex: 0 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-search {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-search:hover {
    text-decoration: underline;
}

/* ========================================
   PROFILE CONTENT
   ======================================== */

.profile-content {
    position: relative;
    min-height: 300px;
    background: var(--bg-primary);
    transition: background var(--transition-base);
}

.content-panel {
    display: none;
    background: var(--bg-primary);
    padding: 0;
    transition: background var(--transition-base);
}

.content-panel.active {
    display: block;
}

/* ========================================
   SKELETON LOADERS
   ======================================== */

.profile-skeleton-loader {
    /* Skeleton items have their own padding */
}

.profile-skeleton-item {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    flex-shrink: 0;
    animation: shimmer 1.5s infinite;
}

.skeleton-text-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-text {
    height: 14px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    animation: shimmer 1.5s infinite;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    border-radius: 8px;
    animation: shimmer 1.5s infinite;
    margin-bottom: 12px;
}

/* Product Grid Skeleton */
.product-grid-skeleton {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px !important;
}

.product-skeleton-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    padding: 0;
}

.product-skeleton-card .skeleton-image {
    margin-bottom: 0;
    border-radius: 0;
}

.product-skeleton-card .skeleton-text {
    margin: 8px 12px;
}

.product-skeleton-card .skeleton-text:last-child {
    margin-bottom: 12px;
}

@keyframes shimmer {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* ========================================
   EMPTY STATES
   ======================================== */

/* Empty state styles moved to common.css for reusability */

/* Content divs for consistent padding */
#posts-content {
    min-height: 200px;
}

/* Ensure posts loaded via AJAX also maintain consistent spacing */
#posts-content > *:not(.profile-skeleton-loader):not(.empty-state) {
    /* Posts container - no extra padding needed as posts have their own */
}

/* ========================================
   PRODUCTS / PROPERTIES GRID
   ======================================== */

/* Products and properties panels — no extra padding; grid handles spacing */
#products.content-panel,
#properties.content-panel {
    padding: 0 !important;
}

/* Products and properties content areas render as a responsive grid */
#products-content,
#properties-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px;
    min-height: 200px;
}

/* Skeleton and empty-state span all columns */
#products-content .product-grid-skeleton,
#products-content .profile-skeleton-loader,
#products-content .empty-state,
#properties-content .product-grid-skeleton,
#properties-content .profile-skeleton-loader,
#properties-content .empty-state {
    grid-column: 1 / -1;
}

/* Desktop: 3 columns */
@media (min-width: 680px) {
    #products-content,
    #properties-content {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
        padding: 14px;
    }
}

.posts-grid,
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px !important;
}

.post-card,
.product-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s, background var(--transition-base);
    cursor: pointer;
}

.post-card:hover,
.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.post-image-wrapper,
.product-image-wrapper {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-tertiary);
}

.post-image,
.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bookmark-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
}

.post-info,
.product-info {
    padding: 12px;
}

.post-text-preview {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.post-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.post-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-stats i {
    font-size: 14px;
}

.product-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 8px 0;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 2px;
}

.product-rating i {
    color: #ffc107;
}

/* ========================================
   HOUSING GRID
   ======================================== */

.housing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 10px !important;
}

.housing-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s, background var(--transition-base);
    cursor: pointer;
}

.housing-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.housing-image-wrapper {
    position: relative;
    aspect-ratio: 4/3;
    background: var(--bg-tertiary);
}

.housing-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.housing-info {
    padding: 12px;
}

.housing-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.housing-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.housing-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    color: var(--text-secondary);
}

.housing-rating i {
    color: #ffc107;
}

.housing-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 8px 0;
}

.housing-action-btn {
    width: 100%;
    padding: 8px;
    background: var(--primary);
    color: var(--text-inverse);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.housing-action-btn:hover {
    background: var(--primary-hover);
}

/* ========================================
   POSTS (from API)
   ======================================== */

.post-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: background var(--transition-base);
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
}

.post-author-info {
    display: flex;
    flex-direction: column;
}

.post-author-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.post-time {
    font-size: 12px;
    color: var(--text-secondary);
}
.post-content {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.post-media {
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
}

.post-media img,
.post-image {
    width: 100%;
    height: auto;
    display: block;
}

.post-video {
    width: 100%;
    max-height: 500px;
    display: block;
}

.post-media-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.post-media-grid.single {
    grid-template-columns: 1fr;
}

.media-grid-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

.media-grid-item img,
.media-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-caption {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
}

.post-caption .hashtag {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.post-caption .mention {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.post-actions {
    display: flex;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.post-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.post-action-btn i {
    font-size: 1.25rem;
}

.post-user-info {
    flex: 1;
}

.post-username {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    text-decoration: none;
}

.post-timestamp {
    font-size: 12px;
    color: var(--text-tertiary);
}

.post-footer {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
.post-footer span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (min-width: 768px) {
    .profile-cover {
        height: 200px;
    }
    
    .profile-avatar {
        width: 110px;
        height: 110px;
    }
    
    .profile-stats {
        gap: 16px;
    }
    
    .profile-stat-item {
        min-width: 60px;
    }
    
    .profile-stat-value {
        font-size: 18px;
    }
    
    .profile-stat-label {
        font-size: 13px;
    }
    
    .products-grid, .housing-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .profile-info {
        padding: 16px 24px;
    }
    
    .profile-tabs {
        padding: 0 24px;
    }
}

@media (min-width: 1024px) {
    .profile-container {
        max-width: 680px;
    }
    
    .profile-cover {
        height: 220px;
    }
    
    .products-grid, .housing-grid {
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    }
}
