/* ========================================
   MOBILE CHAT STRUCTURE - Independent
   ======================================== */

/* Hide mobile chat by default (desktop) */
.mobile-chat-container {
  display: none;
}

/* Mobile media query */
@media (max-width: 768px) {
  /* Show mobile chat, hide desktop chat */
  .mobile-chat-container {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    height: 100%;
  }
  
  /* Hide old desktop chat structure on mobile */
  #chatPanel .chat-body {
    display: none !important;
  }
  
  /* Hide main violet chat header completely on mobile */
  .chat-header {
    display: none !important;
  }
  
  /* Adjust chatPanel to remove header space */
  #chatPanel {
    padding-top: 0 !important;
  }
  
  /* Mobile Conversation View */
  .mobile-conversation-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    padding-top: 60px;
  }
  
  /* Mobile Chat List */
  .mobile-chat-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #ffffff;
  }
  
  /* Mobile Chat List Header */
  .mobile-chat-list-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    gap: 12px;
  }
  
  .mobile-back-to-menu {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: #25d366;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
  }
  
  .mobile-back-to-menu:active {
    background: rgba(37, 211, 102, 0.1);
  }
  
  .mobile-chat-title {
    flex: 1;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
  }
  
  .mobile-new-chat-btn {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: #25d366;
    font-size: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
  }
  
  .mobile-new-chat-btn:active {
    background: rgba(37, 211, 102, 0.1);
  }
  
  .mobile-chat-tabs {
    display: flex;
    background: #ffffff;
    border-bottom: 2px solid #f0f0f0;
    flex-shrink: 0;
  }
  
  .mobile-tab {
    flex: 1;
    padding: 14px 8px;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    border: none;
    background: transparent;
    color: #666;
    transition: all 0.2s;
    min-height: 48px;
    cursor: pointer;
  }
  
  .mobile-tab.active {
    color: #25d366;
    border-bottom: 3px solid #25d366;
  }
  
  .mobile-threads-list,
  .mobile-requests-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    background: #ffffff;
  }
  
  .chat-loading,
  .chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #999;
    text-align: center;
  }
  
  .chat-loading i,
  .chat-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #ddd;
  }
  
  .chat-loading p,
  .chat-empty p {
    font-size: 14px;
    margin: 0;
  }
  
  .mobile-conv-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    min-height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10001;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  
  .mobile-back {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
  }
  
  .mobile-back:active {
    background: rgba(37, 211, 102, 0.1);
  }
  
  .mobile-conv-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e0e0e0;
  }
  
  .mobile-conv-info {
    flex: 1;
    min-width: 0;
  }
  
  .mobile-conv-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .mobile-conv-status {
    font-size: 12px;
    color: #25d366;
  }
  
  .mobile-conv-options {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #666;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  
  .mobile-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
  }
  
  .mobile-input-bar {
    display: flex;
    align-items: center;
    gap: 0px;
    padding: 12px 12px;
    padding-bottom: calc(130px + env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 100;
  }
  
  .mobile-input {
    flex: 1;
    padding: 10px 16px;
    font-size: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    background: #f8f9fa;
    min-height: 42px;
    outline: none;
  }
  
  .mobile-input:focus {
    border-color: #25d366;
    background: #ffffff;
  }
  
  .mobile-voice-btn,
  .mobile-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
  }
  
  .mobile-voice-btn {
    background: transparent;
    color: #666;
  }
  
  .mobile-send-btn {
    background: #25d366;
    color: white;
    font-size: 16px;
  }
  
  .mobile-send-btn:active {
    transform: scale(0.95);
  }
}
