:root {
  /* Colors - Legendary Dark Theme */
  --bg-primary: #000000;
  --bg-secondary: #16181c;
  --bg-accent: #202327;

  --text-primary: #e7e9ea;
  --text-secondary: #71767b;
  --text-muted: #536471;

  --brand-color: #1d9bf0;
  --brand-hover: #1a8cd8;

  --border-color: #2f3336;

  --danger: #f4212e;
  --success: #00ba7c;

  /* Spacing */
  --sidebar-width: 275px;
  --feed-width: 600px;
  --right-panel-width: 350px;

  /* Effects - Optimized */
  --glass-bg: rgba(0, 0, 0, 0.85);
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --backdrop-blur: blur(4px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: "Outfit", sans-serif;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

/* Layout */
.app-container {
  display: flex;
  justify-content: center;
  max-width: 1300px;
  margin: 0 auto;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  border-right: 1px solid var(--border-color);
}

.logo {
  padding: 16px 12px;
  font-size: 1.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links {
  margin-top: 10px;
  flex-grow: 1;
}

.nav-links li {
  margin-bottom: 8px;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px;
  border-radius: 30px;
  font-size: 1.2rem;
  transition: background 0.2s;
}

.nav-links a:hover {
  background-color: var(--bg-accent);
}

.nav-links li.active a {
  font-weight: 700;
}

.btn-primary {
  background-color: var(--brand-color);
  color: white;
  padding: 15px 0;
  border-radius: 30px;
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 20px;
  transition: background 0.2s;
  width: 90%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.btn-primary:hover {
  background-color: var(--brand-hover);
}

.user-profile-mini {
  margin-bottom: 20px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 30px;
  cursor: pointer;
  transition: background 0.2s;
}

.user-profile-mini:hover {
  background-color: var(--bg-accent);
}

.placeholder-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--text-muted);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.user-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.user-info .name {
  font-weight: 700;
  font-size: 0.95rem;
}

.user-info .handle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Main Feed */
.main-feed {
  width: var(--feed-width);
  border-right: 1px solid var(--border-color);
}

.feed-header {
  position: sticky;
  top: 0;
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feed-header h2 {
  padding: 16px;
  font-size: 1.3rem;
}

.header-actions {
  padding-right: 16px;
  cursor: pointer;
  font-size: 1.2rem;
}

.header-back {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
}

.header-back i {
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.header-back i:hover {
  background-color: var(--bg-accent);
}

.header-info {
  display: flex;
  flex-direction: column;
}

.header-info h2 {
  padding: 0;
  font-size: 1.2rem;
}

.header-info .post-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.tabs {
  display: flex;
}

.tab {
  flex: 1;
  background: transparent;
  color: var(--text-secondary);
  padding: 16px;
  font-weight: 600;
  position: relative;
  transition: color 0.2s;
}

.tab:hover {
  background-color: var(--bg-accent);
}

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

.tab.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background-color: var(--brand-color);
  border-radius: 2px;
}

/* Stories */
.stories-container {
  display: flex;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color);
  scrollbar-width: none; /* Firefox */
}

.stories-container::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-width: 70px;
}

.story-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--brand-color);
  padding: 2px;
  background-clip: content-box;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-item.create-story .story-avatar {
  border: 2px solid var(--text-muted);
  background-color: var(--bg-accent);
  color: var(--brand-color);
  font-size: 1.5rem;
}

.story-user {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70px;
}

/* Create Post */
.create-post-placeholder {
  padding: 16px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  cursor: text;
}

.create-post-placeholder input {
  flex-grow: 1;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-primary);
  outline: none;
  cursor: text;
}

/* Post Styles */
.post {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  transition: background 0.2s;
  cursor: pointer;
}

.post:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.post-content {
  flex-grow: 1;
}

.post-header {
  display: flex;
  gap: 5px;
  margin-bottom: 4px;
}

.post-header .name {
  font-weight: 700;
}

.post-header .handle,
.post-header .time {
  color: var(--text-secondary);
}

.post-text {
  margin-bottom: 10px;
  font-size: 1rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.hashtag {
  color: var(--brand-color) !important;
  cursor: pointer;
  font-weight: 500;
}

.hashtag:hover {
  text-decoration: underline;
}

.post-image img,
.post-video video {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  margin-bottom: 10px;
}

.post-actions {
  display: flex;
  justify-content: space-between;
  max-width: 400px;
  color: var(--text-secondary);
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: color 0.2s;
}

.action-btn:hover {
  color: var(--brand-color);
}

.action-btn.liked {
  color: var(--danger);
}

.action-btn.liked i {
  animation: pop 0.3s ease;
}

@keyframes pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

/* Poll Styles */
.poll-container {
  margin-bottom: 10px;
}

.poll-option {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  position: relative;
  height: 36px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--brand-color);
}

.poll-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background-color: rgba(29, 155, 240, 0.2);
  z-index: 1;
  transition: width 0.3s ease;
}

.poll-label {
  position: relative;
  z-index: 2;
  padding: 0 12px;
  font-weight: 600;
  flex-grow: 1;
}

.poll-percentage {
  position: relative;
  z-index: 2;
  padding-right: 12px;
  font-weight: 700;
}

.poll-input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.poll-option-input {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 4px;
  color: var(--text-primary);
  outline: none;
}

.poll-option-input:focus {
  border-color: var(--brand-color);
}

/* Emoji Picker */
.emoji-picker {
  position: absolute;
  bottom: 40px;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  width: 250px;
  height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.emoji-item {
  font-size: 1.5rem;
  cursor: pointer;
  text-align: center;
  padding: 5px;
  border-radius: 4px;
}

.emoji-item:hover {
  background-color: var(--bg-accent);
}

/* Messages View */
.messages-layout {
  display: flex;
  height: calc(100vh - 53px); /* Minus header */
}

.conversations-list {
  width: 40%;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
}

.conversation-item {
  padding: 16px;
  display: flex;
  gap: 10px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border-color);
}

.conversation-item:hover,
.conversation-item.active {
  background-color: var(--bg-accent);
}

.conversation-item .info {
  flex-grow: 1;
  overflow: hidden;
}

.conversation-item .last-msg {
  color: var(--text-secondary);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-window {
  width: 60%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.no-chat-selected {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 20px;
}

.no-chat-selected h2 {
  margin-bottom: 10px;
}

.no-chat-selected p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.active-chat-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.chat-messages {
  flex-grow: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
  cursor: pointer;
}

.message-bubble.sent {
  align-self: flex-end;
  background-color: var(--brand-color);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-bubble.received {
  align-self: flex-start;
  background-color: var(--bg-accent);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.msg-status {
  font-size: 0.7rem;
  margin-left: 5px;
  opacity: 0.8;
  display: inline-block;
}

.msg-edited {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-left: 5px;
  font-style: italic;
}

.message-bubble.deleted {
  font-style: italic;
  opacity: 0.7;
  background-color: var(--bg-accent);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Context Menu */
.context-menu {
  position: fixed;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 5px 0;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  min-width: 120px;
}

.context-menu .menu-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.9rem;
}

.context-menu .menu-item:hover {
  background-color: var(--bg-accent);
}

.context-menu .menu-item.danger {
  color: var(--danger);
}

.chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
}

.chat-input-area input {
  flex-grow: 1;
  background-color: var(--bg-accent);
  border: none;
  border-radius: 20px;
  padding: 10px 16px;
  color: var(--text-primary);
  outline: none;
}

.chat-input-area button {
  background: transparent;
  color: var(--brand-color);
  font-size: 1.2rem;
}

/* Explore Grid - Instagram Style */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 200px;
  gap: 4px;
  padding: 4px;
}

.explore-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background-color: var(--bg-accent);
}

.explore-item img,
.explore-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.explore-item:hover img {
  transform: scale(1.05);
}

/* Feature large items in grid */
.explore-item:nth-child(10n + 1) {
  grid-column: span 2;
  grid-row: span 2;
}

.explore-categories {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-primary);
  position: sticky;
  top: 53px;
  z-index: 10;
}

.category-btn {
  background: var(--bg-accent);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 20px;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.category-btn:hover {
  background: var(--border-color);
}

.category-btn.active {
  background: var(--brand-color);
  color: white;
}

/* Skeleton Loading Layer */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-accent) 25%,
    var(--border-color) 50%,
    var(--bg-accent) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-post {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-content {
  flex-grow: 1;
}

.skeleton-line {
  height: 12px;
  margin-bottom: 10px;
  width: 100%;
}

.skeleton-line.short {
  width: 60%;
}
.skeleton-media {
  height: 200px;
  width: 100%;
  border-radius: 16px;
  margin-top: 10px;
}

/* Profile View Styles */
.profile-hero {
  position: relative;
  margin-bottom: 12px;
}

.profile-banner {
  height: 200px;
  background-color: var(--bg-accent);
  background-image: linear-gradient(
    45deg,
    #202327 25%,
    #16181c 25%,
    #16181c 50%,
    #202327 50%,
    #202327 75%,
    #16181c 75%,
    #16181c 100%
  );
  background-size: 40px 40px;
}

.profile-avatar-large {
  width: 134px;
  height: 134px;
  border-radius: 50%;
  border: 4px solid var(--bg-primary);
  position: absolute;
  bottom: -67px;
  left: 16px;
  background-color: var(--bg-primary);
}

.profile-actions {
  position: absolute;
  bottom: -60px;
  right: 16px;
}

.btn-edit-profile {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
  transition: background 0.2s;
}

.btn-edit-profile:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.profile-details {
  margin-top: 75px;
  padding: 0 16px;
}

.profile-details h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.profile-details #profile-handle-display {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.profile-details .bio {
  margin-top: 12px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.profile-meta {
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  display: flex;
  gap: 16px;
}

.follow-stats {
  margin-top: 12px;
  display: flex;
  gap: 20px;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.follow-stats strong {
  color: var(--text-primary);
}

.clickable-stat {
  cursor: pointer;
}

.clickable-stat:hover {
  text-decoration: underline;
}

/* Right Panel */
.right-panel {
  width: var(--right-panel-width);
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  position: sticky;
  top: 0;
}

.search-bar-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-bar-header input {
  background: var(--bg-accent);
  border: none;
  border-radius: 30px;
  padding: 10px 20px;
  color: var(--text-primary);
  outline: none;
  width: 100%;
  font-size: 1rem;
}

.search-bar {
  background-color: var(--bg-accent);
  border-radius: 30px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.search-bar:focus-within {
  background-color: var(--bg-primary);
  border: 1px solid var(--brand-color);
}

.search-bar input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  outline: none;
  width: 100%;
}

.search-bar i {
  color: var(--text-secondary);
}

.card {
  background-color: var(--bg-secondary);
  border-radius: 16px;
  padding: 16px;
}

.card h3 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.trend-item {
  padding: 12px 0;
  cursor: pointer;
}

.trend-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.trend-item .meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
}

.trend-item h4 {
  margin: 2px 0;
  font-size: 1rem;
}

.follow-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  cursor: pointer;
}

.follow-item .info {
  flex-grow: 1;
}

.follow-item h4 {
  font-size: 0.95rem;
}

.follow-item span {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.btn-sm {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-primary);
  width: 100%;
  max-width: 450px;
  padding: 40px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content.glass-effect {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.modal-content.large-modal {
  max-width: 600px;
  width: 90%;
  padding: 0; /* Remove default padding for better control */
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.btn-close {
  background: transparent;
  font-size: 1.2rem;
  color: var(--text-primary);
  padding: 8px;
  border-radius: 50%;
}

.btn-close:hover {
  background-color: var(--bg-accent);
}

/* Privacy Dropdown */
.privacy-selector select {
  background: transparent;
  color: var(--brand-color);
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}

.privacy-selector select option {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.create-post-body {
  display: flex !important;
  gap: 12px;
  padding: 16px;
  width: 100%;
  align-items: flex-start;
}

.create-post-body textarea {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-family: inherit;
  resize: none;
  min-height: 150px;
  outline: none;
  padding-top: 8px;
  unicode-bidi: plaintext;
  text-align: start;
}

.create-post-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: 12px;
  display: flex;
  gap: 16px;
  color: var(--brand-color);
  font-size: 1.2rem;
}

.media-btn {
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.media-btn:hover {
  background-color: rgba(29, 155, 240, 0.1);
}

.media-preview {
  margin-top: 10px;
  border-radius: 16px;
  overflow: hidden;
  max-height: 300px;
}

.media-preview img {
  width: 100%;
  height: auto;
  display: block;
}

/* Comments List */
.comments-list-container {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.comment-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
}

.comment-content {
  flex-grow: 1;
}

.comment-header {
  margin-bottom: 4px;
}

.comment-header strong {
  margin-right: 5px;
}

.comment-header span {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* User List Modal */
.user-list-container {
  max-height: 400px;
  overflow-y: auto;
}

/* Select Users Modal */
.user-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
}

.user-select-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand-color);
}

/* Story Viewer */
.full-screen {
  background: #000;
  z-index: 3000;
}

.story-view-content {
  width: 100%;
  max-width: 450px;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

.story-progress-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  z-index: 10;
}

.story-progress-bar .progress {
  height: 100%;
  background: white;
  width: 0%;
  transition: width 0.1s linear;
}

.story-header {
  position: absolute;
  top: 24px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.story-image-container {
  flex-grow: 1;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.btn-close-story {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  color: white;
  font-size: 1.5rem;
  z-index: 20;
}

/* Auth Modal Locked */
.modal-overlay.locked {
  backdrop-filter: blur(5px);
  background: rgba(0, 0, 0, 0.85);
}

/* Auth Footer Fix */
.modal-footer {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

#auth-toggle-link {
  color: var(--brand-color);
  cursor: pointer;
  font-weight: 600;
}

#auth-toggle-link:hover {
  text-decoration: underline;
}

.forgot-password-link {
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.forgot-password-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Settings */
.settings-container {
  padding: 16px;
}

.setting-item {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.setting-item h3 {
  margin-bottom: 8px;
}

.setting-item p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.modal-content.glass-effect {
  background: rgba(20, 20, 20, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  /* Removed heavy blur */
}

.input-group {
  position: relative;
  margin-bottom: 25px;
}

.input-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 14px 16px;
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  will-change: transform, opacity;
}

.input-group label {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 1rem;
  background: transparent;
}

.input-group input:focus {
  border-color: var(--brand-color);
  background: rgba(29, 155, 240, 0.05);
  box-shadow: 0 0 15px rgba(29, 155, 240, 0.2);
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: 0;
  left: 14px;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--brand-color);
  background: #0f0f0f;
  padding: 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary.btn-block {
  background: linear-gradient(135deg, #1d9bf0 0%, #0072b1 100%);
  border: none;
  box-shadow: 0 10px 20px rgba(29, 155, 240, 0.3);
  height: 50px;
  font-size: 1.1rem;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.btn-primary.btn-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 25px rgba(29, 155, 240, 0.4);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
}

/* Edit Profile Modal Fix */
#edit-profile-modal .modal-content {
  text-align: left;
}

#edit-profile-modal .input-group {
  margin-bottom: 16px;
}

#edit-profile-modal label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

#edit-profile-modal input {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.profile-upload-section {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
}

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 12px;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
}

.mobile-nav a {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.create-mobile {
  background-color: var(--brand-color);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white !important;
  margin-top: -25px;
  box-shadow: 0 4px 10px rgba(29, 155, 240, 0.3);
}

.mobile-only {
  display: none;
}

/* Responsive */
@media (max-width: 1200px) {
  .sidebar {
    width: 80px;
    align-items: center;
  }
  .sidebar .logo span,
  .sidebar .nav-links span,
  .sidebar .btn-text,
  .sidebar .user-info,
  .sidebar .fa-ellipsis {
    display: none;
  }
  .sidebar .btn-primary {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .user-profile-mini {
    width: 50px;
    height: 50px;
    padding: 0;
    justify-content: center;
  }
  .app-container {
    justify-content: flex-start;
  }
}

@media (max-width: 1000px) {
  .right-panel {
    display: none;
  }
  .main-feed {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-right: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
  }
}

/* Explore Item Overlay */
.explore-item::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.2rem;
}

.explore-item:hover::after {
  opacity: 1;
}

/* Post Refinement */
.post {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeIn 0.5s ease-out;
}

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

.post:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.post-text {
  font-size: 1.05rem;
  letter-spacing: -0.2px;
}

/* Feed Empty State Suggestions */
.suggested-users-feed {
  padding: 20px;
  background: var(--bg-secondary);
  margin: 16px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

.suggested-users-feed h3 {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

@media (max-width: 500px) {
  .sidebar {
    display: none;
  }
  .mobile-nav {
    display: flex;
  }
  .main-feed {
    border: none;
    padding-bottom: 70px;
  }
  .feed-header h2 {
    display: block;
  }
  .mobile-only {
    display: block;
  }
}

.btn-ai-magic {
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  will-change: transform, opacity;
}

.btn-ai-magic:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.6);
  filter: brightness(1.1);
}

.btn-ai-magic:active {
  transform: translateY(0);
}

.btn-ai-magic.thinking {
  animation: ai-pulse 1.5s infinite;
  opacity: 0.8;
  cursor: wait;
}

@keyframes ai-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(168, 85, 247, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0);
  }
}

/* --- FINAL REFINED UI FIXES --- */

/* Modal Content & Layout */
.modal-content {
  display: flex;
  flex-direction: column;
  padding: 20px;
  max-width: 600px;
  width: 90%;
}

/* --- THE DEFINITIVE UI CONSISTENCY FIX --- */

.modal-overlay {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content.large-modal {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Space items correctly */
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-color);
  min-height: 53px;
}

.modal-header-row h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.privacy-selector {
  flex-grow: 1;
  margin-left: 15px;
}

.btn-close {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
}

/* Original Post Section */
.original-post-preview {
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
}

/* Reply Body - Modern Layout */
.create-post-body {
  display: flex !important;
  padding: 16px;
  gap: 12px;
  width: 100%;
  align-items: flex-start; /* Start from top */
}

.create-post-body .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.create-post-body textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-size: 1.2rem;
  line-height: 1.4;
  resize: none;
  min-height: 150px;
  padding-top: 10px !important;
  text-align: start !important; /* Automatic alignment based on language */
  unicode-bidi: plaintext !important; /* The magic for Arabic/English */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  -ms-overflow-style: none; /* Hide scrollbar for IE/Edge */
}

.create-post-body textarea::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

/* Footer & Buttons consistency */
.create-post-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-icons {
  display: flex;
  gap: 15px;
  color: var(--brand-color);
  font-size: 1.2rem;
}

.btn-ai-magic {
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  font-size: 0.9rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand-color) 0%, #a259ff 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
}

#submit-comment-btn,
#submit-post-btn {
  height: 34px;
  padding: 0 20px;
  border-radius: 17px;
  background-color: var(--text-primary);
  color: var(--bg-primary);
  font-size: 0.95rem;
  font-weight: 700;
  width: auto !important; /* Prevent stretching */
  margin: 0;
}

#submit-post-btn {
  background-color: var(--brand-color);
  color: white;
}

/* Scroll improvements */
.comments-list-container {
  max-height: 200px;
  overflow-y: auto;
}
.comments-list-container:empty {
  display: none;
}
