/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: #0d0f14;
  color: #ffffff;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Prevent double-tap zoom behavior on interactive elements and speed up click response */
body, input, button, select, textarea, a, .chat-item, .recent-user-card {
  touch-action: manipulation;
}

/* App Container - Fullscreen Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background-color: #161821;
  overflow: hidden;
}

/* Panel Base Styles */
.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

/* Specific Panel Dimensions for Desktop */
.list-panel {
  width: 360px;
  flex-shrink: 0;
  background-color: #161821;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-panel {
  flex: 1;
  background-color: #171923;
}


/* Panel Header */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background-color: #161821;
  z-index: 9;
}

.panel-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.icon-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s, transform 0.1s;
}

.icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* Search Bar (Hidden/Expandable) */
.search-bar-container {
  padding: 0 24px 12px;
  display: none;
  animation: fadeIn 0.3s forwards;
}

.search-bar-container input {
  width: 100%;
  background-color: #202430;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  color: #ffffff;
  font-size: 14px;
  outline: none;
}

.search-bar-container input::placeholder {
  color: #636b7b;
}

/* Recent Section */
.recent-section {
  padding: 8px 0 16px;
  background-color: #161821;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: #555b6b;
  letter-spacing: 1.5px;
  padding: 0 24px;
  margin-bottom: 12px;
}

.recent-users-carousel {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 24px;
  scrollbar-width: none; /* Firefox */
}

.recent-users-carousel::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.recent-user-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s;
}

.recent-user-card:hover {
  transform: translateY(-2px);
}

.avatar-wrapper {
  position: relative;
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
}

.user-avatar-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #232733;
}

.status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #161821;
}

.status-dot.online {
  background-color: #4cd964;
}

.recent-user-name {
  font-size: 12px;
  color: #a4a9b6;
  font-weight: 500;
}

/* Chats Section & List */
.chats-section {
  flex: 1;
  background-color: #1f222e;
  border-top-left-radius: 35px;
  border-top-right-radius: 35px;
  padding: 24px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 8px 16px rgba(0, 0, 0, 0.15);
}

.chats-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 30px;
}

.chats-list::-webkit-scrollbar {
  display: none;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  cursor: pointer;
  transition: background-color 0.2s;
  position: relative;
}

.chat-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 88px;
  right: 24px;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.03);
}

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

.chat-item.active {
  background-color: #212638;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.chat-item.active::after {
  background-color: transparent;
}

.chat-item-avatar-wrapper {
  width: 48px;
  height: 48px;
  margin-right: 16px;
  flex-shrink: 0;
}

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

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

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.chat-item-name {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-time {
  font-size: 11px;
  color: #636b7b;
  font-weight: 500;
}

.chat-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-item-message {
  font-size: 13px;
  color: #8c93a3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  padding-right: 8px;
}

.unread-badge {
  background-color: #3b5998;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* --- CHAT PANEL (SAĞ TƏRƏF) --- */
.chat-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.back-btn {
  display: none; /* Masaüstündə gizlidir */
}

.active-user-avatar-wrapper {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

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

.active-user-name {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat Body (Mesaj siyahısı) */
.chat-body {
  flex: 1;
  background-color: #171923;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-body::-webkit-scrollbar {
  display: none;
}

/* Mesaj Balonları */
.msg-row {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.msg-row.sent {
  align-items: flex-end;
}

.msg-row.received {
  align-items: flex-start;
}

.msg-bubble {
  max-width: 80%;
  padding: 12px 18px;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.15) forwards;
  transform-origin: bottom left;
}

.msg-row.sent .msg-bubble {
  background-color: #2b334d;
  color: #ffffff;
  border-bottom-right-radius: 4px;
  transform-origin: bottom right;
}

.msg-row.received .msg-bubble {
  background-color: #202430;
  color: #e1e3e6;
  border-bottom-left-radius: 4px;
}

/* Link tipli mesajlar (məs. email) */
.msg-bubble a {
  color: #8fa0e3;
  text-decoration: underline;
}

/* Tarix / Zaman Bölücüləri */
.msg-date-divider {
  align-self: center;
  font-size: 11px;
  font-weight: 600;
  color: #555b6b;
  margin: 12px 0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Kiçik/Emoji tipli mesajların xüsusi dizaynı (məs: ?) */
.msg-bubble.emoji-only {
  font-size: 24px;
  background: none !important;
  padding: 0 8px;
}

/* Chat Footer (Mesaj Yazma Sahəsi) */
.chat-footer {
  padding: 16px 24px 24px;
  background-color: #171923;
  z-index: 9;
}

.input-wrapper {
  background-color: #202430;
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 6px 6px 6px 14px;
  gap: 10px;
}

.footer-btn {
  background: none;
  border: none;
  color: #7b8191;
  font-size: 16px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s, color 0.2s, transform 0.1s;
}

.camera-btn {
  background-color: #2c3140;
  color: #a4a9b6;
}

.camera-btn:hover {
  background-color: #373d50;
  color: #ffffff;
}

.send-btn {
  background-color: transparent;
  color: #7b8191;
}

.send-btn.active {
  color: #ffffff;
  transform: scale(1.05);
}

.message-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 14px;
  padding: 6px 0;
}

.message-input::placeholder {
  color: #5d6473;
}

/* Animasiyalar */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 899px) {
  body {
    padding: 0;
  }

  .app-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    gap: 0;
  }

  .panel {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
  }

  .list-panel {
    z-index: 2;
    border-right: none;
  }

  .chat-panel {
    z-index: 3;
    transform: translateX(100%);
  }

  .chat-panel.active {
    transform: translateX(0);
  }

  .back-btn {
    display: flex; /* Mobildə söhbətdən geri qayıtmaq üçün */
  }

  .status-bar {
    padding: 10px 20px 6px;
  }

  .panel-header {
    padding: 12px 20px;
  }

  .chats-section {
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
  }

  /* Prevent auto-zooming on focus by forcing 16px font-size on mobile inputs */
  .message-input,
  .search-bar-container input,
  .form-control {
    font-size: 16px !important;
  }

  /* Sized down footer for mobile virtual keyboards compatibility */
  .chat-footer {
    padding: 12px 16px 16px;
  }
}

/* --- ADD STORY & MODAL STYLES --- */
.add-story-circle {
  border: 2px dashed #4a5164;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
  cursor: pointer;
}

.add-story-circle i {
  color: #7b8191;
  font-size: 16px;
}

.add-story-trigger:hover .add-story-circle {
  border-color: #ffffff;
  background-color: rgba(255, 255, 255, 0.05);
  transform: scale(1.03);
}

.add-story-trigger:hover .recent-user-name {
  color: #ffffff;
}

/* Modal Window */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: none; /* Controlled by JS */
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background-color: #1a1c24;
  width: 100%;
  max-width: 420px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

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

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.close-btn {
  background: none;
  border: none;
  color: #7b8191;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

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

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

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: #8c93a3;
  font-weight: 600;
}

.form-control {
  width: 100%;
  background-color: #202430;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px 16px;
  color: #ffffff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: #3b5998;
}

.avatar-selector {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.avatar-option {
  cursor: pointer;
  position: relative;
}

.avatar-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.avatar-option img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}

.avatar-option input:checked + img {
  border-color: #3b5998;
  transform: scale(1.08);
}

.help-text {
  display: block;
  font-size: 11px;
  color: #5d6473;
  margin-top: 6px;
  line-height: 1.4;
}

.submit-btn {
  width: 100%;
  background-color: #3b5998;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  margin-top: 10px;
}

.submit-btn:hover {
  background-color: #4a6cb8;
}

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

/* --- LOGIN & REGISTER PAGES (SPLIT-SCREEN AUTH) --- */
.auth-body {
  background-color: #161821;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
}

.auth-wrapper {
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

/* Sol Hissə: Banner (Masaüstü üçün) */
.auth-banner {
  flex: 1.2;
  background: linear-gradient(135deg, #1f2536 0%, #0d0f14 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px;
  border-right: 1px solid rgba(255, 255, 255, 0.03);
}

.auth-banner-content {
  max-width: 460px;
  color: #ffffff;
}

.banner-logo {
  font-size: 52px;
  color: #3b5998;
  margin-bottom: 24px;
}

.auth-banner-content h2 {
  font-size: 38px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.auth-banner-content p {
  font-size: 16px;
  color: #7b8191;
  line-height: 1.6;
}

/* Sağ Hissə: Form Sahəsi (PC-də sağda, Mobildə tam ekran) */
.auth-form-side {
  flex: 1;
  background-color: #161821;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  overflow-y: auto;
}

.auth-form-container {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  animation: popIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-header {
  text-align: left;
  margin-bottom: 32px;
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  font-size: 14px;
  color: #7b8191;
  margin-top: 8px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.input-icon-wrapper {
  position: relative;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #5d6473;
  font-size: 15px;
}

.input-icon-wrapper .form-control {
  padding-left: 46px;
}

.auth-submit-btn {
  margin-top: 6px;
}

.auth-footer {
  margin-top: 28px;
  text-align: left;
  font-size: 14px;
  color: #7b8191;
}

.auth-footer a {
  color: #8fa0e3;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.auth-footer a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.auth-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 20px;
  width: 100%;
}

.auth-alert.error {
  background-color: rgba(235, 87, 87, 0.1);
  border: 1px solid rgba(235, 87, 87, 0.15);
  color: #eb5757;
}

.auth-alert i {
  font-size: 16px;
}

.auth-avatar-selector {
  justify-content: flex-start;
  gap: 12px;
}

.logout-btn:hover {
  background-color: rgba(235, 87, 87, 0.1) !important;
  color: #eb5757 !important;
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Responsive auth layout for mobile */
@media (max-width: 768px) {
  .auth-banner {
    display: none;
  }
  .auth-form-side {
    padding: 32px 20px;
    align-items: flex-start;
  }
  .auth-form-container {
    margin-top: 20px;
    margin-bottom: 20px;
  }
  .modal-overlay {
    align-items: flex-start;
    overflow-y: auto;
    padding: 40px 16px;
  }
  .modal-content {
    padding: 20px;
    border-radius: 16px;
  }
}

/* --- CHAT IMAGE MESSAGE STYLES --- */
.msg-image-bubble {
  padding: 4px !important;
  overflow: hidden;
  max-width: 250px !important;
}

.msg-image-content {
  width: 100%;
  max-width: 240px;
  max-height: 240px;
  border-radius: 16px;
  display: block;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.25s ease;
}

.msg-image-content:hover {
  transform: scale(1.02);
}

/* --- DRAG & DROP FILE ZONE STYLES --- */
.drop-zone {
  width: 100%;
  min-height: 120px;
  border: 2px dashed #4a5164;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.01);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.1s;
  user-select: none;
}

.drop-zone:active {
  transform: scale(0.99);
}

.drop-zone--over {
  border-color: #3b5998;
  background-color: rgba(59, 89, 152, 0.04);
}

.drop-zone-icon {
  font-size: 28px;
  color: #7b8191;
  margin-bottom: 8px;
}

.drop-zone__prompt {
  font-size: 13px;
  color: #7b8191;
  line-height: 1.4;
  pointer-events: none;
}

.drop-zone__thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background-color: #232733;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.drop-zone__filename {
  font-size: 12px;
  color: #a4a9b6;
  margin-top: 8px;
  word-break: break-all;
  pointer-events: none;
}

.drop-zone__input {
  display: none;
}

/* --- PASSWORD STRENGTH INDICATOR --- */
.password-strength-wrapper {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.password-strength-bar-bg {
  width: 100%;
  height: 4px;
  background-color: #202430;
  border-radius: 2px;
  overflow: hidden;
}

.password-strength-bar {
  width: 0;
  height: 100%;
  background-color: #eb5757;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-text {
  font-size: 11px;
  font-weight: 600;
  color: #7b8191;
}

.form-warning-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #eb5757;
  margin-top: 6px;
  line-height: 1.4;
  animation: fadeIn 0.2s ease;
}

/* --- USER PROFILE SIDEBAR HEADER --- */
.user-profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 20px;
  transition: background-color 0.2s, transform 0.1s;
  user-select: none;
  max-width: 220px;
}

.user-profile-header:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.user-profile-header:active {
  transform: scale(0.98);
}

.header-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.header-user-name {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.header-chevron-icon {
  font-size: 10px;
  color: #7b8191;
  transition: transform 0.2s;
}

.user-profile-header.active .header-chevron-icon {
  transform: rotate(180deg);
}

/* --- PROFILE DROPDOWN MENU --- */
.profile-dropdown-menu {
  position: absolute;
  top: calc(100% - 4px);
  left: 24px;
  background-color: #1a1c24;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  width: 200px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: none; /* Controlled by JS */
  flex-direction: column;
  padding: 8px 0;
  z-index: 100;
  animation: dropdownFadeIn 0.2s ease forwards;
}

.profile-dropdown-menu.active {
  display: flex;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item-header {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-item-header strong {
  font-size: 13px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-item-header small {
  font-size: 11px;
  color: #7b8191;
}

.dropdown-divider {
  border: 0;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.05);
  margin: 6px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: #a4a9b6;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.dropdown-item.logout {
  color: #eb5757;
}

.dropdown-item.logout:hover {
  background-color: rgba(235, 87, 87, 0.1);
  color: #eb5757;
}

/* --- USER SELECT MODAL STYLES --- */
.users-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.users-list-container::-webkit-scrollbar {
  width: 6px;
}

.users-list-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}

.users-list-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.users-list-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.user-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background-color: #202430;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.user-select-item:hover {
  background-color: #2a2f3f;
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.05);
}

.user-select-item:active {
  transform: translateY(0);
}

.user-select-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-select-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-select-name {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.user-select-username {
  font-size: 11px;
  color: #7b8191;
}

.msg-sender-name {
  font-size: 11px;
  font-weight: 600;
  color: #8fa0e3;
  margin-bottom: 4px;
  margin-left: 12px;
  opacity: 0.85;
}

/* --- INSTAGRAM STORY GRADIENT RING STYLES --- */
.story-avatar-container {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.story-ring-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.story-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #1a1d26; /* Space/gap between avatar and ring */
}

/* --- INSTAGRAM STORY VIEWER MODAL STYLES --- */
#storyViewerModal {
  background-color: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
}

#storyViewerModal.active {
  display: flex;
}

.story-viewer-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 90vh;
  max-height: 800px;
  background-color: #000000;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (max-width: 480px) {
  #storyViewerModal.modal-overlay {
    padding: 0 !important;
    align-items: stretch;
  }
  .story-viewer-content {
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
  }
}

.story-progress-container {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.story-progress-bar {
  height: 2px;
  background-color: rgba(255, 255, 255, 0.35);
  flex: 1;
  border-radius: 2px;
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  width: 0%;
  background-color: #ffffff;
  transition: width linear;
}

.story-viewer-header {
  position: absolute;
  top: 26px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  z-index: 10;
}

.story-viewer-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.story-viewer-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.story-viewer-username {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

.story-viewer-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #ffffff;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
  line-height: 1;
}

.story-viewer-close:hover {
  opacity: 1;
}

.story-viewer-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.story-viewer-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-nav-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  background: none;
  border: none;
  color: transparent;
  cursor: pointer;
  z-index: 5;
}

.story-nav-btn.prev {
  left: 0;
  width: 35%;
}

.story-nav-btn.next {
  right: 0;
  width: 35%;
}

.story-nav-btn.pause {
  left: 35%;
  width: 30%;
}

/* Progress bar fill animations */
.story-progress-fill.active-running {
  animation: fillStory 5000ms linear forwards;
  animation-play-state: running;
}

.story-progress-fill.active-paused {
  animation: fillStory 5000ms linear forwards;
  animation-play-state: paused;
}

@keyframes fillStory {
  from { width: 0%; }
  to { width: 100%; }
}

/* Viewed story status (grey ring) */
.story-user-card.viewed .story-ring-svg circle {
  stroke: #3c4257 !important;
}

/* --- MESSAGE DELETION STYLES (OWNER ONLY) --- */
.msg-bubble {
  position: relative;
}

.msg-delete-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #eb5757;
  cursor: pointer;
  padding: 4px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.1s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-row.sent .msg-delete-btn {
  left: -28px;
}

.msg-row.received .msg-delete-btn {
  right: -28px;
}

.msg-bubble:hover .msg-delete-btn {
  opacity: 0.75;
}

.msg-delete-btn:hover {
  opacity: 1 !important;
  transform: translateY(-50%) scale(1.15);
}
