* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-primary: #000000;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  --card-bg: #1a1a1a;
  --input-bg: #222222;
  --border-color: #333333;
  --text-color: #ffffff;
  --text-muted: #888888;
  --text-light: #cccccc;
  --accent-color: #1f3a8a;
  --accent-secondary: #1e293b;
  --danger-color: #ff4757;
  --success-color: #2ed573;
  --warning-color: #ffa502;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
}

[data-theme="light"] {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f0f0;
  --card-bg: #ffffff;
  --input-bg: #f0f0f0;
  --border-color: #dddddd;
  --text-color: #333333;
  --text-muted: #666666;
  --text-light: #444444;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-color);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  padding-bottom: 70px;
}

.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.left-buttons,
.right-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-color);
  letter-spacing: 1px;
  flex: 1;
  text-align: center;
}

.right-buttons {
  justify-content: flex-end;
}

.action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 18px;
}

.action-btn:hover {
  background: var(--accent-color);
  color: white;
  transform: scale(1.05);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  opacity: 0.6;
}

.nav-item.active {
  opacity: 1;
}

.nav-item.active .nav-icon {
  background: var(--accent-color);
  color: white;
}

.nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--input-bg);
  color: var(--text-color);
  transition: var(--transition);
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.feed-content,
.chat-container,
.discover-container,
.settings-container,
.inbox-container,
.dm-chat-interface {
  padding-top: 70px;
  padding-bottom: 70px;
  min-height: 100vh;
  overflow-y: auto;
}

.profile-container {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 60px;
  background: var(--bg-primary);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.profile-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  z-index: 2;
  transition: var(--transition);
  padding: 20px 16px;
}

.profile-header.collapsed {
  /* padding: 10px 16px; */
}


.profile-header.collapsed .profile-avatar {
  width: 40px;
  height: 40px;
  font-size: 16px;
  margin: 0 auto 8px;
}

.profile-header.collapsed .profile-name {
  font-size: 14px;
  text-align: center;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.profile-header.collapsed .profile-bio,
.profile-header.collapsed .profile-stats,
.profile-header.collapsed .profile-buttons,
.profile-header.collapsed .chat-with-me-link {
  opacity: 0;
  pointer-events: none;
}


.profile-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 20px;
  -webkit-overflow-scrolling: touch;
  padding-top: 16px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: white;
  margin: 0 auto 16px;
  border: 3px solid var(--bg-primary);
  overflow: hidden;
  transition: var(--transition);
}

.profile-avatar img,
.discover-avatar img,
.conversation-avatar img,
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text-color);
  transition: var(--transition);
}

.profile-bio {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  margin-bottom: 16px;
  padding: 0 8px;
}

.chat-with-me-link {
  display: block;
  text-align: center;
  color: var(--accent-color);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 20px;
  cursor: pointer;
  text-decoration: none;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-number {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-color);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.profile-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  width: 100%;
}

.follow-btn,
#editProfileBtn,
#followBtn,
#messageUserBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 200px;
  min-width: 150px;
  height: 44px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  padding: 0 20px;
  text-align: center;
}

#messageUserBtn {
  background: var(--accent-secondary);
}

.follow-btn:hover,
#editProfileBtn:hover,
#followBtn:hover,
#messageUserBtn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.profile-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-top: 0;
}

.profile-post-item {
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  background: var(--card-bg);
  cursor: pointer;
  transition: var(--transition);
}

.profile-post-item:hover {
  opacity: 0.9;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: 60px;
  padding-bottom: 60px;
}

.chat-header {
  position: sticky;
  top: 0;
  z-index: 20;
  top: 60px;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 900;
}

.chat-title,
.discover-title,
.settings-title,
.inbox-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-color);
}

.bot-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-toggle {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.mode-toggle.active {
  background: var(--accent-color);
  color: white;
}

.bot-selector-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.bot-selector-btn:hover {
  background: var(--accent-color);
  color: white;
}

#currentBotName {
  font-weight: 600;
  font-size: 14px;
}

.bot-dropdown {
  position: fixed;
  top: 120px;
  right: 16px;
  width: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1001;
  display: none;
  max-height: 400px;
  overflow-y: auto;
}

.bot-dropdown.active {
  display: block;
}

.bot-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-color);
}

.bot-option:last-child {
  border-bottom: none;
}

.bot-option:hover,
.bot-option.active {
  background: var(--accent-color);
  color: white;
}

.bot-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.bot-info {
  flex: 1;
}

.bot-name {
  font-weight: 600;
  font-size: 14px;
}

.bot-description {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.8;
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 60px 16px 100px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  line-height: 1.4;
  position: relative;
  animation: fadeIn 0.3s ease;
}

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

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

.bubble.bot {
  background: var(--card-bg);
  color: var(--text-color);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-color);
}

.input-area {
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 900;
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  border: 1px solid var(--border-color);
}

.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 16px;
  outline: none;
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-color);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: var(--transition);
}

.send-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.create-post-modal,
.profile-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.create-post-modal.open,
.profile-modal.open {
  display: flex;
}

.create-post-modal-content,
.profile-modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.create-post-modal-content h2,
.profile-modal-content h2 {
  margin-bottom: 20px;
  color: var(--text-color);
}

.create-post-modal-content textarea,
.profile-modal-content textarea {
  width: 100%;
  min-height: 100px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-color);
  padding: 12px;
  font-size: 16px;
  resize: vertical;
  margin-bottom: 16px;
}

.create-post-modal-content input[type="file"],
.profile-modal-content input[type="file"] {
  width: 100%;
  margin-bottom: 20px;
  padding: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-color);
}

.modal-actions,
.profile-modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions button,
.profile-modal-actions button {
  flex: 1;
  height: 44px;
  border-radius: var(--radius);
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.modal-actions button:first-child,
.profile-modal-actions button:last-child {
  background: var(--accent-color);
  color: white;
}

.modal-actions button:last-child,
.profile-modal-actions button:first-child {
  background: var(--input-bg);
  color: var(--text-color);
}

.discover-container {
  display: flex;
  flex-direction: column;
  padding-top: 60px;
}

.discover-header {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 900;
}

.discover-content {
  padding-top: 60px;
  padding-bottom: 20px;
}

#suggestedUsers {
  display: flex;
  flex-direction: row;
  gap: 12px;
  padding: 8px 12px;
  overflow-x: auto;
}

.discovery-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.discover-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}



.discover-feed {
  padding: 0 16px 20px;
}

.settings-container {
  padding-top: 60px;
}

.settings-header {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 900;
}

.settings-content {
  padding-top: 60px;
  padding-bottom: 20px;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 16px 8px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item:hover {
  background: var(--input-bg);
}

.settings-item-label {
  font-size: 16px;
  color: var(--text-color);
}

.settings-item-value {
  font-size: 14px;
  color: var(--text-muted);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  transition: .4s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 3px;
  background: var(--text-color);
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background: var(--accent-color);
  border-color: var(--accent-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background: white;
}

.inbox-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 1100;
  display: flex;
  flex-direction: column;
}

.inbox-header {
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.inbox-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--input-bg);
  border: none;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.conversation-item:hover {
  background: var(--input-bg);
}

.conversation-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}

.conversation-name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.conversation-name span:first-child {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-time {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 8px;
}

.conversation-last-message {
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-unread {
  background: var(--accent-color);
  color: white;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dm-chat-interface {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 1200;
  display: flex;
  flex-direction: column;
}

.chat-header {
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  flex-shrink: 0;
}

.chat-back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--input-bg);
  border: none;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  margin-right: 12px;
}

.chat-user-info {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-color);
}

.chat-window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 2000;
  display: none;
  flex-direction: column;
  border: 1px solid var(--border-color);
}

.chat-window.active {
  display: flex;
}

.chat-window-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-window-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-color);
}

.chat-window-header button {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  margin-left: 8px;
}

.chat-window-header button:hover {
  background: var(--accent-color);
  color: white;
}

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

.message-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  line-height: 1.4;
}

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

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

.message-sender {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.8;
}

.message-time {
  font-size: 11px;
  text-align: right;
  margin-top: 4px;
  opacity: 0.6;
}

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

.chat-input-area input {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-color);
  padding: 12px;
  font-size: 16px;
  outline: none;
}

.chat-input-area input::placeholder {
  color: var(--text-muted);
}

.chat-input-area button {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.feed-item {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px;
  margin-bottom: 0;
  position: relative;
}

.feed-item-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feed-item-user {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  min-height: 40px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
  position: absolute;
  left: 0;
  top: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
  padding-left: 52px;
  padding-right: 80px;
}

.username {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-color);
  margin-bottom: 2px;
  line-height: 1.2;
}

.user-bio {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.2;
}

.feed-item .follow-btn {
  position: absolute;
  right: 0;
  top: 0;
  width: auto;
  min-width: 80px;
  height: 32px;
  font-size: 13px;
  padding: 0 12px;
  margin: 0;
  border-radius: 16px;
  white-space: nowrap;
}

.feed-item-caption {
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-color);
  margin-top: 4px;
}

.feed-item-media {
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 8px;
}

.post-media {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  border-radius: var(--radius);
}

.side-actions {
  display: flex;
  gap: 24px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.side-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.side-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-color);
}

.side-action-icon:hover {
  background: var(--accent-color);
  color: white;
}

.side-action-icon i.liked {
  color: var(--danger-color);
}

.side-action-count {
  font-size: 14px;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

.avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  color: white;
  font-weight: 700;
}

.clip-post-display {
  margin: 15px 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.clip-post-item {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

@supports (padding: max(0px)) {
  .bottom-nav {
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
  .top-header {
    padding-top: max(0px, env(safe-area-inset-top));
    height: calc(60px + env(safe-area-inset-top, 0px));
  }
  .profile-container {
    top: calc(60px + env(safe-area-inset-top, 0px));
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 768px) {
  .profile-buttons {
    gap: 6px;
    margin-bottom: 12px;
  }
  .follow-btn,
  #editProfileBtn,
  #followBtn,
  #messageUserBtn {
    max-width: 180px;
    min-width: 120px;
    height: 40px;
    font-size: 14px;
    padding: 0 16px;
  }
  .profile-header.collapsed .profile-buttons {
    display: none !important;
  }
}

@media (max-width: 375px) {
  .profile-buttons {
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  .follow-btn,
  #editProfileBtn,
  #followBtn,
  #messageUserBtn {
    max-width: 160px;
    min-width: 100px;
    height: 36px;
    font-size: 13px;
    padding: 0 12px;
  }
}

.profile-header.collapsed .profile-buttons {
  display: none !important;
}

.profile-avatar {
  width: 70px;
  height: 70px;
  font-size: 28px;
  margin-bottom: 12px;
}

.profile-name {
  font-size: 20px;
  margin-bottom: 4px;
}

.profile-bio {
  font-size: 13px;
  margin-bottom: 16px;
  padding: 0 4px;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.profile-stats {
  gap: 20px;
  margin-bottom: 16px;
}

.stat-number {
  font-size: 18px;
}

.stat-label {
  font-size: 11px;
}

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

.feed-item {
  padding: 12px;
}

.feed-item-user {
  gap: 10px;
}

.user-info {
  padding-right: 70px;
}

.feed-item .follow-btn {
  min-width: 70px;
  height: 28px;
  font-size: 12px;
  padding: 0 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
}

.user-info {
  padding-left: 46px;
}

.bottom-nav {
  height: 62px;
}

.nav-item {
  padding: 6px 8px;
}

.nav-icon {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.nav-label {
  font-size: 9px;
}

.input-area {
  padding: 10px 12px;
}

.input-wrapper {
  padding: 6px 10px;
}

.send-btn {
  width: 44px;
  height: 44px;
}

.create-post-modal-content,
.profile-modal-content {
  padding: 20px;
  margin: 16px;
  max-height: 85vh;
}

.bubble {
  max-width: 90%;
  padding: 10px 14px;
}

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

.profile-header.collapsed {
  padding: 8px 12px;
}

.profile-header.collapsed .profile-avatar {
  width: 36px;
  height: 36px;
  font-size: 14px;
  margin-bottom: 4px;
}

.profile-header.collapsed .profile-name {
  font-size: 13px;
  margin-bottom: 2px;
}

.chat-with-me-link {
  font-size: 13px;
  margin-bottom: 16px;
}

@media (max-width: 375px) {
  .profile-posts-grid {
    grid-template-columns: repeat(1, 1fr);
  }
  .profile-avatar {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }
  .profile-name {
    font-size: 18px;
  }
  .profile-stats {
    gap: 15px;
  }
  .feed-item .follow-btn {
    min-width: 60px;
    font-size: 11px;
    padding: 0 8px;
  }
  .user-info {
    padding-right: 65px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .profile-posts-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
}



@supports (-webkit-touch-callout: none) {
  body {
    overscroll-behavior-y: none;
  }
}





@media (hover: none) and (pointer: coarse) {
  button,
  .action-btn,
  .nav-item,
  .follow-btn {
    min-height: 44px;
  }
  .feed-item .follow-btn {
    min-height: 32px;
  }
  input,
  textarea {
    font-size: 16px !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --border-color: #ffffff;
  }
  .action-btn,
  .follow-btn {
    border-width: 2px;
  }
}

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

.search-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.search-modal.hidden {
  display: none;
}

.search-box {
  width: 90%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px;
}

.search-header {
  display: flex;
  gap: 8px;
}

.search-header input {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: var(--input-bg);
  color: var(--text-color);
}

.search-header button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}

.search-results {
  margin-top: 10px;
}

.search-result {
  padding: 10px;
  cursor: pointer;
  border-radius: 8px;
}

.search-result:hover {
  background: var(--input-bg);
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.onboarding-overlay.hidden {
  display: none;
}

.onboarding-modal {
  width: 100%;
  max-width: 420px;
  background: #111;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  color: #fff;
}

.onboarding-modal h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.onboarding-subtitle {
  margin-bottom: 20px;
  color: #aaa;
  font-size: 14px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: #ccc;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: #1c1c1c;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #4caf50;
}

.avatar-group {
  margin-bottom: 20px;
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #222;
  object-fit: cover;
}

.avatar-upload-btn {
  background: #222;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}

.avatar-upload-btn:hover {
  background: #2a2a2a;
}

.char-count {
  margin-top: 4px;
  font-size: 12px;
  color: #777;
  text-align: right;
}

#completeProfileBtn {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  background: #4caf50;
  color: #000;
  cursor: pointer;
}

#completeProfileBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.onboarding-section {
  margin-bottom: 20px;
}

.onboarding-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  opacity: 0.85;
}

.onboarding-select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  background: #111;
  color: #fff;
  border: 1px solid #333;
}

.avatar-preview-wrapper {
  width: 64px;
  height: 64px;
}

.avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: #222;
}

.avatar-preview.hidden {
  display: none;
}

.avatar-helper-text {
  font-size: 12px;
  opacity: 0.6;
}

.ig-post-viewer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 3000;
  display: none;
  flex-direction: column;
}

.ig-post-viewer.active {
  display: flex;
}

.ig-viewer-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 3001;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ig-viewer-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
  margin-right: 12px;
  flex-shrink: 0;
}

.ig-viewer-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ig-viewer-title {
  font-size: 16px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ig-viewer-posts {
  flex: 1;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding-top: 60px;
}

.ig-viewer-post {
  min-height: calc(100vh - 60px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  position: relative;
}

.ig-viewer-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #000;
}

.ig-viewer-media img {
  width: 100%;
  height: auto;
  max-height: 100vh;
  object-fit: contain;
}

.ig-viewer-media video {
  width: 100%;
  height: auto;
  max-height: 100vh;
  object-fit: contain;
  background: #000;
}

.ig-viewer-info {
  padding: 16px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ig-viewer-caption {
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 12px;
  word-break: break-word;
}

.ig-viewer-stats {
  display: flex;
  gap: 16px;
  font-size: 14px;
  opacity: 0.8;
}

.ig-viewer-stats i {
  margin-right: 4px;
}

.ig-clip-viewer {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
  padding: 20px;
}

.ig-clip-viewer h3 {
  font-size: 24px;
  margin-bottom: 20px;
  font-weight: 600;
}

.ig-clip-player {
  width: 100%;
  max-width: 500px;
  margin: 20px 0;
}

.ig-clip-player audio {
  width: 100%;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.ig-clip-info {
  margin-top: 20px;
  font-size: 14px;
  opacity: 0.8;
}

@media (hover: none) and (pointer: coarse) {
  .ig-viewer-media video,
  .ig-viewer-media img {
    touch-action: pan-y;
  }
}

#profilePostsGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  min-height: 300px;
}

.custom-bot-list {
  padding: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.custom-bot-card {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
}

.custom-bot-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 18px;
  color: white;
}

.custom-bot-info {
  flex: 1;
}

.custom-bot-info h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
  color: var(--text-color);
}

.custom-bot-info p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.chat-with-bot-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}

.chat-with-bot-btn:hover {
  opacity: 0.9;
}

.no-custom-bots {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.no-custom-bots p {
  margin: 12px 0 20px;
}

.create-bot-btn {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
}

.comments-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-modal {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.comment-item {
  display: flex;
  margin-bottom: 16px;
}

.comment-avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-right: 12px;
}

.comment-content {
  flex: 1;
}

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

.comment-username {
  font-weight: 600;
  margin-right: 8px;
}

.comment-time {
  color: #999;
  font-size: 14px;
}

.comment-actions {
  margin-top: 8px;
  display: flex;
  gap: 16px;
}

.comment-actions button {
  background: none;
  border: none;
  color: #666;
  font-size: 14px;
  cursor: pointer;
}

.add-comment {
  padding: 16px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.add-comment textarea {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 16px;
  resize: none;
  max-height: 100px;
  font-family: inherit;
  font-size: 14px;
}

.post-comment-btn {
  background: #0095f6;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
}

.post-comment-btn:disabled {
  background: #b2dffc;
  cursor: not-allowed;
}

.action-btn.hamburger,
.action-btn.hamburger i,
.action-btn .fa-bars {
  color: #ffffff;
  background: transparent;
}

[data-theme="light"] .action-btn.hamburger i {
  color: #000000;
}

.main-menu {
  position: fixed;
  top: 60px;
  right: 12px;
  background-color: #0a0a0a !important;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
  padding: 8px 0;
  min-width: 220px;
  z-index: 9999;
}

.main-menu a {
  display: block;
  padding: 12px 16px;
  color: #e5e7eb !important;
  text-decoration: none;
  font-size: 15px;
}

.main-menu a:hover {
  background: rgba(255, 255, 255, .06);
}

.main-menu.hidden {
  display: none;
}

.profile-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.profile-post-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #000;
}

.profile-post-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  flex: 1;
}

html[data-theme="dark"] .brand-title {
  color: #ffffff;
}

html[data-theme="light"] .brand-title {
  color: #000000;
}


.designer-btn {
  display: none;
}


.fa-heart.liked {
  color: #ff3b3b;
}


.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.comment-item .avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-body {
  flex: 1;
}

.comment-body .username {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.comment-body .text {
  font-size: 14px;
  line-height: 1.4;
}

/* Base (light mode) */
.comments-modal .modal-content {
  background: #ffffff;
  color: #111111;
}

/* Dark mode override */
body.dark .comments-modal .modal-content,
[data-theme="dark"] .comments-modal .modal-content {
  background: #0f0f0f;
  color: #e5e7eb;
}

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}

.comment-item .avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-body {
  flex: 1;
}

/* Light mode text */
.comment-body .username { color: #2563eb; font-weight: 600; }
.comment-body .text { color: #111111; }
.comment-body .time { color: #6b7280; font-size: 12px; }

/* Dark mode text */
body.dark .comment-body .username,
[data-theme="dark"] .comment-body .username {
  color: #60a5fa;
}

body.dark .comment-body .text,
[data-theme="dark"] .comment-body .text {
  color: #e5e7eb;
}

body.dark .comment-body .time,
[data-theme="dark"] .comment-body .time {
  color: #9ca3af;
}


.profile-post-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--card-bg);
  cursor: pointer;
  transition: transform 0.15s;
}

.profile-post-item:hover {
  transform: scale(1.02);
}

.delete-post-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.65);
  color: white;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
  font-size: 1.1rem;
}

.profile-post-item:hover .delete-post-btn {
  opacity: 1;
}



.feed-item {
  position: relative;
}

.feed-item-content {
  max-width: 520px;
  margin: 0 auto;
}


.post-media-wrapper {
  width: 100%;
  margin-top: 8px;
}

.post-media-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 10px;
}

.post-media-item {
  flex: 0 0 auto;
  width: 100%;
  max-width: 520px;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  scroll-snap-align: start;
}

.side-actions {
  display: flex;
  justify-content: space-around;
  gap: 24px;
  margin-top: 12px;
  padding: 8px 0;
}



.ig-viewer-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.ig-viewer-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
}

.ig-viewer-slide img,
.ig-viewer-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}



.ig-viewer-carousel-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.ig-viewer-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

.ig-viewer-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
}

.ig-viewer-slide img,
.ig-viewer-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* dots */
.carousel-dots {
  position: absolute;
  bottom: 10px;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.carousel-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
}

.carousel-dots .dot.active {
  background: white;
}

/* arrows */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  color: white;
  border: none;
  font-size: 28px;
  padding: 6px 10px;
  cursor: pointer;
  z-index: 2;
}

.carousel-arrow.left { left: 5px; }
.carousel-arrow.right { right: 5px; }

@media (hover: none) {
  .carousel-arrow {
    display: none;
  }
}



.feed-carousel-wrapper {
  position: relative;
  width: 100%;
}

.feed-carousel {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;          /* 🔑 stop vertical stacking */
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  width: 100%;
}

.feed-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  position: relative;
}

.feed-slide img,
.feed-slide video {
  width: 100%;
  height: 420px;               /* 🔑 FORCE a frame height */
  object-fit: cover;
  display: block;              /* 🔑 remove inline gaps */
}




/* dots */
.feed-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}

.feed-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
}

.feed-dots .dot.active {
  background: white;
}


.profile-post-item {
  position: relative;
}

.post-stats-mini {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.35);
  color: white;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.profile-post-item:hover .post-stats-mini {
  opacity: 1;
}

/* FEED MEDIA — INSTAGRAM RULE */
.feed-media-frame {
  width: 100%;
  aspect-ratio: 1 / 1;          /* 🔑 square feed */
  background: #000;
  overflow: hidden;
  position: relative;
}

.feed-media-frame img,
.feed-media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;            /* 🔑 crop, don’t stretch */
  display: block;
}



/* ────────────────────────────────────────────────
   Share / Repost Modal CSS
   Drop this into your main stylesheet or a dedicated modal.css
───────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay[style*="display: flex"] {
  opacity: 1;
  visibility: visible;
}

.share-modal-content {
  background: #111111;
  border: 1px solid #222222;
  border-radius: 16px;
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font-family: system-ui, -apple-system, sans-serif;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 32px;
  color: #777777;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
  color: #ffffff;
}

.share-modal-content h2 {
  margin: 0 0 24px 0;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
}

/* Repost Section */
.repost-section {
  margin-bottom: 28px;
}

.repost-section h3 {
  margin: 0 0 12px 0;
  font-size: 1.2rem;
  color: #bbbbbb;
}

#repost-textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #333333;
  background: #1a1a1a;
  color: #ffffff;
  font-size: 1rem;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

#repost-textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.repost-hint {
  font-size: 0.82rem;
  color: #888888;
  margin: 8px 0 16px;
  line-height: 1.4;
}

.btn-repost {
  background: #6366f1;
  color: white;
  border: none;
  padding: 14px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn-repost:hover {
  background: #4f46e5;
}

.btn-repost:active {
  transform: scale(0.98);
}

/* Divider */
.modal-divider {
  border: none;
  border-top: 1px solid #222222;
  margin: 24px 0;
}

/* External Share Section */
.external-share-section h3 {
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  color: #bbbbbb;
}

.copy-row {
  display: flex;
  margin-bottom: 20px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #333333;
}

#share-url-input {
  flex: 1;
  padding: 14px 16px;
  border: none;
  background: #1a1a1a;
  color: #ffffff;
  font-size: 0.95rem;
}

#btn-copy-url {
  padding: 0 20px;
  background: #2a2a2a;
  color: #ffffff;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

#btn-copy-url:hover {
  background: #3a3a3a;
}

.social-share-buttons {
  display: flex;
  gap: 12px;
}

.social-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  text-decoration: none;
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.95rem;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.social-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.social-btn.facebook {
  background: #1877f2;
}

.social-btn.reddit {
  background: #ff4500;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .share-modal-content {
    padding: 20px;
    border-radius: 12px;
  }

  .social-share-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .btn-repost {
    padding: 16px;
  }
}


/* ────────────────────────────────────────────────
   Repost Container (the whole quoted/reposted block)
   ──────────────────────────────────────────────── */
.repost-card {
  background: rgba(40, 40, 50, 0.4);        /* subtle dark tint */
  border: 1px solid rgba(100, 100, 120, 0.3);
  border-radius: 12px;
  margin: 12px 0;
  padding: 12px 16px;
  position: relative;
  overflow: hidden;
}

/* Small "Reposted" badge at the top */
.repost-card::before {
  content: "Reposted";
  position: absolute;
  top: -10px;
  left: 16px;
  background: var(--accent-color, #667eea);
  color: white;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  line-height: 1;
  z-index: 1;
}

/* Optional: slight left border accent */
.repost-card {
  border-left: 4px solid var(--accent-color, #667eea);
  padding-left: 20px;
}

/* The quoted text (user's added comment) */
.repost-quote {
  font-style: italic;
  color: #ccc;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* The original post content being reposted */
.repost-original {
  color: #e0e0e0;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* When original is missing/unavailable */
.repost-original span {
  color: #777;
  font-style: italic;
}

/* Make reposts look nested / contextual in feed */
.feed-item .repost-card {
  margin: 8px 0 16px;
  font-size: 0.96rem;
}

/* In profile grid preview (small version) */
.profile-post-item .repost-card {
  font-size: 0.82rem;
  padding: 8px 10px;
  margin: 4px 0;
  border-radius: 8px;
}

/* In IG-style full-screen viewer */
.ig-viewer-post .repost-card {
  margin: 16px 0;
  padding: 16px 20px;
  font-size: 1.05rem;
  border-radius: 16px;
}

/* Dark mode friendliness (if you have a theme switch) */
[data-theme="dark"] .repost-card {
  background: rgba(30, 30, 40, 0.6);
  border-color: rgba(80, 80, 100, 0.4);
}

[data-theme="dark"] .repost-quote {
  color: #bbb;
}


/* 🧠 Allow reposts to escape square profile grid */
.profile-post-item:has(.repost-card) {
  aspect-ratio: unset;
  height: auto;
  overflow: visible;
}

/* Ensure inner wrappers don't clip reposts */
.profile-post-item:has(.repost-card) > * {
  overflow: visible !important;
  height: auto !important;
  aspect-ratio: unset !important;
}


.repost-card {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.repost-original {
  max-height: 160px;
  overflow: hidden;
}

.repost-original::after {
  content: "";
  display: block;
  height: 24px;
  background: linear-gradient(
    rgba(0,0,0,0),
    rgba(0,0,0,0.6)
  );
}




/* TEMP DEBUG - force profile images to be visible */
.profile-post-item {
  aspect-ratio: auto !important;     /* ← kill the forced square */
  height: auto !important;
  min-height: 200px;                 /* give it breathing room */
  overflow: visible !important;      /* stop hiding content */
  background: #222 !important;       /* so we see if image failed */
}

.profile-post-item img,
.profile-post-item video {
  width: 100% !important;
  height: auto !important;           /* let natural aspect ratio win */
  max-height: 400px !important;
  object-fit: contain !important;    /* show whole image, don't crop */
  display: block !important;
}








.profile-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;                    /* or 3px/4px — your preference */
}

.profile-post-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;         /* ← this is the golden rule */
  overflow: hidden;
  background: var(--card-bg);  /* fallback color while loading */
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.profile-post-item:hover {
  transform: scale(1.02);
  opacity: 0.95;               /* optional subtle feedback */
}

/* Kill any accidental auto/override heights from other rules or media queries */
.profile-post-item,
.profile-post-item * {
  box-sizing: border-box;
}

/* Absolute-fill the nested frames */
.profile-media-frame,
.profile-media-frame .feed-media-frame {
  position: absolute;
  inset: 0;                    /* top/right/bottom/left: 0 */
  width: 100%;
  height: 100%;
}

/* Final image/video layer — fill + crop */
.profile-media-frame img,
.profile-media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;           /* or contain — but cover is classic IG grid */
  display: block;
  object-position: center;
}

/* Optional: loading / broken image fallback */
.profile-media-frame img:not([src]),
.profile-media-frame video:not([src]) {
  opacity: 0.3;
}



.repost-badge {
  position: absolute;
  top: 8px;
  left: 12px;
  z-index: 2;
  background: rgba(100, 100, 100, 0.75);
  color: #ddd;
  font-size: 0.78rem;
  padding: 3px 9px 3px 7px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

.repost-badge i {
  font-size: 0.9rem;
}

.feed-item.is-repost {
  /* optional: very subtle tint or border to reinforce at distance */
  border-left: 3px solid #6b7280;          /* gray-500 */
  background: rgba(75, 85, 99, 0.04);      /* very light gray in dark mode */
}


.profile-post-item {
  position: relative;
  overflow: hidden;
}

.repost-corner-badge {
  position: absolute;
  top: 6px;
  right: 6px;               /* or left:6px if you prefer */
  z-index: 3;
  background: rgba(0,0,0,0.65);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0.85;
  pointer-events: none;
}

.profile-post-item.is-repost .profile-media-frame::after {
  /* optional fallback subtle overlay if icon feels too strong */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom right, transparent 60%, rgba(100,100,100,0.15));
  pointer-events: none;
}


/* Modern Reposted Indicator - Blue Gradient Theme */

/* For Feed Posts */
.post-reposted-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-reposted-indicator::before {
    content: "↻";
    font-size: 14px;
    font-weight: bold;
    animation: subtle-spin 2s linear infinite;
}

/* For Profile View */
.profile-repost-indicator {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    margin: 4px 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.profile-repost-indicator:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.profile-repost-indicator::before {
    content: "↻";
    font-size: 16px;
    font-weight: bold;
    animation: subtle-spin 2s linear infinite;
}

/* For larger screens - make it more prominent */
@media (min-width: 768px) {
    .post-reposted-indicator {
        top: 12px;
        left: 12px;
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .profile-repost-indicator {
        padding: 10px 20px;
        font-size: 15px;
    }
}

/* Animation for the repost icon */
@keyframes subtle-spin {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(90deg);
    }
    50% {
        transform: rotate(180deg);
    }
    75% {
        transform: rotate(270deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Optional: Different colors for different post types */
.reposted-success {
    background: linear-gradient(135deg, #10b981, #047857);
}

.reposted-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.reposted-premium {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

/* Add some flair with a subtle border or glow */
.post-reposted-indicator {
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

/* Make it pulse slightly for attention */
@keyframes gentle-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.9;
        transform: scale(1.02);
    }
}

.post-reposted-indicator {
    animation: gentle-pulse 3s ease-in-out infinite;
}

/* Counter badge for number of reposts */
.repost-count {
    background: white;
    color: #3b82f6;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    margin-left: 4px;
}



.post-container,
.feed-item,
.feed-item-content {
  position: relative;
}


.close-modal {
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.close-modal:hover {
  opacity: 0.7;
}

/* =========================
   SIMPLE PROFILE COLLAPSE
   (safe for desktop + mobile)
   ========================= */

#profileHeader.collapsed {
  padding: 6px 12px;
}

#profileHeader.collapsed .profile-bio,
#profileHeader.collapsed .profile-stats,
#profileHeader.collapsed .edit-profile-btn,
#profileHeader.collapsed #followBtn {
  display: none;
}


#suggestedUsers { display:none; }


.suggested-users-inline {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 14px;
  padding: 8px 12px;
  -webkit-overflow-scrolling: touch;
}

.suggested-users-inline::-webkit-scrollbar {
  display: none;
}

.discovery-user {
  flex: 0 0 auto;
  text-align: center;
  cursor: pointer;
}

.discovery-user img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}

.discovery-user p {
  font-size: 12px;
  margin-top: 4px;
  white-space: nowrap;
}


#betaInfoBtn {
  display: none !important;
}

