/* ════════════════════════════════════════
   JAMES WIDGET CSS — projecthub.live
   ════════════════════════════════════════ */

#james-dock {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e6fa5 0%, #0d4f7c 100%);
    box-shadow: 0 4px 20px rgba(30,111,165,0.45);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  #james-dock:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(30,111,165,0.6);
  }
  #james-dock svg { width: 28px; height: 28px; }
  #james-dock img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
  #james-dock.has-alert::after {
    content: '';
    position: absolute;
    top: -4px; right: -4px;
    width: 16px; height: 16px;
    background: #a6e3a1;
    border-radius: 50%;
    border: 2px solid #1a1f2e;
    animation: james-pulse 1.6s ease-in-out infinite;
  }
  @keyframes james-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.35); opacity: 0.7; }
  }
  #james-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: min(380px, calc(100vw - 16px));
    height: 560px;
    background: #1e2235;
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 18px;
    box-shadow: 0 16px 60px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s ease;
  }
  #james-window.hidden {
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    pointer-events: none;
  }
  #james-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #162a40 0%, #1a2840 100%);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
  }
  #james-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e6fa5, #0d4f7c);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(30,111,165,0.4);
    overflow: hidden;
  }
  #james-avatar img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
  #james-avatar svg { width: 24px; height: 24px; }
  #james-header-info { flex: 1; }
  #james-header-info .name {
    font-size: 14px;
    font-weight: 600;
    color: #cdd6f4;
    letter-spacing: 0.01em;
  }
  #james-header-info .status {
    font-size: 11px;
    color: #a6e3a1;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
  }
  #james-header-info .status::before {
    content: '';
    width: 6px; height: 6px;
    background: #a6e3a1;
    border-radius: 50%;
    display: inline-block;
  }
  #james-close {
    background: none;
    border: none;
    color: #6c7086;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    display: flex;
  }
  #james-close:hover { color: #cdd6f4; background: rgba(255,255,255,0.07); }
  #james-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
  }
  #james-messages::-webkit-scrollbar { width: 4px; }
  #james-messages::-webkit-scrollbar-track { background: transparent; }
  #james-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
  .james-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: james-msg-in 0.25s ease;
  }
  @keyframes james-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .james-msg.bot { align-self: flex-start; }
  .james-msg.user { align-self: flex-end; flex-direction: row-reverse; }
  .james-msg .bubble {
    max-width: 270px;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
  }
  .james-msg.bot .bubble {
    background: #273149;
    color: #cdd6f4;
    border-bottom-left-radius: 4px;
  }
  .james-msg.user .bubble {
    background: linear-gradient(135deg, #1e6fa5, #1559a0);
    color: #fff;
    border-bottom-right-radius: 4px;
  }
  .james-msg.bot .msg-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e6fa5, #0d4f7c);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
  }
  .james-msg.bot .msg-avatar img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
  .james-msg.bot .msg-avatar svg { width: 14px; height: 14px; }
  .james-typing .bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
  }
  .james-typing .dot {
    width: 7px; height: 7px;
    background: #6c7086;
    border-radius: 50%;
    animation: james-dot 1.2s ease-in-out infinite;
  }
  .james-typing .dot:nth-child(2) { animation-delay: 0.2s; }
  .james-typing .dot:nth-child(3) { animation-delay: 0.4s; }
  @keyframes james-dot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
    40%           { transform: scale(1); opacity: 1; }
  }
  #james-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 14px 0;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  .james-tab {
    background: none;
    border: none;
    color: #6c7086;
    font-size: 12.5px;
    padding: 6px 12px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
  }
  .james-tab.active { color: #89b4fa; background: rgba(30,111,165,0.15); }
  .james-tab:hover { color: #cdd6f4; }
  #james-unread-badge {
    background: #f38ba8;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    padding: 1px 5px;
    margin-left: 4px;
  }
  .james-inbox-msg {
    background: #273149;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
  }
  .james-inbox-msg:hover { background: #2e3a55; }
  .james-inbox-msg.unread { border-left-color: #89b4fa; }
  .james-inbox-msg .msg-from { font-size: 12px; font-weight: 600; color: #cdd6f4; }
  .james-inbox-msg .msg-project { font-size: 11px; color: #6c7086; margin-top: 2px; }
  .james-inbox-msg .msg-body { font-size: 12.5px; color: #a6adc8; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .james-thread-msg { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
  .james-thread-msg .thread-from { font-size: 11px; color: #6c7086; margin-bottom: 3px; }
  .james-thread-msg .thread-body { font-size: 13px; color: #cdd6f4; white-space: pre-wrap; word-wrap: break-word; }
  .james-thread-msg.mine { text-align: right; }
  .james-thread-msg.mine .thread-from { color: #89b4fa; }
  .james-thread-msg.mine .thread-body { color: #89b4fa; }
  .james-reply-bar { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid rgba(255,255,255,0.07); flex-shrink: 0; align-items: center; }
  .james-reply-bar textarea { flex:1; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 8px 12px; color: #cdd6f4; font-size: 13px; outline: none; resize: none; font-family: inherit; min-height: 60px; }
  .james-reply-bar button.send-btn { background: linear-gradient(135deg,#1e6fa5,#0d4f7c); border: none; border-radius: 8px; color: #fff; padding: 8px 14px; cursor: pointer; font-size: 12px; }
  #james-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 10px;
    flex-shrink: 0;
  }
  .james-chip {
    background: rgba(30,111,165,0.18);
    border: 1px solid rgba(30,111,165,0.35);
    color: #89b4fa;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
  }
  .james-chip:hover {
    background: rgba(30,111,165,0.35);
    border-color: rgba(30,111,165,0.6);
  }
  #james-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.07);
    background: #181d2e;
    flex-shrink: 0;
  }
  #james-input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 9px 16px;
    color: #cdd6f4;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    resize: none;
    min-height: 38px;
    max-height: 120px;
    line-height: 1.4;
    overflow-y: auto;
  }
  #james-input:focus { border-color: rgba(30,111,165,0.6); }
  #james-input::placeholder { color: #45475a; }
  #james-send {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e6fa5, #0d4f7c);
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
  }
  #james-send:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 12px rgba(30,111,165,0.5);
  }
  #james-send svg { width: 16px; height: 16px; }
  #james-footer {
    text-align: center;
    font-size: 10px;
    color: #313244;
    padding: 6px 14px 10px;
    background: #181d2e;
    flex-shrink: 0;
  }
/* ── Mobile styles ─────────────────────────── */
@media (max-width: 600px) {
  #james-dock {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
  #james-window {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: auto;
    width: 100%;
    height: 85vh;
    max-height: 85vh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
  }
  #james-messages {
    padding: 12px 12px;
  }
  .james-msg .bubble {
    max-width: 85vw;
  }
  #james-input-bar {
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  #james-footer {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .james-reply-bar {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  #james-inbox-panel {
    padding: 10px 12px;
  }
}
