body{
      font-family: 'Cairo', sans-serif;
      margin: 0;
      padding: 0;
      background: #f4f4f4;
      direction: rtl;
    }
    header{
      background-color: #4caf50;
      color: white;
      padding: 18px 0 16px;
      text-align: center;
      font-size: 26px;
      letter-spacing: 1px;
      font-weight: bold;
      box-shadow: 0 1px 4px #0001;
    }
    .main-messages{
      display: flex;
      height: calc(100vh - 60px);
      max-height: calc(100vh - 60px);
      background: #f4f4f4;
    }
    .sidebar{
      width: 360px;
      max-width: 99vw;
      background: #fff;
      box-shadow: 2px 0 12px #0002;
      overflow-y: auto;
      border-left: 1px solid #eee;
      padding-top: 8px;
    }
    .conv-list-title{
      font-size: 18px;
      font-weight: bold;
      color: #388e3c;
      margin: 12px 20px 9px;
    }
    .conversation-list{
      padding: 0 0 30px 0;
    }
    .conversation{
      background: #fff;
      border-bottom: 1px solid #f1f1f1;
      padding: 16px 18px 13px 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 10px;
      transition: background 0.12s;
      position: relative;
    }
    .conversation.selected{
      background: #eafbe7;
    }
    .conv-avatar{
      background: #e6f4ea;
      border-radius: 50%;
      width: 42px;
      height: 42px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      font-weight: bold;
      color: #238c37;
    }
    .conv-info{
      flex: 1;
      min-width: 0;
    }
    .conv-username{
      font-weight: bold;
      color: #238c37;
      font-size: 17px;
      margin-bottom: 1px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .conv-preview{
      color: #666;
      font-size: 14px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-top: 1px;
    }
    .conv-date{
      font-size: 12px;
      color: #999;
      margin-right: 4px;
      margin-top: 6px;
      min-width: 55px;
      text-align: left;
    }

    
    .chat-view{
      flex: 1;
      background: #f9f9f9;
      min-width: 0;
      display: flex;
      flex-direction: column;
      height: 100%;
      max-height: 100vh;
      overflow: hidden;
      position: relative;
    }
    .chat-header{
      padding: 22px 25px 15px;
      border-bottom: 1.5px solid #e5f3e7;
      background: #fff;
      display: flex;
      align-items: center;
      gap: 13px;
    }
    .chat-avatar{
      width: 39px; height: 39px; background: #eaf8ed; border-radius: 50%;
      color: #238c37; font-size: 18px; display: flex; align-items: center; justify-content: center; font-weight: bold;
    }
    .chat-username{
      font-size: 18px; font-weight: bold; color: #238c37;
    }
    .chat-messages{
      flex: 1;
      overflow-y: auto;
      padding: 28px 20px 18px;
      display: flex;
      flex-direction: column;
      gap: 9px;
      background: #f9f9f9;
    }
    .message{
      max-width: 76%;
      word-break: break-word;
      padding: 11px 15px 11px 12px;
      border-radius: 13px 13px 2px 13px;
      margin-bottom: 2px;
      background: #fff;
      box-shadow: 0 1px 3px #0001;
      font-size: 15px;
      color: #212121;
      align-self: flex-start;
      position: relative;
    }
    .message.me{
      align-self: flex-end;
      background: #daf7de;
      border-radius: 13px 2px 13px 13px;
      color: #205c24;
      font-weight: bold;
    }
    .message-time{
      font-size: 11px;
      color: #aaa;
      margin-top: 1px;
      margin-right: 2px;
      display: block;
      text-align: left;
    }
    .audio-row{
      display: flex;
      align-items: center;
      gap: 7px;
    }
    .audio-duration{
      font-size: 13px;
      color: #4caf50;
      min-width: 38px;
      text-align: center;
      font-weight: bold;
      direction: ltr;
      letter-spacing: 1px;
    }
    
    .chat-btn{
      border: none;
      background: none;
      padding: 0;
      margin: 0 3px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 41px; height: 41px;
      border-radius: 50%;
      transition: background .14s;
    }
    .chat-btn:active,
.chat-btn:focus{
      background: #e8f6ea;
      outline: none;
    }
    .btn-send{
      background: #21ba59;
      color: #fff;
      transition: background .2s;
      border-radius: 8px !important;
      padding: 0 10px !important;
      width: auto;
      height: 38px;
      font-weight: bold;
      font-size: 17px;
    }
    .btn-mic{
      background: #21ba59;
      color: #fff;
      box-shadow: 0 2px 10px #72e89c42;
      transition: background .2s;
      border-radius: 50%;
      border: none;
    }
    .btn-mic svg{
      width: 24px; height: 24px; color: #fff;
    }
    .btn-image svg{
      width: 23px;
      height: 23px;
      color: #606060;
    }
    .chat-input-bar{
      position:relative;
      background: #fff;
      border-top: 1.5px solid #e5f3e7;
      padding: 10px 6px 10px 6px;
      display: flex;
      align-items: center;
      gap: 7px;
      box-shadow: 0 -1px 8px #0001;
    }
    .chat-input{
      flex: 1;
      padding: 12px;
      border: 1.5px solid #e2ede8;
      border-radius: 13px;
      font-size: 15px;
      outline: none;
      transition: border .12s;
      font-family: inherit;
      background: #f8fefb;
      margin: 0 5px;
    }
    .chat-input:focus{
      border-color: #4caf50;
      background: #fff;
    }
    @media (max-width: 900px){
      .main-messages{ flex-direction: column; }
      .sidebar{ width: 100vw; max-width: none; border-left: none; border-bottom: 1px solid #eee; }
      .chat-view{ min-height: 320px; }
      .chat-header{ padding: 17px 10px 10px 10px; }
      .chat-messages{ padding: 14px 4vw 12px; }
      .chat-input-bar{ padding: 7px 2vw 7px 2vw; gap:6px;}
      .chat-input{ font-size: 15px; padding: 10px 7px; border-radius: 12px;}
      .chat-btn,
.btn-mic{ width: 38px; height: 38px; min-width:38px;}
    }
    @media (max-width: 600px){
      .sidebar{ width: 100vw !important; font-size: 14px;}
      .chat-messages{ padding: 11px 1vw 10px;}
      .chat-input-bar{ gap:3px; }
      .chat-header{ padding: 12px 2vw 7px 2vw;}
      .message{ font-size:14px; padding: 8px 8px 8px 7px; }
      .audio-duration{ font-size: 12px;}
    }
    @media (max-width: 450px){
      .chat-header,
.chat-username{ font-size: 15px;}
      .chat-avatar{ width: 32px; height: 32px; font-size:15px;}
      .chat-input{ font-size: 13px;}
    }
