/* ================================================================
   inbox.css — WhatsApp Web Style Inbox (Full Refactor + Mobile)
   ================================================================ */

/* ── CONTAINER UTAMA ── */
.inbox-container {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--color-bg-page);
    position: relative;
  }
  
  /* ── CHAT LIST (KIRI) ── */
  .chat-list {
    display: flex;
    flex-direction: column;
    width: 340px;
    min-width: 280px;
    flex-shrink: 0;
    background: var(--color-bg-surface);
    border-right: 1px solid var(--color-border);
    height: 100%;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .chat-list .conv-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
  }
  
  .chat-list .conv-search input {
    width: 100%;
    background: var(--color-bg-page);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 10px 16px;
    color: var(--color-text-primary);
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
  }
  
  .chat-list .conv-search input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  }
  
  .inbox-filters {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
  }
  
  .filter-select {
    flex: 1;
    min-width: 60px;
    background: var(--color-bg-page);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
  }
  
  .filter-select:focus {
    border-color: var(--color-primary);
  }
  
  .conv-list-items {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
  }
  
  /* ── ITEM CHAT ── */
  .conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.1s;
  }
  
  .conv-item:hover {
    background: var(--color-bg-page);
  }
  
  .conv-item.active {
    background: var(--color-bg-page);
  }
  
  .conv-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
  }
  
  .conv-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  
  .conv-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .conv-time {
    font-size: 11px;
    color: var(--color-text-muted);
    font-family: var(--mono);
    flex-shrink: 0;
  }
  
  .conv-msg-preview {
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }
  
  /* ── CONVERSATION PANEL (TENGAH) ── */
  .conversation-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--color-bg-page);
    height: 100%;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .conversation-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: var(--color-text-muted);
  }
  
  /* ── CHAT PANEL (Header + Messages + Composer) ── */
  .chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }
  
  /* ── CHAT HEADER ── */
  .chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    gap: 12px;
    flex-wrap: wrap;
  }
  
  .chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }
  
  .chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  
  .chat-contact-info {
    min-width: 0;
  }
  
  .chat-contact-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .chat-contact-phone {
    font-size: 12px;
    color: var(--color-text-secondary);
    font-family: var(--mono);
  }
  
  .chat-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
  }
  
  .mobile-back-btn {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
  }
  
  /* ── CHAT MESSAGES ── */
  .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 7%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
  }
  
  /* ── CHAT BUBBLE ── */
  .msg-wrap {
    display: flex;
    width: 100%;
    margin-bottom: 2px;
  }
  
  .msg-wrap.user {
    justify-content: flex-start;
  }
  
  .msg-wrap.ai {
    justify-content: flex-end;
  }
  
  .msg-bubble {
    max-width: 65%;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
    word-break: break-word;
  }
  
  .msg-wrap.user .msg-bubble {
    background: var(--color-bg-page);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    border-top-left-radius: 0;
  }
  
  .msg-wrap.ai .msg-bubble {
    background: var(--color-primary);
    color: #fff;
    border-top-right-radius: 0;
  }
  
  .msg-label {
    font-size: 10px;
    font-family: var(--mono);
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.7;
  }
  
  .msg-wrap.user .msg-label {
    color: var(--color-text-muted);
  }
  
  .msg-wrap.ai .msg-label {
    color: rgba(255, 255, 255, 0.7);
  }
  
/* ── CHAT IMAGE ── */
.chat-img {
  max-width: 100%;
  max-height: 300px; /* batasi tinggi agar tidak terlalu besar */
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 6px 0;
  cursor: pointer;
  display: block;
  border: 1px solid var(--color-border);
  object-fit: contain; /* agar gambar tidak terpotong */
}

   /* ── CHAT COMPOSER ── */
  .chat-composer {
    flex-shrink: 0;
    padding: 12px 20px;
    background: var(--color-bg-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
  }
  
  .chat-input {
    flex: 1;
    min-width: 120px;
    background: var(--color-bg-page);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 12px 20px;
    color: var(--color-text-primary);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
  }
  
  .chat-input:focus {
    border-color: var(--color-primary);
  }
  
  .send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
  }
  
  .send-btn:hover {
    background: var(--color-primary-hover);
  }
  
  .send-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff;
  }
  
  .chat-action-btn {
    font-size: 20px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    background: none;
    border: none;
  }
  
  .chat-action-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-page);
  }
  
  /* ── SWITCH TOGGLE ── */
  .switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
  }
  
  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-border);
    transition: 0.4s;
    border-radius: 20px;
  }
  
  .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: 0.4s;
    border-radius: 50%;
  }
  
  input:checked + .slider {
    background-color: var(--color-primary);
  }
  
  input:checked + .slider:before {
    transform: translateX(16px);
  }
  
  /* ── EMOJI PICKER ── */
  .emoji-picker-container {
    position: absolute;
    bottom: 70px;
    left: 20px;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
  }
  
  .emoji-picker-container.show {
    display: block;
  }
  
  /* ── UPLOAD PREVIEW ── */
  .upload-preview-box {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-surface);
    border-top: 1px solid var(--color-border);
    padding: 15px 20px;
    z-index: 10;
    display: none;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid var(--color-border);
  }
  
  .upload-preview-box.show {
    display: flex;
  }
  
  .upload-preview-img {
    max-height: 180px;
    max-width: 100%;
    border-radius: var(--radius-sm);
    object-fit: contain;
    background: var(--color-bg-page);
    border: 1px dashed var(--color-border);
  }
  
  /* ── CONTACT PANEL (KANAN) ── */
  .contact-panel {
    width: 280px;
    min-width: 240px;
    flex-shrink: 0;
    background: var(--color-bg-surface);
    border-left: 1px solid var(--color-border);
    height: 100%;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .contact-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    color: var(--color-text-muted);
  }
  
  .contact-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
  }
  
  .contact-info-item .label {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--mono);
  }
  
  .contact-info-item .value {
    font-size: 14px;
    color: var(--color-text-primary);
    word-break: break-word;
  }
  
  /* ── MOBILE HIDDEN STATE ── */
  .chat-list.hidden {
    transform: translateX(-100%);
    pointer-events: none;
  }
  
  .conversation-panel.hidden {
    display: none;
  }
  
  /* ================================================================
     RESPONSIVE
     ================================================================ */
  
  /* Tablet: Contact Panel hilang */
  @media (max-width: 1024px) {
    .contact-panel {
      display: none !important;
    }
  }
  
  /* Mobile: Chat List & Conversation saling menggantikan */
  @media (max-width: 768px) {
    .inbox-container {
      flex-direction: column;
      position: relative;
    }
  
    .chat-list {
      position: absolute;
      inset: 0;
      width: 100% !important;
      min-width: unset;
      height: 100% !important;
      z-index: 10;
      background: var(--color-bg-surface);
      border-right: none;
      transform: translateX(0);
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
  
    .chat-list.hidden {
      transform: translateX(-100%);
      pointer-events: none;
    }
  
    .conversation-panel {
      position: absolute;
      inset: 0;
      width: 100% !important;
      height: 100% !important;
      z-index: 5;
      background: var(--color-bg-page);
    }
  
    .conversation-panel.hidden {
      display: none;
    }
  
    .mobile-back-btn {
      display: block !important;
    }
  
    .chat-header .mobile-back-btn {
      display: block !important;
    }
  
    .chat-messages {
      padding: 12px 4%;
    }
  
    .msg-bubble {
      max-width: 85%;
    }
  
    .chat-composer {
      padding: 10px 12px;
    }
  
    .chat-input {
      font-size: 13px;
      padding: 10px 16px;
      min-width: 80px;
    }
  
    .chat-header {
      padding: 10px 12px;
    }
  
    .chat-contact-name {
      font-size: 14px;
    }
  
    .contact-panel {
      display: none !important;
    }
  }
  
  /* Layar sangat kecil */
  @media (max-width: 480px) {
    .chat-list {
      min-width: unset;
    }
  
    .chat-header-right {
      gap: 4px;
    }
  
    .chat-header-right select {
      font-size: 10px !important;
      padding: 2px 6px !important;
    }
  
    .chat-composer {
      gap: 6px;
      padding: 8px 10px;
    }
  
    .chat-action-btn {
      width: 32px;
      height: 32px;
      font-size: 16px;
    }
  
    .send-btn {
      width: 38px;
      height: 38px;
    }
  
    .chat-input {
      font-size: 12px;
      padding: 8px 14px;
      min-width: 60px;
    }
  }

