/* Custom styles to complement Tailwind */
:root {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --text-primary: #111b21;
  --text-secondary: #667781;
  --border-color: #d1d7db;
  --app-header-bg: #f0f2f5;
  --message-in: #ffffff;
  --message-out: #d9fdd3;
  --accent-color: #008069;
}

.dark {
  --bg-primary: #111b21;
  --bg-secondary: #202c33;
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --border-color: #222d34;
  --app-header-bg: #202c33;
  --message-in: #202c33;
  --message-out: #005c4b;
  --accent-color: #00a884;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app-container {
  max-width: 1600px;
  height: 100vh;
  margin: 0 auto;
  display: flex;
  background-color: var(--bg-secondary);
  box-shadow: 0 1px 1px 0 rgba(0,0,0,.06),0 2px 5px 0 rgba(0,0,0,.2);
}

@media (min-width: 1440px) {
  body {
    background-color: #e3e6e8;
    background-image: linear-gradient(180deg, #00a884 0%, #00a884 130px, #e3e6e8 130px, #e3e6e8 100%);
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .dark body {
    background-color: #0a1014;
    background-image: none;
  }
  .app-container {
    height: 95vh;
    width: 100%;
    border-radius: 4px;
  }
}

.sidebar {
  width: 30%;
  min-width: 300px;
  max-width: 450px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  position: relative;
}

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

.search-bar {
  background-color: var(--bg-secondary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
}

.search-input-container {
  background-color: var(--bg-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 6px 12px;
}

.search-input-container input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  width: 100%;
  margin-left: 10px;
}

.contact-list {
  flex: 1;
  overflow-y: auto;
  background-color: var(--bg-secondary);
}

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

.contact-item:hover {
  background-color: var(--bg-primary);
}

.contact-item.active {
  background-color: var(--bg-primary);
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.contact-info {
  margin-left: 14px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

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

.contact-name {
  font-size: 16px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.contact-message {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

.unread-badge {
  background-color: var(--accent-color);
  color: white;
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 12px;
  min-width: 20px;
  text-align: center;
  margin-left: 5px;
}

.chat-bg {
  flex: 1;
  overflow-y: auto;
  padding: 20px 60px;
  background-color: #efeae2;
  background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
  background-repeat: repeat;
  background-size: 400px;
  transition: background 0.3s ease;
}

.dark .chat-bg {
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 0);
  background-size: 24px 24px;
}

.messages-container {
  display: flex;
  flex-direction: column;
}

.message {
  max-width: 65%;
  margin-bottom: 12px;
  padding: 6px 8px 8px 10px;
  border-radius: 8px;
  position: relative;
  font-size: 14.5px;
  box-shadow: 0 1px 0.5px rgba(11,20,26,.13);
  clear: both;
}

.message-in {
  background-color: var(--message-in);
  align-self: flex-start;
  border-top-left-radius: 0;
}

.message-out {
  background-color: var(--message-out);
  align-self: flex-end;
  border-top-right-radius: 0;
}

.message-text {
  margin-bottom: 4px;
  word-wrap: break-word;
}

.message-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  font-size: 11px;
  color: var(--text-secondary);
  float: right;
  margin-left: 10px;
  margin-top: 4px;
}

.message-status {
  margin-left: 4px;
}

.chat-input-area {
  background-color: var(--app-header-bg);
  padding: 10px 16px;
  display: flex;
  align-items: center;
}

.chat-input-container {
  flex: 1;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 10px;
}

.chat-input-container input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
}

.icon-btn {
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s;
}

.icon-btn:hover {
  color: var(--text-primary);
}

.empty-chat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--text-secondary);
  background-color: var(--bg-primary);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #ccc;
  display: inline-block;
  margin-right: 5px;
}

.status-indicator.online {
  background-color: #00a884;
}

/* Image message styling */
.message-img {
  max-width: 100%;
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
}

.modal-content {
  max-width: 90%;
  max-height: 90%;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}

/* Auth Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
}

.auth-card {
  background-color: var(--bg-secondary);
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 400px;
}

.auth-input {
  width: 100%;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
}

.auth-input:focus {
  border-color: var(--accent-color);
}

.auth-btn {
  width: 100%;
  padding: 12px;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}

.auth-btn:hover {
  background-color: #008f5d;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background-color: rgba(11, 20, 26, .2);
  border-radius: 3px;
}

.dark ::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, .16);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    max-width: none;
  }
  .chat-area {
    display: none;
  }
  .app-container.chat-active .sidebar {
    display: none;
  }
  .app-container.chat-active .chat-area {
    display: flex;
  }
  .chat-bg {
    padding: 10px;
  }
  .message {
    max-width: 85%;
  }
}

/* Telegram Features Styling */
.message {
  position: relative;
}

.message-actions {
  display: none;
  position: absolute;
  top: -12px;
  right: 8px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: 3px 6px;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 10;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.dark .message-actions {
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.1);
}

.message:hover .message-actions {
  display: flex;
  align-items: center;
}

.message-action-btn {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 3px 6px;
  border-radius: 6px;
  transition: all 0.15s ease;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.message-action-btn:hover {
  color: var(--accent-color);
  background: rgba(0, 0, 0, 0.06);
}

.dark .message-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.edited-tag {
  font-size: 10px;
  color: var(--text-secondary);
  font-style: italic;
  margin-left: 4px;
}

.silent-badge {
  font-size: 10px;
  color: var(--text-secondary);
  margin-left: 4px;
}

.chat-tab.active {
  color: var(--accent-color) !important;
  border-bottom-color: var(--accent-color) !important;
}

/* Pinned message highlight flash animation */
@keyframes highlightFlash {
  0% {
    background-color: rgba(34, 197, 94, 0.45) !important;
    transform: scale(1.02);
  }
  50% {
    background-color: rgba(34, 197, 94, 0.25) !important;
  }
  100% {
    transform: scale(1);
  }
}

.highlight-pulse {
  animation: highlightFlash 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

/* Wallpaper Preset Themes */
.wallpaper-telegram-blue {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%) !important;
  background-image: none !important;
}

.wallpaper-emerald {
  background: linear-gradient(135deg, #134e5e 0%, #71b280 100%) !important;
  background-image: none !important;
}

.wallpaper-sunset {
  background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%) !important;
  background-image: none !important;
}

.wallpaper-galaxy {
  background: linear-gradient(135deg, #141e30 0%, #243b55 100%) !important;
  background-image: none !important;
}

.wallpaper-slate {
  background-color: #1e293b !important;
  background-image: none !important;
}

.wallpaper-lavender {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  background-image: none !important;
}

.wallpaper-clean-light {
  background-color: #f8fafc !important;
  background-image: none !important;
}

.wallpaper-card.active {
  border-color: #22c55e !important;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.4);
}

/* Scheduled message items in modal */
.scheduled-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.dark .scheduled-item {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

/* Nearby Users (Teman Sekitar) Styling */
.nearby-header-banner {
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
  border-bottom: 1px solid var(--border-color);
}

.nearby-filter-chip {
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  white-space: nowrap;
}

.nearby-filter-chip:hover {
  border-color: #f43f5e;
  color: #f43f5e;
}

.nearby-filter-chip.active {
  background: #f43f5e;
  color: #ffffff;
  border-color: #f43f5e;
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.3);
}

.nearby-user-card {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  transition: background-color 0.2s;
  cursor: pointer;
}

.nearby-user-card:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.dark .nearby-user-card:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.badge-same-city {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.dark .badge-same-city {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.badge-same-province {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.dark .badge-same-province {
  background: rgba(59, 130, 246, 0.22);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
}

/* Matchmaking Radar Animation */
@keyframes radar-pulse {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.2;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.radar-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid #9333ea;
  animation: radar-pulse 2.2s infinite ease-out;
}

.radar-ring:nth-child(2) {
  animation-delay: 0.7s;
}

.radar-ring:nth-child(3) {
  animation-delay: 1.4s;
}

/* Mini Game Tic-Tac-Toe Styling */
.ttt-cell {
  background: rgba(0, 0, 0, 0.04);
  border: 2px solid var(--border-color);
  border-radius: 14px;
  font-size: 2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.dark .ttt-cell {
  background: rgba(255, 255, 255, 0.05);
}

.ttt-cell:hover:not(.filled) {
  background: rgba(147, 51, 234, 0.1);
  border-color: #9333ea;
  transform: scale(1.03);
}

.ttt-cell.filled {
  cursor: default;
}

.ttt-cell.symbol-x {
  color: #ef4444;
}

.ttt-cell.symbol-o {
  color: #3b82f6;
}

.ttt-cell.winning-cell {
  background: rgba(34, 197, 94, 0.25) !important;
  border-color: #22c55e !important;
  animation: highlightFlash 1s ease infinite alternate;
}

/* Suit Choice Card Selected State */
.suit-choice-btn.selected {
  border-color: #9333ea !important;
  background-color: rgba(147, 51, 234, 0.15) !important;
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(147, 51, 234, 0.3);
}

/* Game Message Bubble in Chat */
.game-msg-bubble {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.08) 0%, rgba(79, 70, 229, 0.08) 100%);
  border: 1px solid rgba(147, 51, 234, 0.25);
  border-radius: 12px;
  padding: 8px 12px;
}


