:root {
  --primary-color: #0095f6;
  --primary-color-hover: #1877f2;
  --text-color: #262626;
  --secondary-text-color: #737373;
  --background-color: #fafafa;
  --card-background: #ffffff;
  --border-color: #dbdbdb;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 12px; /* Increased radius for modern look */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.container {
  max-width: 935px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-bottom: 4rem;
}

@media (max-width: 600px) {
  .container {
    padding: 20px 15px;
    padding-bottom: 80px;
  }
}

h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  color: var(--text-color);
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

button {
  font-family: var(--font-family);
  cursor: pointer;
}

/* Header & Search */
.header {
  text-align: center;
  margin-bottom: 1rem;
}

.header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.header .description {
  color: var(--secondary-text-color);
  font-size: 1rem;
}

.searchSection {
  display: flex;
  gap: 10px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

.custom-input {
  width: 100%;
  padding: 14px 20px;
  border: 1px solid var(--border-color);
  border-radius: 30px; /* Pill shape */
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
  background: white;
  box-shadow: var(--shadow-sm);
}

.custom-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 149, 246, 0.1);
}

.search-button {
  padding: 14px 24px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.search-button:hover {
  background-color: var(--primary-color-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Profile Section */
.profileCard {
  background: var(--card-background);
  border-radius: var(--radius);
  padding: 2.5rem;
  display: flex;
  align-items: center;
  gap: 3rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.05);
  transition: transform 0.3s ease;
}

@media (max-width: 768px) {
  .profileCard {
    flex-direction: column;
    text-align: center;
    padding: 2rem;
    gap: 1.5rem;
  }
}

.profileImage {
  width: 160px;
  height: 160px;
  flex-shrink: 0;
  border-radius: 50%;
  padding: 4px;
  background: white;
  border: 1px solid var(--border-color);
  position: relative;
}

.profileImageImg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.profileDetails {
  flex: 1;
}

.names {
  margin-bottom: 1.5rem;
}

.names h3 {
  font-size: 1.8rem;
  font-weight: 300;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .names h3 {
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
  }
}

.names .username {
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--text-color);
}

.stats {
  display: flex;
  gap: 2.5rem;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .stats {
    justify-content: center;
    gap: 1.5rem;
  }
}

.stats span {
  display: flex;
  flex-direction: column; /* Stack number and label */
  align-items: center; /* Center align */
}

.stats span strong {
  font-weight: 700;
  color: var(--text-color);
  font-size: 1.2rem;
}

.bio {
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-color);
}

/* Highlights */
.highlightsSection {
  background: transparent; /* Remove card bg for cleaner look */
  padding: 0;
  border: none;
  box-shadow: none;
  margin-bottom: 1rem;
}

.highlightsContainer {
  display: flex;
  gap: 2rem;
  overflow-x: auto;
  padding: 10px 5px 20px 5px;
  scrollbar-width: thin;
}

.highlightCircle {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  cursor: pointer;
  transition: transform 0.2s;
}

.highlightCircle:hover {
  transform: translateY(-3px);
}

.highlightImageContainer {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  padding: 3px;
  background: white;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #e0e0e0; /* Double ring effect */
  margin-bottom: 8px;
  overflow: hidden;
}

/* Gradient border for highlights */
.highlightImageContainer {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    padding: 3px;
    border-radius: 50%;
}

.highlightImageContainer img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  display: block;
}

.highlightTitle {
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Filter Tabs */
.tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.tab {
  padding: 1rem 2rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--secondary-text-color);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.8rem;
  border-top: 1px solid transparent;
  margin-top: -1px;
  transition: all 0.2s;
}

.tab.active {
  color: var(--text-color);
  border-top: 1px solid var(--text-color);
}

.tab:hover {
  color: var(--text-color);
}

/* Media Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px; /* More breathing room */
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.mediaCard {
  position: relative;
  aspect-ratio: 1;
  background: #efefef;
  border-radius: 8px; /* Slightly rounded */
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s;
}

.mediaCard:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  z-index: 2;
}

.mediaThumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.videoBadge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  gap: 4px;
}

.mediaOverlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px); /* Modern blur effect */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: white;
  gap: 1.5rem;
}

.mediaCard:hover .mediaOverlay {
  opacity: 1;
}

.mediaOverlay p {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Insights Section (Refined) */
.insightsSection {
    margin-top: 2rem;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.insights-container {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: var(--shadow-md);
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.insight-card {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s, background 0.2s;
    border: 1px solid transparent;
}

.insight-card:hover {
    transform: translateY(-3px);
    background: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.insight-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #405de6, #5851db, #833ab4, #c13584, #e1306c, #fd1d1d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.insight-label {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.top-post-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 20px;
}

@media (max-width: 600px) {
    .top-post-card {
        flex-direction: column;
        text-align: center;
    }
}

/* Modal */
.modalOverlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 40px;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modalContainer {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: 85vh;
    background: white;
    border-radius: 12px; /* Rounded modal */
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

@media (max-width: 900px) {
    .modalContainer {
        flex-direction: column;
        height: auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    .mediaContainer {
        min-height: 40vh;
    }
    .detailsContainer {
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

.mediaContainer {
    flex: 1.5;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.detailsContainer {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    min-width: 350px;
    background: white;
}

.detailsHeader {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.detailsHeader .userAvatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
}

.detailsHeader .username {
    font-weight: 700;
    font-size: 1rem;
}

.captionSection {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-color);
}

.metaSection .actions {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 1.5rem;
}

.metaSection .likes {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.metaSection .date {
    font-size: 0.75rem;
    color: var(--secondary-text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading Indicator */
.loading {
    text-align: center;
    padding: 2rem;
    font-weight: 600;
    color: var(--secondary-text-color);
}
