/* ✅ chat.css - Complete CSS File for Shiksha Chat */

/* ========================================
   RESET AND BASE STYLES
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #1a1a2e;
  color: #ffffff;
  overflow: hidden;
}

.dark-theme {
  background-color: #1a1a2e;
  color: #ffffff;
}

/* ========================================
   LOGOUT BUTTON - FIXED POSITION
   ======================================== */
#logoutBtn {
  position: fixed !important;
  top: 20px !important;
  right: 20px !important;
  padding: 12px 20px !important;
  border-radius: 8px !important;
  background-color: #dc3545 !important;
  color: white !important;
  border: none !important;
  cursor: pointer !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  transition: all 0.3s ease !important;
  z-index: 10001 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3) !important;
}

#logoutBtn:hover {
  background-color: #c82333 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4) !important;
}

#logoutBtn i {
  font-size: 14px;
}

/* ========================================
   PROFILE SECTION
   ======================================== */
.profile-container {
  position: fixed;
  top: 20px;
  left: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  width: 200px;
  backdrop-filter: blur(10px);
}

#profile-pic {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 3px solid rgba(255, 255, 255, 0.3);
  transition: transform 0.3s ease;
}

#profile-pic:hover {
  transform: scale(1.1);
}

#username {
  margin: 10px 0 5px 0;
  font-size: 16px;
  font-weight: 600;
  color: white;
}

#bio {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  transition: background-color 0.3s;
}

#bio:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

#name-input, #bio-input {
  width: 100%;
  margin: 5px 0;
  padding: 8px;
  border: none;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 12px;
}

#name-input::placeholder, #bio-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

#save-profile {
  background: #27ae60;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  margin-top: 5px;
}

#save-profile:hover {
  background: #229954;
}

/* ========================================
   MAIN LAYOUT - FLEX CONTAINER
   ======================================== */
.mobile-wrapper {
  display: flex !important;
  height: 100vh !important;
  margin-top: 0 !important;
}

/* ========================================
   FRIENDS SECTION - LEFT SIDEBAR
   ======================================== */
.friend-section {
  width: 350px !important;
  background: #2c3e50 !important;
  padding: 20px 15px !important;
  overflow-y: auto !important;
  border-right: 2px solid #34495e;
  display: block !important;
}



/* .mobile-visible,
.mobile-hidden { */
  /* Override mobile visibility restrictions */
  /* display: block !important; */
/* } */

/* ========================================
   SEARCH INPUT
   ======================================== */
#search-friend {
  width: 100% !important;
  padding: 12px 15px !important;
  border: none !important;
  border-radius: 8px !important;
  background-color: #34495e !important;
  color: white !important;
  font-size: 14px !important;
  margin-bottom: 20px !important;
  transition: all 0.3s ease !important;
}

#search-friend::placeholder {
  color: #bdc3c7 !important;
}

#search-friend:focus {
  outline: none !important;
  background-color: #3d566e !important;
  box-shadow: 0 0 0 2px #007bff !important;
}

/* ========================================
   FRIEND LIST SECTIONS
   ======================================== */
.friend-list-section {
  margin-bottom: 25px;
}

.friend-list-section h4 {
  color: #ecf0f1 !important;
  font-size: 14px !important;
  margin-bottom: 15px !important;
  padding-bottom: 8px !important;
  border-bottom: 2px solid #007bff !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
}

#friend-suggestions h4::before {
  content: "👥 ";
}

#incoming-requests h4::before {
  content: "📩 ";
}

#friend-list h4::before {
  content: "💬 ";
}

/* ========================================
   FRIEND ITEMS
   ======================================== */
.friend-item {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 15px 12px !important;
  margin: 8px 0 !important;
  background: #34495e !important;
  border-radius: 10px !important;
  transition: all 0.3s ease !important;
  cursor: pointer !important;
  border: 2px solid transparent !important;
}

.friend-item:hover {
  background: #3d566e !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  border-color: #007bff !important;
}

.friend-item.active-chat {
  background: linear-gradient(135deg, #007bff, #0056b3) !important;
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4) !important;
  border-color: #ffffff !important;
}

.user-info {
  display: flex !important;
  align-items: center !important;
  flex: 1 !important;
}

.user-avatar {
  width: 20px !important;
  height: 20px !important;
  border-radius: 50% !important;
  margin-right: 15px !important;
  object-fit: cover !important;
  /* border: 2px solid rgba(255, 255, 255, 0.3) !important; */
}
#chat-user-pic {
  width: 45px !important;
  height: 45px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}
.user-details {
  flex: 1 !important;
}

.user-name {
  font-weight: 600 !important;
  color: #ecf0f1 !important;
  font-size: 15px !important;
  margin-bottom: 3px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.user-bio {
  font-size: 12px !important;
  color: #bdc3c7 !important;
  opacity: 0.8 !important;
}

.user-actions {
  display: flex !important;
  gap: 8px !important;
}

/* ========================================
   ACTION BUTTONS
   ======================================== */
.action-btn {
  padding: 6px 10px !important;
  border: none !important;
  border-radius: 4px !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
  min-width: 50px !important;
}

.add-btn {
  background: #3498db !important;
  color: white !important;
}

.add-btn:hover {
  background: #2980b9 !important;
  transform: translateY(-1px) !important;
}

.accept-btn {
  background: #27ae60 !important;
  color: white !important;
}

.accept-btn:hover {
  background: #229954 !important;
  transform: translateY(-1px) !important;
}

.reject-btn {
  background: #e74c3c !important;
  color: white !important;
}

.reject-btn:hover {
  background: #c0392b !important;
  transform: translateY(-1px) !important;
}

.chat-btn {
  background: linear-gradient(135deg, #007bff, #0056b3) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3) !important;
}

.chat-btn:hover {
  background: linear-gradient(135deg, #0056b3, #004494) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4) !important;
}

.action-btn:disabled {
  cursor: not-allowed !important;
  opacity: 0.6 !important;
  transform: none !important;
}

/* ========================================
   CHAT AREA - RIGHT SIDE
   ======================================== */
#chatAreaSection {
  flex: 1 !important;
  display: block !important;
  background: #16213e !important;
  position: relative !important;
}

.chat-section {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

.chat-area {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%) !important;
}

/* ========================================
   BACK BUTTON (MOBILE)
   ======================================== */
.back-button {
  display: none !important;
  padding: 10px 15px !important;
  background: #007bff !important;
  color: white !important;
  border: none !important;
  cursor: pointer !important;
  font-size: 14px !important;
  border-bottom: 1px solid #0056b3 !important;
}

.back-button:hover {
  background: #0056b3 !important;
}

/* ========================================
   CHAT HEADER
   ======================================== */
.chat-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 20px 25px !important;
  background: linear-gradient(135deg, #2c3e50, #34495e) !important;
  border-bottom: 2px solid #3d566e !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}

#chatName {
  font-size: 24px !important;
  font-weight: 600 !important;
  color: #ecf0f1 !important;
}

.chat-user-info {
  display: none !important;
  align-items: center !important;
  gap: 15px !important;
}

.chat-user-info.active {
  display: flex !important;
}

#chat-user-pic {
  width: 50px !important;
  height: 50px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 2px solid #007bff !important;
}

.chat-user-info div h4 {
  color: #ecf0f1 !important;
  margin-bottom: 3px !important;
}

#chat-status {
  font-size: 12px !important;
  color: #bdc3c7 !important;
}

.chat-status.online {
  color: #27ae60 !important;
}

.chat-status.offline {
  color: #7f8c8d !important;
}

.chat-actions {
  display: none !important;
  align-items: center !important;
  gap: 15px !important;
}

.chat-actions.active {
  display: flex !important;
}

#call-btn {
  padding: 10px !important;
  border: none !important;
  border-radius: 50% !important;
  background: #27ae60 !important;
  color: white !important;
  cursor: pointer !important;
  font-size: 16px !important;
  width: 45px !important;
  height: 45px !important;
  transition: all 0.3s ease !important;
}

#call-btn:hover {
  background: #229954 !important;
  transform: scale(1.1) !important;
}

.chat-menu {
  position: relative !important;
}

#menuBtn {
  padding: 10px !important;
  cursor: pointer !important;
  color: #bdc3c7 !important;
  font-size: 18px !important;
  transition: color 0.3s !important;
}

#menuBtn:hover {
  color: #ecf0f1 !important;
}

#menuOptions {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  background: #2c3e50 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
  overflow: hidden !important;
  z-index: 1000 !important;
  min-width: 120px !important;
}

#menuOptions button {
  display: block !important;
  width: 100% !important;
  padding: 12px 15px !important;
  border: none !important;
  background: transparent !important;
  color: #ecf0f1 !important;
  cursor: pointer !important;
  font-size: 14px !important;
  text-align: left !important;
  transition: background-color 0.3s !important;
}

#menuOptions button:hover {
  background: #34495e !important;
}

#menuOptions.hidden {
  display: none !important;
}

/* ========================================
   MESSAGES AREA
   ======================================== */
.chat-messages {
  flex: 1 !important;
  padding: 20px !important;
  overflow-y: auto !important;
  background: linear-gradient(135deg, #0f1419 0%, #16213e 100%) !important;
  display: flex !important;
  flex-direction: column !important;
}

.message {
  margin: 10px 0 !important;
  padding: 12px 16px !important;
  border-radius: 18px !important;
  max-width: 70% !important;
  word-wrap: break-word !important;
  position: relative !important;
  animation: messageSlideIn 0.3s ease !important;
}

.message.sent {
  background: linear-gradient(135deg, #007bff, #0056b3) !important;
  color: white !important;
  margin-left: auto !important;
  text-align: right !important;
  border-bottom-right-radius: 5px !important;
}

.message.received {
  background: #2c3e50 !important;
  color: #ecf0f1 !important;
  margin-right: auto !important;
  border-bottom-left-radius: 5px !important;
}

.message-content p {
  margin: 0 !important;
  line-height: 1.4 !important;
}

.message-time {
  font-size: 10px !important;
  opacity: 0.7 !important;
  display: block !important;
  margin-top: 6px !important;
}

.message-image {
  max-width: 250px !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  transition: transform 0.3s ease !important;
}

.message-image:hover {
  transform: scale(1.05) !important;
}

.file-message, .voice-message {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
}

.file-message a {
  color: inherit !important;
  text-decoration: none !important;
  font-weight: 500 !important;
}

.file-message a:hover {
  text-decoration: underline !important;
}

.voice-message i {
  cursor: pointer !important;
  padding: 8px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.2) !important;
  transition: all 0.3s ease !important;
}

.voice-message i:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.1) !important;
}

/* ========================================
   CHAT INPUT SECTION
   ======================================== */
.chat-input-section {
  display: none !important;
  align-items: center !important;
  padding: 20px 25px !important;
  background: #2c3e50 !important;
  border-top: 2px solid #34495e !important;
  gap: 12px !important;
}

.chat-input-section.active {
  display: flex !important;
}

.chat-input-section button {
  padding: 12px !important;
  border: none !important;
  border-radius: 50% !important;
  background: #34495e !important;
  color: #bdc3c7 !important;
  cursor: pointer !important;
  font-size: 16px !important;
  width: 45px !important;
  height: 45px !important;
  transition: all 0.3s ease !important;
}

.chat-input-section button:hover {
  background: #3d566e !important;
  color: #ecf0f1 !important;
  transform: scale(1.1) !important;
}

#message-input {
  flex: 1 !important;
  padding: 15px 20px !important;
  border: none !important;
  border-radius: 25px !important;
  background: #34495e !important;
  color: #ecf0f1 !important;
  font-size: 14px !important;
  transition: all 0.3s ease !important;
}

#message-input::placeholder {
  color: #7f8c8d !important;
}

#message-input:focus {
  outline: none !important;
  background: #3d566e !important;
  box-shadow: 0 0 0 2px #007bff !important;
}

#send-btn {
  background: linear-gradient(135deg, #007bff, #0056b3) !important;
  color: white !important;
  box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3) !important;
}

#send-btn:hover {
  background: linear-gradient(135deg, #0056b3, #004494) !important;
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4) !important;
}

.recording {
  background: #e74c3c !important;
  animation: pulse 1s infinite !important;
}

/* ========================================
   EMOJI PICKER
   ======================================== */
#emoji-picker-container {
  position: absolute !important;
  bottom: 80px !important;
  right: 120px !important;
  background: white !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
  z-index: 1000 !important;
  max-width: 320px !important;
}

.emoji-grid {
  display: grid !important;
  grid-template-columns: repeat(8, 1fr) !important;
  gap: 8px !important;
  padding: 15px !important;
  max-height: 250px !important;
  overflow-y: auto !important;
}

.emoji-item {
  padding: 10px !important;
  text-align: center !important;
  cursor: pointer !important;
  border-radius: 6px !important;
  font-size: 20px !important;
  transition: all 0.3s ease !important;
}

.emoji-item:hover {
  background: #f0f0f0 !important;
  transform: scale(1.2) !important;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(300px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(300px); opacity: 0; }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
.friend-section::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.emoji-grid::-webkit-scrollbar {
  width: 6px;
}

.friend-section::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.emoji-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.friend-section::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.emoji-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.friend-section::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover,
.emoji-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
  .profile-container {
    position: static;
    width: 100%;
    margin-bottom: 10px;
  }
  
  .mobile-wrapper {
    flex-direction: column;
    height: calc(100vh - 120px);
  }
  
  .friend-section {
    width: 100% !important;
    height: 100% !important;
  }
  
  #chatAreaSection.mobile-hidden {
    display: none !important;
  }
  
  #chatAreaSection.mobile-visible {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1001;
  }
  
  .back-button {
    display: block !important;
  }
  
  #logoutBtn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .friend-section {
    padding: 10px;
  }
  
  .friend-item {
    padding: 10px;
  }
  
  .user-avatar {
    width: 35px !important;
    height: 35px !important;
  }
  
  .user-name {
    font-size: 14px !important;
  }
  
  .user-bio {
    font-size: 11px !important;
  }
  
  .action-btn {
    padding: 6px 10px !important;
    font-size: 10px !important;
  }
  
  .chat-header {
    padding: 15px;
  }
  
  #chatName {
    font-size: 18px !important;
  }
}

/* ========================================
   NOTIFICATION STYLES
   ======================================== */
.notification {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  z-index: 10002;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.notification.success {
  background: linear-gradient(135deg, #27ae60, #229954);
}

.notification.error {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.notification.info {
  background: linear-gradient(135deg, #3498db, #2980b9);
}

/* ========================================
   LOADING STATES
   ======================================== */
#loading-message {
  text-align: center;
  padding: 20px;
  color: #7f8c8d;
  font-style: italic;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #007bff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center !important;
}

.mt-50 {
  margin-top: 50px !important;
}

.status-online {
  color: #27ae60 !important;
}

.status-offline {
  color: #7f8c8d !important;
}

/* ========================================
   FINAL OVERRIDES (MOST IMPORTANT)
   ======================================== */
body.dark-theme .mobile-wrapper {
  display: flex !important;
  height: 100vh !important;
}

body.dark-theme .friend-section {
  display: block !important;
  width: 350px !important;
}

body.dark-theme #chatAreaSection {
  display: block !important;
  flex: 1 !important;
}

body.dark-theme .chat-area {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

body.dark-theme #logoutBtn {
  display: flex !important;
  position: fixed !important;
  top: 20px !important;
  right: 20px !important;
  z-index: 10001 !important;
}
/* ✅ WhatsApp Style Friend Display Pic */
.user-avatar {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  margin-right: 15px !important;
  border: 2px solid #2c3e50 !important; /* dark border like WhatsApp */
  box-shadow: 0 2px 6px rgba(0,0,0,0.2) !important;
  transition: transform 0.2s ease, border-color 0.3s ease !important;
}

.user-avatar:hover {
  transform: scale(1.05) !important;
  border-color: #25D366 !important; /* WhatsApp green highlight on hover */
}
