/* ==========================================================================
   theme.css - WhatsApp Web Style Theme
   Designed to work on top of base.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme Variables (WhatsApp Light Theme - Default)
   -------------------------------------------------------------------------- */
:root {
  /* Brand Colors */
  --wa-primary: #00a884;
  --wa-primary-hover: #008f6f;
  
  /* Backgrounds */
  --wa-bg-app: #d1d7db;         /* The grey background behind the app interface */
  --wa-bg-panel: #ffffff;       /* Sidebar and default panel background */
  --wa-bg-chat: #efeae2;        /* Main chat area background (doodle bg goes here) */
  --wa-bg-header: #f0f2f5;      /* Header bars for sidebar and chat */
  --wa-bg-search: #f0f2f5;      /* Search bar background */
  --wa-bg-active-chat: #f0f2f5; /* Hover/Active state for chat list items */
  --wa-bg-icon: #54656f;        /* Default icon color */

  /* Chat Bubbles */
  --wa-bubble-in: #ffffff;      /* Incoming message bubble */
  --wa-bubble-out: #d9fdd3;     /* Outgoing message bubble */
  --wa-bubble-meta: #667781;    /* Timestamps inside bubbles */
  
  /* Text Colors */
  --wa-text-main: #111b21;      /* Primary text (names, messages) */
  --wa-text-secondary: #667781; /* Secondary text (last message, status) */
  --wa-text-meta: #8696a0;      /* Small timestamps in chat list */

  /* Borders & Shadows */
  --wa-border: #e9edef;
  --wa-shadow-app: 0 6px 18px rgba(11, 20, 26, 0.05);
  --wa-shadow-bubble: 0 1px 0.5px rgba(11, 20, 26, 0.13);
}

/* --------------------------------------------------------------------------
   2. Theme Variables (WhatsApp Dark Theme)
   -------------------------------------------------------------------------- */
/* Automatically apply if user OS is in dark mode, or you can use a .dark-theme class on the body */
/* @media (prefers-color-scheme: dark) {
  :root {
    --wa-primary: #00a884;
    
    --wa-bg-app: #0a1014;
    --wa-bg-panel: #111b21;
    --wa-bg-chat: #0b141a;
    --wa-bg-header: #202c33;
    --wa-bg-search: #202c33;
    --wa-bg-active-chat: #2a3942;
    --wa-bg-icon: #aebac1;

    --wa-bubble-in: #202c33;
    --wa-bubble-out: #005c4b;
    --wa-bubble-meta: rgba(255, 255, 255, 0.6);

    --wa-text-main: #e9edef;
    --wa-text-secondary: #8696a0;
    --wa-text-meta: #8696a0;

    --wa-border: #222d34;
    --wa-shadow-app: 0 6px 18px rgba(0, 0, 0, 0.2);
    --wa-shadow-bubble: 0 1px 0.5px rgba(0, 0, 0, 0.13);
  }
} */

/* --------------------------------------------------------------------------
   3. Global Theme Application
   -------------------------------------------------------------------------- */
body {
  background-color: var(--wa-bg-app);
  color: var(--wa-text-main);
}

/* --------------------------------------------------------------------------
   4. Core Layout Components (CRM Structure)
   -------------------------------------------------------------------------- */
/* The main wrapper that sits in the center of the screen on desktop */
.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  background-color: var(--wa-bg-panel);
  box-shadow: var(--wa-shadow-app);
  overflow: hidden;
}

@media (min-width: 1440px) {
  .app-container {
    width: calc(100% - 38px);
    max-width: 1600px;
    height: calc(100vh - 38px);
    margin: 19px auto;
    border-radius: 6px; /* WhatsApp Web rounds corners slightly on large screens */
  }
  
  /* WhatsApp's signature green block behind the app on large screens */
  body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 127px;
    background-color: var(--wa-primary);
    z-index: -1;
  }
}

/* Sidebar (Chat List / Contacts) */
.sidebar {
  width: 30%;
  /* min-width: 300px; */
  max-width: 450px;
  display: flex;
  flex-direction: column;
  background-color: var(--wa-bg-panel);
  border-right: 1px solid var(--wa-border);
}

/* Main Chat Area */
.main-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--wa-bg-chat);
  position: relative;
}

/* --------------------------------------------------------------------------
   5. Headers & Bars
   -------------------------------------------------------------------------- */
.header {
  height: 60px;
  min-height: 60px;
  background-color: var(--wa-bg-header);
  display: flex;
  align-items: center;
  padding: 10px 16px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--wa-border);
}

.search-bar-container {
  padding: 8px 12px;
  background-color: var(--wa-bg-panel);
  border-bottom: 1px solid var(--wa-border);
}

.search-input {
  width: 100%;
  background-color: var(--wa-bg-search);
  padding: 8px 12px 8px 32px;
  border-radius: 8px;
  color: var(--wa-text-main);
  font-size: 14px;
}

.search-input::placeholder {
  color: var(--wa-text-secondary);
}

/* --------------------------------------------------------------------------
   6. Chat List Items
   -------------------------------------------------------------------------- */
.chat-list-item {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 72px;
  background-color: var(--wa-bg-panel);
  cursor: pointer;
  transition: background-color 0.2s;
}

.chat-list-item:hover,
.chat-list-item.active {
  background-color: var(--wa-bg-active-chat);
}

.chat-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: 1px solid var(--wa-border);
  height: 100%;
  padding-right: 12px;
}

.chat-list-item:last-child .chat-info {
  border-bottom: none;
}

.chat-name {
  color: var(--wa-text-main);
  font-size: 17px;
  font-weight: 400;
}

.chat-preview {
  color: var(--wa-text-secondary);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   7. Message Bubbles
   -------------------------------------------------------------------------- */
.message-container {
  padding: 20px 5%;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-bubble {
  max-width: 65%;
  padding: 6px 7px 8px 9px;
  border-radius: 7px;
  font-size: 14.2px;
  line-height: 19px;
  color: var(--wa-text-main);
  box-shadow: var(--wa-shadow-bubble);
  position: relative;
  word-wrap: break-word;
}

.message-in {
  align-self: flex-start;
  background-color: var(--wa-bubble-in);
  border-top-left-radius: 0;
}

.message-out {
  align-self: flex-end;
  background-color: var(--wa-bubble-out);
  border-top-right-radius: 0;
}

.message-time {
  font-size: 11px;
  color: var(--wa-bubble-meta);
  float: right;
  margin: 10px 0 -5px 10px;
}

/* --------------------------------------------------------------------------
   8. Chat Input Area
   -------------------------------------------------------------------------- */
.chat-input-area {
  min-height: 62px;
  background-color: var(--wa-bg-header);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.chat-input {
  flex: 1;
  background-color: var(--wa-bg-panel);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 15px;
  color: var(--wa-text-main);
}

.chat-input::placeholder {
  color: var(--wa-text-secondary);
}

/* Avatar Placeholder */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--wa-bg-search);
  margin-right: 12px;
  flex-shrink: 0;
}   