@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables for Instagram 2020 Theme */
:root {
  /* Instagram Brand Colors */
  --ig-primary: #0095f6;
  --ig-primary-hover: #0085e6;
  --ig-secondary: #262626;
  --ig-text: #262626;
  --ig-text-light: #8e8e8e;
  --ig-text-lighter: #c7c7c7;
  --ig-border: #dbdbdb;
  --ig-background: #fafafa;
  --ig-card-bg: #ffffff;
  --ig-error: #ed4956;
  
  /* Modern Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ========================================
   Base Styles
   ======================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--ig-background);
  color: var(--ig-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Modern Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--ig-background);
}

::-webkit-scrollbar-thumb {
  background: var(--ig-text-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ig-text);
}

/* ========================================
   Navigation Bar (2020 Instagram Style)
   ======================================== */

.navbar {
  background-color: var(--ig-card-bg) !important;
  border-bottom: 1px solid var(--ig-border);
  padding: 0.5rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ig-secondary);
  text-decoration: none;
}

.navbar-brand:hover {
  color: var(--ig-secondary);
}

.navbar-nav .nav-link {
  color: var(--ig-secondary) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  transition: var(--transition-fast);
}

.navbar-nav .nav-link:hover {
  color: var(--ig-primary) !important;
}

.navbar-nav .nav-link.active {
  color: var(--ig-primary) !important;
}

.navbar-toggler {
  border: none;
}

/* Search Bar */
.search-bar {
  background-color: var(--ig-background);
  border: 1px solid var(--ig-border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  transition: var(--transition-fast);
}

.search-bar:focus {
  background-color: var(--ig-card-bg);
  border-color: var(--ig-text-light);
  box-shadow: none;
}

/* ========================================
   Instagram Feed Cards
   ======================================== */

.feed-container {
  max-width: 614px;
  margin: 0 auto;
  padding: 1rem 0;
}

.post-card {
  background-color: var(--ig-card-bg);
  border: 1px solid var(--ig-border);
  border-radius: 8px;
  margin-bottom: 2rem;
  overflow: hidden;
}

.post-header {
  display: flex;
  align-items: center;
  padding: 1rem;
}

.post-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 0.75rem;
  border: 1px solid var(--ig-border);
}

.post-username {
  font-weight: 600;
  color: var(--ig-text);
  text-decoration: none;
  font-size: 0.95rem;
}

.post-username:hover {
  text-decoration: underline;
}

.post-more {
  margin-left: auto;
  color: var(--ig-text);
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
}

.post-image {
  width: 100%;
  height: auto;
  aspect-ratio: 1/1;
  object-fit: cover;
}

.post-actions {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
}

.post-action {
  background: none;
  border: none;
  font-size: 1.5rem;
  margin-right: 1rem;
  color: var(--ig-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.post-action:hover {
  color: var(--ig-text);
  transform: scale(1.1);
}

.post-action.liked {
  color: var(--ig-error);
}

.post-action-save {
  margin-left: auto;
}

.post-likes {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0 1rem;
  margin-bottom: 0.5rem;
}

.post-caption {
  padding: 0 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.post-caption-username {
  font-weight: 600;
  margin-right: 0.5rem;
}

.post-comments {
  padding: 0 1rem;
  color: var(--ig-text-light);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.post-time {
  padding: 0 1rem 1rem;
  color: var(--ig-text-light);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.post-add-comment {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-top: 1px solid var(--ig-border);
}

.comment-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 0.95rem;
}

.comment-post {
  color: var(--ig-primary);
  font-weight: 600;
  font-size: 0.95rem;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.5;
  transition: var(--transition-fast);
}

.comment-input:valid ~ .comment-post {
  opacity: 1;
}

.comment-post:hover {
  color: var(--ig-primary-hover);
}

/* ========================================
   Stories Section
   ======================================== */

.stories-container {
  background-color: var(--ig-card-bg);
  border: 1px solid var(--ig-border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  white-space: nowrap;
}

.story {
  display: inline-block;
  width: 66px;
  text-align: center;
  margin-right: 1rem;
  text-decoration: none;
}

.story-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  padding: 2px;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.story-username {
  font-size: 0.75rem;
  color: var(--ig-text);
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   Sidebar (Suggestions)
   ======================================== */

.sidebar {
  position: sticky;
  top: 90px;
}

.user-profile {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 1rem;
}

.user-info {
  flex: 1;
}

.user-username {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ig-text);
  text-decoration: none;
}

.user-name {
  font-size: 0.9rem;
  color: var(--ig-text-light);
}

.switch-button {
  color: var(--ig-primary);
  font-weight: 600;
  font-size: 0.8rem;
  background: none;
  border: none;
  cursor: pointer;
}

.suggestions-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.suggestions-title {
  font-size: 0.9rem;
  color: var(--ig-text-light);
  font-weight: 600;
}

.see-all {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ig-text);
  text-decoration: none;
}

.suggestion {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.suggestion-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 0.75rem;
}

.suggestion-info {
  flex: 1;
}

.suggestion-username {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ig-text);
  text-decoration: none;
}

.suggestion-desc {
  font-size: 0.75rem;
  color: var(--ig-text-light);
}

.follow-button {
  color: var(--ig-primary);
  font-weight: 600;
  font-size: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
}

/* ========================================
   Buttons (Instagram Style)
   ======================================== */

.btn {
  border-radius: 8px;
  font-weight: 600;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  transition: var(--transition-fast);
  cursor: pointer;
}

.btn-primary {
  background-color: var(--ig-primary);
  border: none;
  color: white;
}

.btn-primary:hover {
  background-color: var(--ig-primary-hover);
  color: white;
}

.btn-outline {
  background: none;
  border: 1px solid var(--ig-border);
  color: var(--ig-text);
}

.btn-outline:hover {
  background-color: var(--ig-background);
  color: var(--ig-text);
}

.btn-text {
  background: none;
  border: none;
  color: var(--ig-primary);
  font-weight: 600;
  padding: 0;
}

.btn-text:hover {
  color: var(--ig-primary-hover);
  text-decoration: underline;
}

/* ========================================
   Profile Page
   ======================================== */

.profile-header {
  padding: 2rem 0;
}

.profile-info {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 2rem;
  border: 1px solid var(--ig-border);
}

.profile-stats {
  display: flex;
  margin-bottom: 1.5rem;
}

.profile-stat {
  margin-right: 2rem;
  text-align: center;
}

.profile-stat-count {
  font-weight: 700;
  font-size: 1.1rem;
}

.profile-stat-label {
  font-size: 0.9rem;
  color: var(--ig-text-light);
}

.profile-bio {
  margin-bottom: 1rem;
}

.profile-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.profile-edit {
  margin-top: 1rem;
}

.profile-tabs {
  border-top: 1px solid var(--ig-border);
  display: flex;
  justify-content: center;
}

.profile-tab {
  padding: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ig-text-light);
  text-decoration: none;
  display: flex;
  align-items: center;
}

.profile-tab.active {
  color: var(--ig-text);
  border-top: 1px solid var(--ig-text);
}

.profile-tab-icon {
  margin-right: 0.5rem;
  font-size: 1.1rem;
}

.profile-posts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.profile-post {
  aspect-ratio: 1/1;
  position: relative;
  cursor: pointer;
}

.profile-post img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-post-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition-fast);
}

.profile-post:hover .profile-post-overlay {
  opacity: 1;
}

.post-stats {
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  margin: 0 0.5rem;
}

.post-stats span {
  margin-left: 0.25rem;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 992px) {
  .sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .profile-info {
    flex-direction: column;
    text-align: center;
  }
  
  .profile-avatar {
    margin-right: 0;
    margin-bottom: 1rem;
  }
  
  .profile-stats {
    justify-content: center;
  }
  
  .profile-edit {
    width: 100%;
  }
}

@media (max-width: 576px) {
  .post-actions .post-action {
    font-size: 1.25rem;
    margin-right: 0.75rem;
  }
  
  .profile-stat {
    margin-right: 1rem;
  }
}

/* ========================================
   Utility Classes
   ======================================== */

.text-primary {
  color: var(--ig-primary);
}

.text-secondary {
  color: var(--ig-secondary);
}

.text-light {
  color: var(--ig-text-light);
}

.text-error {
  color: var(--ig-error);
}

.bg-primary {
  background-color: var(--ig-primary);
}

.bg-secondary {
  background-color: var(--ig-secondary);
}

.bg-light {
  background-color: var(--ig-background);
}

.rounded {
  border-radius: 8px;
}

.rounded-circle {
  border-radius: 50%;
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

.p-1 {
  padding: 0.5rem;
}

.p-2 {
  padding: 1rem;
}

.p-3 {
  padding: 1.5rem;
}

.p-4 {
  padding: 2rem;
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade {
  animation: fadeIn 0.3s ease-out;
}

.animate-slide-up {
  animation: slideUp 0.4s ease-out;
}

/* Like animation */
@keyframes heartBeat {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(1); }
  75% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.heart-beat {
  animation: heartBeat 0.5s ease-out;
}