  :root{
    --brand-pink:#ec2f6e;
    --brand-orange:#ff7a45;
    --bg-page:#eef0f3;
    --bg-app:#ffffff;
    --text-dark:#1c1c1e;
    --text-muted:#8e8e93;
    --online-bg:#e8f8ee;
    --online-text:#22a35a;
    --badge-red:#ee3355;
    --divider:#f0f0f2;

   
  }

     .app-header{
    background:linear-gradient(90deg, var(--brand-pink), var(--brand-orange));
    padding:15px 15px 16px;
    color:#fff;
    text-align:center;
    flex-shrink:0;
  }
  .app-header .brand{
    font-weight:800;
    font-size:1.15rem;
    letter-spacing:.3px;
    display:inline-flex;
    align-items:center;
    gap:6px;
  }
  .app-header .brand i{ font-size:1.1rem; }

  /* Scrollable content */
  .app-content{
    flex:1;
    overflow-y:auto;
    padding:16px 16px 8px;
  }
  .app-content::-webkit-scrollbar{ display:none; }
 
  .page-title{
    font-weight:800;
    font-size:1.4rem;
    color:var(--text-dark);
    margin-bottom:14px;
  }
 
  .online-banner{
    background:var(--online-bg);
    color:var(--online-text);
    font-weight:700;
    text-align:center;
    border-radius:14px;
    padding:12px;
    margin-bottom:20px;
    font-size:.95rem;
  }
 
  .section-title{
    font-weight:800;
    font-size:1.05rem;
    color:var(--text-dark);
    margin-bottom:5px;
  }
 
  /* Chat list */
  .chat-list{
    display:flex;
    flex-direction:column;
    gap:10px;
    margin-bottom:24px;
  }
  .chat-item{
    display:flex;
    align-items:center;
    justify-content:space-between;
    background:#fff;
    border:1px solid var(--divider);
    border-radius:14px;
    padding:10px 12px;
  }
  .chat-item .meta{
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    gap:6px;
    min-width:44px;
  }
  .chat-item .time{
    font-size:.72rem;
    color:var(--text-muted);
    white-space:nowrap;
  }
  .chat-item .badge-count{
    background:var(--badge-red);
    color:#fff;
    font-size:.68rem;
    font-weight:700;
    border-radius:50%;
    width:20px; height:20px;
    display:flex;
    align-items:center;
    justify-content:center;
  }
  .chat-item .info{
    flex:1;
    text-align:right;
    padding:0 12px;
    overflow:hidden;
  }
  .chat-item .name{
    font-weight:700;
    font-size:.92rem;
    color:var(--text-dark);
    margin-bottom:2px;
  }
  .chat-item .last-msg{
    font-size:.8rem;
    color:var(--text-muted);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .chat-item .avatar{
    width:46px; height:46px;
    border-radius:50%;
    object-fit:cover;
    flex-shrink:0;
  }
 
  /* Suggestions carousel */
  .suggestions-row{
    display:flex;
    gap:12px;
    overflow-x:auto;
    padding-bottom:6px;
  }
  .suggestions-row::-webkit-scrollbar{ display:none; }
  .suggestion-card{
    position:relative;
    flex:0 0 110px;
    height:150px;
    border-radius:16px;
    overflow:hidden;
    background:#ddd;
  }
  .suggestion-card img{
    width:100%; height:100%;
    object-fit:cover;
  }
  .suggestion-card .overlay{
    position:absolute;
    bottom:0; left:0; right:0;
    background:linear-gradient(to top, rgba(0,0,0,.65), transparent);
    color:#fff;
    padding:8px;
    font-size:.78rem;
    display:flex;
    align-items:center;
    justify-content:space-between;
  }
  .suggestion-card .overlay i{ font-size:.7rem; }
 

  /* Bottom nav */
  .bottom-nav{
    flex-shrink:0;
    display:flex;
    justify-content:space-around;
    align-items:center;
    background:#fff;
    border-top:1px solid var(--divider);
    padding:10px 0 14px;
  }
  .nav-item{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:4px;
    color:var(--text-muted);
    font-size:.68rem;
    font-weight:600;
    text-decoration:none;
  }
  .nav-item i{ font-size:1.25rem; }
  .nav-item.active{ color:var(--brand-pink); }
  .nav-item.active .nav-icon-wrap{
    background:linear-gradient(135deg, var(--brand-pink), var(--brand-orange));
    color:#fff;
    width:38px; height:38px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
  }
  .nav-item .nav-icon-wrap{
    width:38px; height:38px;
    display:flex;
    align-items:center;
    justify-content:center;
  }
  .nav-item.profile i{ color:var(--badge-red); }

  .bottoms{
    background:linear-gradient(90deg, var(--brand-pink), var(--brand-orange));
    color:#fff;
  }

      /* Scrollable content */
  .app-content{
    flex:1;
    overflow-y:auto;
  }
  .app-content::-webkit-scrollbar{ display:none; }
 
  /* Header banner */
  .profile-banner{
    background:linear-gradient(90deg, var(--brand-pink), var(--brand-orange));
    height:130px;
    border-radius:0 0 28px 28px;
  }
 
  .avatar-wrap{
    position:relative;
    width:110px;
    height:110px;
    margin:-62px auto 0;
  }
  .avatar-wrap .avatar-circle{
    width:100%;
    height:100%;
    border-radius:50%;
    background:#d9d9dc;
    border:4px solid #fff;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    font-size:3rem;
  }
  .avatar-wrap .camera-btn{
    position:absolute;
    bottom:4px; left:0;
    width:34px; height:34px;
    background:#3a3a3c;
    color:#fff;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:.9rem;
    border:3px solid #fff;
  }
 
  .profile-name{
    text-align:center;
    font-weight:800;
    font-size:1.3rem;
    color:var(--text-dark);
    margin-top:12px;
  }
  .profile-email{
    text-align:center;
    color:var(--text-muted);
    font-size:.85rem;
    margin-bottom:20px;
  }
 
  .section-body{
    padding:0 20px;
  }
 
  /* Completion card */
  .completion-card{
    background:#fff;
    border:1px solid #f0f0f2;
    border-radius:14px;
    padding:14px 16px;
    margin-bottom:22px;
  }
  .completion-top{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:10px;
  }
  .completion-title{
    font-weight:700;
    font-size:.95rem;
    color:var(--text-dark);
  }
  .edit-btn{
    background:linear-gradient(90deg, var(--brand-pink), var(--brand-orange));
    color:#fff;
    font-size:.75rem;
    font-weight:700;
    border:none;
    border-radius:8px;
    padding:5px 14px;
  }
  .completion-bottom{
    display:flex;
    align-items:center;
    gap:10px;
  }
  .progress{
    flex:1;
    height:8px;
    background:var(--track-bg);
    border-radius:8px;
  }
  .progress-bar-custom{
    height:100%;
    border-radius:8px;
    background:linear-gradient(90deg, var(--brand-pink), var(--brand-orange));
  }
  .completion-pct{
    font-size:.8rem;
    color:var(--text-muted);
    font-weight:600;
    white-space:nowrap;
  }
 
  .section-title{
    font-weight:800;
    font-size:1.05rem;
    color:var(--text-dark);
    margin-bottom:12px;
  }
 
  .bio-box{
    width:100%;
    background:#fff;
    border:1px solid #e6e6e9;
    border-radius:14px;
    padding:14px;
    color:var(--text-muted);
    font-size:.85rem;
    font-family:inherit;
    resize:none;
    margin-bottom:22px;
  }
 
  /* Interests */
  .interests-wrap{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin-bottom:24px;
  }
  .interest-tag{
    background:var(--tag-bg);
    color:var(--text-dark);
    font-size:.85rem;
    font-weight:600;
    padding:8px 18px;
    border-radius:20px;
  }
 
  /* Settings */
  .settings-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:12px 0;
    border-bottom:1px solid #f0f0f2;
  }
  .settings-row:last-child{ border-bottom:none; }
  .settings-label{
    font-weight:600;
    font-size:.9rem;
    color:var(--text-dark);
  }
  .settings-right{
    display:flex;
    align-items:center;
    gap:8px;
  }
  .on-label{
    font-size:.8rem;
    font-weight:700;
    color:var(--text-dark);
  }
 
  /* Toggle switch */
  .switch{
    position:relative;
    display:inline-block;
    width:44px;
    height:24px;
  }
  .switch input{ display:none; }
  .slider{
    position:absolute;
    cursor:pointer;
    inset:0;
    background:linear-gradient(90deg, var(--brand-pink), var(--brand-orange));
    border-radius:24px;
    transition:.2s;
  }
  .slider::before{
    content:"";
    position:absolute;
    width:18px; height:18px;
    right:3px; top:3px;
    background:#fff;
    border-radius:50%;
    transition:.2s;
  }
  .switch input:checked + .slider::before{
    transform:translateX(-20px);
  }
 
  .change-pw{
    padding:14px 0 20px;
    font-weight:600;
    font-size:.9rem;
    color:var(--text-dark);
  }
 
  .logout-wrap{
    padding:10px 20px 24px;
  }
  .btn-logout{
    width:100%;
    background:linear-gradient(90deg, #f5b79a, #f6d2b8);
    color:#8a3b1f;
    font-weight:800;
    font-size:.95rem;
    border:none;
    border-radius:14px;
    padding:14px;
  }

   /* Fallback theme variables, in case header.php doesn't already define them */
  


































    .chat-wrapper {
      display: flex;
      flex-direction: column;
      height: calc(100vh - 120px);
      min-height: 520px;
      max-width: 500px;
      margin: 20px auto;
      background: #fff;
      border-radius: 20px;
      overflow: hidden;
      box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
    }

    /* Header */
    .chat-header {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 16px;
      background: linear-gradient(90deg, var(--brand-pink), var(--brand-orange));
      color: #fff;
      flex-shrink: 0;
    }
    .chat-header .back-btn {
      color: #fff;
      font-size: 1.3rem;
      text-decoration: none;
    }
    .chat-header .chat-avatar {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      object-fit: cover;
      border: 2px solid rgba(255, 255, 255, .6);
      background: #fff2;
    }
    .chat-header-info { flex: 1; overflow: hidden; }
    .chat-header-name {
      font-weight: 700;
      font-size: 1rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .chat-header-status { font-size: .75rem; opacity: .85; }

    /* Messages */
    .chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      background: #f7f7fa;
    }
    .chat-empty {
      text-align: center;
      color: var(--text-muted);
      margin-top: 40px;
      font-size: .9rem;
    }

    .msg-row {
      max-width: 75%;
      display: flex;
      flex-direction: column;
    }
    /* Physical left/right margins keep this correct regardless of the page's RTL direction */
    .msg-row.sent { margin-left: auto; align-items: flex-end; }
    .msg-row.received { margin-right: auto; align-items: flex-start; }

    .msg-bubble {
      padding: 10px 14px;
      border-radius: 16px;
      font-size: .9rem;
      line-height: 1.5;
      word-wrap: break-word;
      white-space: pre-wrap;
    }
    .msg-row.sent .msg-bubble {
      background: linear-gradient(90deg, var(--brand-pink), var(--brand-orange));
      color: #fff;
    }
    .msg-row.received .msg-bubble {
      background: #fff;
      color: var(--text-dark);
      border: 1px solid #eee;
    }
    .msg-time {
      font-size: .68rem;
      color: var(--text-muted);
      margin-top: 4px;
      padding: 0 4px;
    }

    /* Input bar */
    .chat-input-bar {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      border-top: 1px solid #eee;
      background: #fff;
      flex-shrink: 0;
    }
    .chat-input {
      flex: 1;
      border: 1px solid #e6e6e9;
      border-radius: 20px;
      padding: 10px 16px;
      font-size: .9rem;
      outline: none;
    }
    .chat-input:focus { border-color: var(--brand-pink); }
    .icon-btn {
      background: none;
      border: none;
      font-size: 1.2rem;
      color: var(--text-muted);
    }
    .send-btn {
      width: 42px;
      height: 42px;
      flex-shrink: 0;
      border-radius: 50%;
      border: none;
      background: linear-gradient(90deg, var(--brand-pink), var(--brand-orange));
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.1rem;
    }
    .send-btn:disabled { opacity: .6; }

    /* Header options menu */
    .chat-menu-btn {
      background: none;
      border: none;
      color: #fff;
      font-size: 1.3rem;
      padding: 4px 6px;
    }
    .chat-menu-btn::after { display: none; } /* hide Bootstrap's default caret */
    .chat-menu-dropdown .dropdown-item.text-danger:active {
      background-color: #fdeef0;
      color: #b23a48 !important;
    }

    /* Blocked banner (shown instead of the input bar) */
    .block-banner {
      padding: 16px;
      text-align: center;
      font-size: .85rem;
      color: #b23a48;
      background: #fdeef0;
      border-top: 1px solid #f5d6da;
      flex-shrink: 0;
    }

    /* Chat request banner */
    .request-banner {
      padding: 14px 16px;
      text-align: center;
      font-size: .85rem;
      background: #fff7ed;
      border-top: 1px solid #fde3c7;
      flex-shrink: 0;
    }
    .request-banner .request-text {
      color: #9a5b12;
      margin-bottom: 10px;
    }
    .request-actions {
      display: flex;
      gap: 10px;
      justify-content: center;
    }
    .request-btn {
      border: none;
      border-radius: 10px;
      padding: 8px 22px;
      font-size: .85rem;
      font-weight: 700;
    }
    .request-btn.accept {
      background: linear-gradient(90deg, var(--brand-pink), var(--brand-orange));
      color: #fff;
    }
    .request-btn.reject {
      background: #fff;
      border: 1px solid #ddd;
      color: var(--text-dark);
    }
    .request-btn:disabled { opacity: .6; }
    .waiting-note {
      text-align: center;
      font-size: .78rem;
      color: var(--text-muted);
      padding: 6px 16px 0;
    }


      a.chat-item { display: flex; text-decoration: none; color: inherit; }
    a.chat-item:hover { opacity: .92; }
    .badge-request {
      background: #ff7a45;
      color: #fff;
      font-size: .68rem;
      font-weight: 700;
      border-radius: 10px;
      padding: 3px 9px;
      white-space: nowrap;
    }
    .badge-waiting {
      background: #f0f0f2;
      color: #8e8e93;
      font-size: .68rem;
      font-weight: 600;
      border-radius: 10px;
      padding: 3px 9px;
      white-space: nowrap;
    }