/* Instagram-style Profile CSS */

/* Profile Grid System for Mobile */
@media (max-width: 480px) {
  .posts-grid {
    gap: 2px !important;
  }
  
  .post-item {
    border-radius: 0 !important;
  }
  
  .profile-container {
    padding: 0 !important;
    background: white;
  }
  
  .profile-header {
    padding: 16px !important;
  }
  
  .profile-tabs {
    margin: 0 !important;
  }
  
  .tab-content {
    margin: 0 !important;
  }
}

/* Smooth animations */
.post-item {
  transition: transform 0.2s ease;
}

.post-item:active {
  transform: scale(0.98);
}

/* Better hover effects for desktop */
@media (min-width: 769px) {
  .post-overlay {
    backdrop-filter: blur(2px);
  }
  
  .badge-item {
    transition: all 0.3s ease;
  }
  
  .badge-item:hover {
    transform: translateY(-2px);
  }
  
  .badge-icon {
    transition: all 0.3s ease;
  }
  
  .badge-item:hover .badge-icon {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #dbdbdb;
  border-top-color: #262626;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Better image loading */
.post-item img {
  background: #fafafa;
  transition: opacity 0.3s;
}

.post-item img[src=""] {
  opacity: 0;
}

/* Notification badges */
.notification-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ed4956;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Story ring (for future use) */
.has-story {
  position: relative;
}

.has-story::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  z-index: -1;
}

/* Verified badge (for future use) */
.verified-badge {
  color: #0095f6;
  font-size: 14px;
  margin-left: 4px;
}

/* Mobile optimizations */
@media (max-width: 640px) {
  .profile-username {
    font-size: 20px !important;
  }
  
  .btn-instagram {
    font-size: 13px !important;
    padding: 4px 8px !important;
  }
  
  .stat-number {
    font-size: 14px !important;
  }
  
  .stat-label {
    font-size: 13px !important;
  }
  
  .tab-item {
    padding: 14px 16px !important;
    font-size: 11px !important;
  }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
  /* Add dark mode styles here if needed */
}

/* Accessibility improvements */
.post-item:focus-visible,
.tab-item:focus-visible,
.btn-instagram:focus-visible {
  outline: 2px solid #0095f6;
  outline-offset: 2px;
}

/* Better touch targets for mobile */
@media (pointer: coarse) {
  .btn-instagram,
  .tab-item,
  .post-item {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Image aspect ratio preservation */
.post-item img {
  aspect-ratio: 1 / 1;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Grid fallback for older browsers */
@supports not (display: grid) {
  .posts-grid {
    display: flex;
    flex-wrap: wrap;
  }
  
  .post-item {
    width: calc(33.333% - 19px);
    margin-right: 28px;
    margin-bottom: 28px;
  }
  
  .post-item:nth-child(3n) {
    margin-right: 0;
  }
}

/* Print styles */
@media print {
  .profile-tabs,
  .profile-actions,
  .action-menu-container {
    display: none !important;
  }
  
  .posts-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn-instagram {
    border-width: 2px;
  }
  
  .tab-item.active {
    border-top-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #fafafa;
}

::-webkit-scrollbar-thumb {
  background: #dbdbdb;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #8e8e8e;
}
