/* ============================================
   MOBILE CHAT - BEAUTIFUL COMPOSER
   Clean WhatsApp/Messenger Style
   ============================================ */

@media (max-width: 1023px) {

  /* Hide navigation */
  body:has(.chat-layout) header.topbar,
  .in-chat header.topbar {
    display: none !important;
  }

  body:has(.chat-layout) .tabbar,
  .in-chat .tabbar {
    display: none !important;
  }

  /* Full screen layout */
  .chat-layout {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: #000000 !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .chat-sidebar-panel {
    display: none !important;
  }

  .chat-main {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    width: 100% !important;
  }

  /* ============================================
     HEADER - Complete
     ============================================ */

  .chat-head {
    background: #1a1f3a !important;
    padding: 8px 16px !important;
    padding-top: max(8px, env(safe-area-inset-top)) !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-height: 56px !important;
    flex-shrink: 0 !important;
    z-index: 100 !important;
    border-bottom: 1px solid rgba(255,255,255,0.08) !important;
  }

  .chat-back {
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    border-radius: 50% !important;
  }

  .chat-back:active {
    background: rgba(255,255,255,0.1) !important;
  }

  .chat-back svg {
    width: 24px !important;
    height: 24px !important;
  }

  .chat-head-avatar {
    width: 42px !important;
    height: 42px !important;
    position: relative !important;
    flex-shrink: 0 !important;
  }

  .chat-head-avatar img {
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    border: 2px solid rgba(255,255,255,0.1) !important;
  }

  .chat-head-avatar .presence-dot {
    position: absolute !important;
    bottom: 0 !important;
    right: 0 !important;
    width: 14px !important;
    height: 14px !important;
    background: #00d95f !important;
    border: 3px solid #1a1f3a !important;
    border-radius: 50% !important;
  }

  .chat-head-main {
    flex: 1 !important;
    min-width: 0 !important;
  }

  .chat-head-name {
    font-size: 17px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    line-height: 1.2 !important;
  }

  .chat-head-sub {
    font-size: 13px !important;
    color: rgba(255,255,255,0.65) !important;
    line-height: 1.2 !important;
    margin-top: 3px !important;
  }

  .chat-online-dot {
    display: inline-block !important;
    width: 8px !important;
    height: 8px !important;
    background: #00d95f !important;
    border-radius: 50% !important;
    margin-right: 5px !important;
  }

  .chat-head-actions {
    display: flex !important;
    gap: 4px !important;
  }

  .chat-act-btn {
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    color: #ff6b1a !important;
    border-radius: 50% !important;
  }

  .chat-act-btn:active {
    background: rgba(255,255,255,0.1) !important;
  }

  .chat-act-btn svg {
    width: 22px !important;
    height: 22px !important;
  }

  .chat-act-btn[data-act="more"] {
    color: #ffffff !important;
  }

  /* ============================================
     MESSAGES
     ============================================ */

  .chat-body {
    background: #000000 !important;
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 16px !important;
    padding-bottom: 20px !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .chat-messages {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .bubble {
    padding: 10px 14px !important;
    border-radius: 18px !important;
    font-size: 16px !important;
    max-width: 75% !important;
    margin-bottom: 2px !important;
  }

  .bubble.in {
    align-self: flex-start !important;
    background: rgba(255,255,255,0.12) !important;
    color: #ffffff !important;
    border-bottom-left-radius: 4px !important;
  }

  .bubble.out {
    align-self: flex-end !important;
    background: #ff6b1a !important;
    color: #ffffff !important;
    border-bottom-right-radius: 4px !important;
  }

  /* ============================================
     BEAUTIFUL COMPOSER - Clean & Minimal
     ============================================ */

  .chat-compose {
    background: #1a1f3a !important;
    padding: 10px 14px !important;
    /* ONLY 28px extra for Safari bar - clean! */
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-height: 56px !important;
    flex-shrink: 0 !important;
    border-top: 1px solid rgba(255,255,255,0.06) !important;
    z-index: 1000 !important;
  }

  /* Buttons - Clean transparent style */
  .chat-compose-plus,
  .chat-compose-btn,
  .chat-compose-emoji {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    color: rgba(255,255,255,0.65) !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    transition: all 0.15s ease !important;
  }

  .chat-compose-plus:active,
  .chat-compose-emoji:active {
    background: rgba(255,255,255,0.08) !important;
    transform: scale(0.92) !important;
  }

  .chat-compose-plus svg,
  .chat-compose-emoji svg {
    width: 22px !important;
    height: 22px !important;
  }

  /* Input - Clean minimal style */
  .chat-input {
    flex: 1 !important;
    min-height: 40px !important;
    max-height: 100px !important;
    padding: 10px 15px !important;
    background: rgba(255,255,255,0.06) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 20px !important;
    color: #ffffff !important;
    font-size: 15px !important;
    line-height: 1.4 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    resize: none !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    transition: all 0.2s ease !important;
  }

  .chat-input::placeholder {
    color: rgba(255,255,255,0.35) !important;
  }

  .chat-input:focus {
    outline: none !important;
    background: rgba(255,255,255,0.1) !important;
    border-color: rgba(255,107,26,0.3) !important;
  }

  /* Send button - Beautiful gradient */
  .chat-send-btn {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #ff6b1a 0%, #ff8533 100%) !important;
    border: none !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 10px rgba(255,107,26,0.35) !important;
    transition: all 0.15s ease !important;
  }

  .chat-send-btn:active {
    transform: scale(0.92) !important;
    box-shadow: 0 1px 5px rgba(255,107,26,0.4) !important;
  }

  .chat-send-btn svg {
    width: 20px !important;
    height: 20px !important;
  }

}
