/**
 * Gift Radar - Social Features Styles
 * Follow system, activity feed, leaderboard, user discovery
 */

/* ============================================
   FOLLOW BUTTON
   ============================================ */

.follow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid var(--primary-color, #4A90A4);
    background: var(--primary-color, #4A90A4);
    color: white;
    font-size: 14px;
    min-width: 80px;
}

@media (prefers-reduced-motion: no-preference) {
    .follow-btn:hover {
        background: var(--primary-dark, #3d7a8a);
        border-color: var(--primary-dark, #3d7a8a);
        transform: scale(1.02);
    }
}

.follow-btn:hover {
    background: var(--primary-dark, #3d7a8a);
    border-color: var(--primary-dark, #3d7a8a);
}

.follow-btn.following {
    background: transparent;
    color: var(--primary-color, #4A90A4);
}

.follow-btn.following:hover {
    background: #ffeeee;
    border-color: #e74c3c;
    color: #e74c3c;
}

.follow-btn.following.hover .btn-text {
    color: #e74c3c;
}

.follow-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.follow-btn .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.follow-btn.following .spinner {
    border-color: rgba(74, 144, 164, 0.3);
    border-top-color: var(--primary-color, #4A90A4);
}

/* Button Sizes */
.follow-btn-small {
    padding: 4px 12px;
    font-size: 12px;
    min-width: 60px;
}

.follow-btn-large {
    padding: 12px 24px;
    font-size: 16px;
    min-width: 120px;
}

/* ============================================
   ACTIVITY FEED
   ============================================ */

.activity-feed {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.feed-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
}

.feed-tabs {
    display: flex;
    gap: 8px;
}

.feed-tab {
    padding: 8px 16px;
    border: none;
    background: #f5f5f5;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.feed-tab:hover {
    background: #eee;
}

.feed-tab.active {
    background: var(--primary-color, #4A90A4);
    color: white;
}

.feed-content {
    padding: 16px;
}

.activities-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    transition: background 0.2s;
}

.activity-item:hover {
    background: #f0f0f0;
}

.activity-avatar {
    flex-shrink: 0;
}

.activity-avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.activity-user {
    font-weight: 600;
    color: var(--primary-color, #4A90A4);
    text-decoration: none;
}

.activity-user:hover {
    text-decoration: underline;
}

.activity-time {
    font-size: 12px;
    color: #999;
}

.activity-body {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

.activity-action {
    color: #666;
}

.activity-store,
.activity-target-user {
    font-weight: 500;
    color: var(--primary-color, #4A90A4);
    text-decoration: none;
}

.activity-store:hover,
.activity-target-user:hover {
    text-decoration: underline;
}

.review-preview {
    margin-top: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border-right: 3px solid var(--primary-color, #4A90A4);
    font-style: italic;
    color: #555;
}

.rating-stars {
    color: #ffc107;
    font-size: 16px;
    margin-top: 4px;
}

.feed-loading,
.feed-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 12px;
    color: #666;
}

.load-more {
    padding: 16px;
    text-align: center;
}

.load-more button {
    padding: 10px 24px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.load-more button:hover {
    background: #f5f5f5;
}

/* ============================================
   USER CARDS
   ============================================ */

.user-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

@media (prefers-reduced-motion: no-preference) {
    .user-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    }
}

.user-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.user-rank {
    font-size: 18px;
    font-weight: 700;
    color: #999;
    min-width: 40px;
}

.user-card-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.user-avatar {
    position: relative;
}

.user-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.reputation-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid white;
}

.reputation-badge.badge-expert {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
}

.reputation-badge.badge-trusted {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: white;
}

.reputation-badge.badge-contributor {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
}

.reputation-badge.badge-active {
    background: #e0e0e0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.user-bio {
    margin: 4px 0 0;
    font-size: 13px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-stats {
    display: flex;
    gap: 16px;
    margin-top: 4px;
    font-size: 12px;
    color: #888;
}

.user-card-action {
    flex-shrink: 0;
}

/* ============================================
   LEADERBOARD
   ============================================ */

.leaderboard-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.search-box i {
    color: #999;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
}

.category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.category-tab:hover {
    border-color: var(--primary-color, #4A90A4);
    color: var(--primary-color, #4A90A4);
}

.category-tab.active {
    background: var(--primary-color, #4A90A4);
    border-color: var(--primary-color, #4A90A4);
    color: white;
}

.category-tab i {
    font-size: 12px;
}

/* Top 3 Podium */
.top-three-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 32px;
    padding: 20px;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

@media (prefers-reduced-motion: no-preference) {
    .podium-item:hover {
        transform: translateY(-5px);
    }
}

.podium-item.position-1 {
    order: 2;
    padding: 30px;
    background: linear-gradient(135deg, #fff9e6, #fff3cc);
    border: 2px solid #ffd700;
}

.podium-item.position-2 {
    order: 1;
}

.podium-item.position-3 {
    order: 3;
}

.podium-medal {
    font-size: 36px;
    margin-bottom: 8px;
}

.podium-avatar-link {
    display: block;
    margin-bottom: 12px;
}

.podium-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #eee;
    transition: transform 0.3s;
}

.position-1 .podium-avatar {
    width: 100px;
    height: 100px;
    border-color: #ffd700;
}

@media (prefers-reduced-motion: no-preference) {
    .podium-avatar:hover {
        transform: scale(1.05);
    }
}

.podium-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    text-decoration: none;
    margin-bottom: 4px;
}

.podium-name:hover {
    color: var(--primary-color, #4A90A4);
}

.podium-score {
    font-size: 14px;
    color: #666;
}

.podium-position {
    position: absolute;
    bottom: -10px;
    width: 28px;
    height: 28px;
    background: var(--primary-color, #4A90A4);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    display: none;
}

/* Leaderboard Table */
.leaderboard-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.leaderboard-table {
    width: 100%;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 60px 1fr 100px 100px;
    padding: 12px 16px;
    background: #f5f5f5;
    font-weight: 600;
    font-size: 14px;
    color: #666;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 60px 1fr 100px 100px;
    padding: 12px 16px;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.leaderboard-row:hover {
    background: #f9f9f9;
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.col-rank {
    font-weight: 600;
    color: #999;
}

.col-user {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

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

.row-name {
    font-weight: 500;
    color: #333;
}

.col-score {
    font-weight: 600;
    color: var(--primary-color, #4A90A4);
}

.col-action {
    text-align: left;
}

/* Load More */
.load-more-container {
    display: flex;
    justify-content: center;
    padding: 20px;
}

/* ============================================
   SUGGESTED USERS
   ============================================ */

.suggested-section {
    margin-bottom: 32px;
}

.suggested-section h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 18px;
    color: #333;
}

.suggested-users-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.suggested-user-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
    min-width: 140px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.suggested-user-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.suggested-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

.suggested-info strong {
    display: block;
    font-size: 14px;
    color: #333;
}

.suggested-info small {
    font-size: 12px;
    color: #888;
}

/* ============================================
   PUBLIC PROFILE PAGE
   ============================================ */

.public-profile-header {
    position: relative;
    margin-bottom: 24px;
}

.profile-header-background {
    height: 120px;
    background: linear-gradient(135deg, var(--primary-color, #4A90A4), #3d7a8a);
    border-radius: 12px 12px 0 0;
}

.profile-header-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 0 24px 24px;
    margin-top: -60px;
    position: relative;
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    object-fit: cover;
    margin-top: -30px;
}

.reputation-badge-large {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.reputation-badge-large.badge-expert {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #333;
}

.reputation-badge-large.badge-trusted {
    background: #4caf50;
    color: white;
}

.reputation-badge-large.badge-contributor {
    background: #2196f3;
    color: white;
}

.profile-info-section {
    flex: 1;
    min-width: 200px;
    padding-top: 40px;
}

.profile-display-name {
    margin: 0 0 8px;
    font-size: 28px;
}

.profile-bio {
    color: #666;
    margin: 0 0 12px;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    color: #888;
}

.profile-meta i {
    margin-left: 4px;
}

.profile-actions {
    padding-top: 50px;
}

/* Profile Stats Section */
.profile-stats-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stats-row {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 12px 24px;
}

.stat-item.clickable {
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.stat-item.clickable:hover {
    background: #f5f5f5;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color, #4A90A4);
}

.stat-label {
    font-size: 14px;
    color: #666;
}

/* Profile Tabs */
.profile-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid #eee;
}

.profile-tab {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.profile-tab:hover {
    color: #333;
}

.profile-tab.active {
    color: var(--primary-color, #4A90A4);
    border-bottom-color: var(--primary-color, #4A90A4);
}

.tab-content {
    display: none;
}

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

.profile-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.profile-section h3 {
    margin: 0 0 16px;
    font-size: 18px;
    color: #333;
}

/* Stats Grid */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.stat-card {
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    text-align: center;
}

.stat-card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #666;
    font-size: 14px;
}

.stat-card-header i {
    font-size: 20px;
    color: var(--primary-color, #4A90A4);
}

.stat-card-value {
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

/* Badges Container */
.badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Reviews in profile */
.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.review-item {
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.review-store-name {
    font-weight: 600;
    color: var(--primary-color, #4A90A4);
    text-decoration: none;
}

.review-store-name:hover {
    text-decoration: underline;
}

.review-stars {
    color: #ffc107;
}

.review-text {
    margin: 8px 0;
    color: #333;
    line-height: 1.5;
}

.review-footer {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #888;
}

.review-helpful i {
    margin-left: 4px;
}

/* ============================================
   FOLLOW LIST MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #eee;
}

.modal-content h2 {
    padding: 20px;
    margin: 0;
    border-bottom: 1px solid #eee;
}

.follow-list {
    padding: 16px;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

.empty-state.small {
    padding: 20px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 8px;
    color: #333;
}

.empty-state p {
    margin: 0 0 16px;
}

.empty-message {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.error-message {
    color: #e74c3c;
    text-align: center;
    padding: 20px;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: var(--primary-color, #4A90A4);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   ERROR STATES
   ============================================ */

.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.error-icon {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.error-state h2 {
    margin: 0 0 8px;
    color: #333;
}

.error-state p {
    margin: 0 0 20px;
    color: #666;
}

/* ============================================
   ACTIVITY SECTION
   ============================================ */

.activity-section {
    margin-top: 32px;
}

.activity-section h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 20px;
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
    text-align: center;
    padding: 32px 20px;
    margin-bottom: 24px;
}

.page-header h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 0 8px;
    font-size: 28px;
}

.page-header p {
    margin: 0;
    color: #666;
}

/* ============================================
   SEARCH RESULTS
   ============================================ */

.search-results {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.search-results h3 {
    margin: 0 0 16px;
    font-size: 16px;
    color: #666;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .leaderboard-header {
        display: none;
    }

    .leaderboard-row {
        grid-template-columns: 50px 1fr 80px;
    }

    .col-action {
        display: none;
    }

    .top-three-podium {
        flex-direction: column;
        align-items: center;
    }

    .podium-item {
        width: 100%;
        max-width: 200px;
    }

    .podium-item.position-1 {
        order: 1;
    }

    .podium-item.position-2 {
        order: 2;
    }

    .profile-header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 16px;
    }

    .profile-avatar-section {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .profile-info-section {
        padding-top: 16px;
    }

    .profile-meta {
        justify-content: center;
    }

    .profile-actions {
        padding-top: 16px;
    }

    .stats-row {
        justify-content: center;
    }

    .stat-item {
        padding: 8px 16px;
    }

    .stat-value {
        font-size: 24px;
    }

    .category-tabs {
        justify-content: center;
    }

    .category-tab span {
        display: none;
    }

    .category-tab i {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .profile-avatar-large {
        width: 100px;
        height: 100px;
    }

    .profile-display-name {
        font-size: 24px;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .suggested-users-container {
        flex-direction: column;
    }

    .suggested-user-card {
        flex-direction: row;
        text-align: right;
    }

    .suggested-user-link {
        flex-direction: row;
    }
}
