/**
 * 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;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ========================================
   FIXED HEADER (shows on scroll)
   ======================================== */

.profile-fixed-header {
    position: fixed;
    top: 0;
    left: 72px; /* offset for collapsed sidebar */
    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), left var(--transition-base);
    border-bottom: 1px solid var(--border-color);
}

/* Expand sidebar adjusts header */
body:not(.sidebar-collapsed) .profile-fixed-header {
    left: var(--sidebar-width);
}

@media (max-width: 1024px) {
    .profile-fixed-header {
        left: 0 !important;
    }
}

.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;
}

.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: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background var(--transition-base), border-color var(--transition-base);
}

.tab-btn {
    padding: 14px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-btn i {
    font-size: 18px;
}

.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: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-base), border-color var(--transition-base);
}

.tab-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    text-transform: none;
}

.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,
#products-content,
#properties-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 GRID
   ======================================== */

.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));
    }
}
