/* ========================================================
   TrailTrack Stories — Profile Styles
   ======================================================== */

.profile-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ---- Profile Header ---- */
.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.profile-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.15), rgba(245, 158, 11, 0.1));
  pointer-events: none;
}

.profile-avatar-area {
  position: relative;
  z-index: 1;
}

.profile-info {
  flex: 1;
  min-width: 0;
  z-index: 1;
  padding-top: 8px;
}

.profile-display-name {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.profile-username {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.profile-bio {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}

.profile-location {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Stats Row */
.profile-stats {
  display: flex;
  gap: 24px;
}

.profile-stat {
  text-align: center;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.profile-stat:hover {
  color: var(--green-light);
}

.profile-stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  display: block;
}

.profile-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Profile Actions */
.profile-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  padding-top: 8px;
}

/* Follow Button */
.follow-btn {
  padding: 8px 24px;
  border-radius: var(--radius-full);
  font-weight: 700;
  transition: all var(--transition);
  min-width: 120px;
}

.follow-btn-follow {
  background: var(--green);
  color: white;
  border: 2px solid var(--green);
}

.follow-btn-follow:hover {
  background: var(--green-light);
  border-color: var(--green-light);
  box-shadow: var(--shadow-glow-green);
  transform: scale(1.05);
}

.follow-btn-following {
  background: transparent;
  color: var(--green-light);
  border: 2px solid var(--green);
}

.follow-btn-following:hover {
  border-color: var(--red);
  color: var(--red);
}

.follow-btn-following:hover .follow-text-default { display: none; }
.follow-btn-following .follow-text-hover { display: none; }
.follow-btn-following:hover .follow-text-hover { display: inline; }

/* ---- Profile Tabs ---- */
.profile-tabs {
  margin-bottom: 0;
}

/* ---- Stories Grid ---- */
.profile-stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.profile-story-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.profile-story-thumb:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow);
}

.profile-story-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-story-thumb-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  display: flex;
  gap: 10px;
  font-size: 0.75rem;
  color: white;
  font-weight: 600;
}

.profile-story-no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Trophy Wall ---- */
.trophy-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.trophy-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
}

.trophy-item:hover {
  transform: scale(1.04);
  box-shadow: 0 0 20px var(--orange-glow);
  border-color: var(--orange);
}

.trophy-item img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
}

.trophy-item-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  color: var(--orange);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ---- Stats Section ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.stat-card-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--green-light);
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .profile-page {
    padding: 12px 10px;
  }

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

  .profile-header::before {
    height: 60px;
  }

  .profile-display-name {
    font-size: 1.3rem;
  }

  .profile-stats {
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
  }

  .profile-stat-value {
    font-size: 1.05rem;
  }

  .profile-actions {
    align-items: center;
    flex-direction: row;
    width: 100%;
    justify-content: center;
  }

  .follow-btn {
    min-height: 44px;
    min-width: 100px;
  }

  .profile-stories-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .trophy-wall {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

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

  .stat-card {
    padding: 14px;
  }

  .stat-card-value {
    font-size: 1.4rem;
  }

  .stat-card-icon {
    font-size: 1.5rem;
  }

  /* Tabs scroll horizontally */
  .profile-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .profile-tabs .tabs {
    white-space: nowrap;
    flex-wrap: nowrap;
  }
}

@media (max-width: 480px) {
  .profile-page {
    padding: 8px 4px;
  }

  .profile-header {
    padding: 14px 12px;
    border-radius: var(--radius);
    margin-bottom: 16px;
  }

  .profile-stories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

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