/* inputs.css — Message compose bar, send button, reply bar, search input, command palette */

/* ── Input ── */
#input-area {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) var(--space-lg);
  /* Extra bottom padding so the footer toggle button doesn't overlap the compose bar */
  padding-bottom: var(--space-3xl);
  display: flex;
  gap: var(--space-md);
  background: var(--bg-secondary);
}

#msg-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius);
  font-size: var(--text-base);
  outline: none;
  font-family: inherit;
  resize: none;
  min-height: 38px;
  max-height: 150px;
  overflow-y: auto;
  line-height: 1.4;
}

#msg-input:focus { border-color: var(--accent); }

#send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

#send-btn:hover { background: var(--accent-hover); }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Command Palette ── */
#cmd-palette-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: var(--text-2xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
#cmd-palette-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

#cmd-palette-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
}
#cmd-palette-overlay.open { display: block; }

#cmd-palette {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
  padding: var(--space-md) 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1000;
}
#cmd-palette-overlay.open #cmd-palette {
  opacity: 1;
  transform: translateY(0);
}

#cmd-palette .cp-category {
  padding: var(--space-md) var(--space-xl) var(--space-xs);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

#cmd-palette .cp-item {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-md) var(--space-xl);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text);
  transition: background 0.1s;
}
#cmd-palette .cp-item:hover { background: var(--bg-hover); }
#cmd-palette .cp-item .cp-icon { font-size: 1rem; flex-shrink: 0; width: 1.4rem; text-align: center; }
#cmd-palette .cp-item .cp-label { font-weight: 500; }
#cmd-palette .cp-item .cp-desc { font-size: var(--text-xs); color: var(--text-muted); margin-left: auto; white-space: nowrap; }

/* ── Upload indicator ── */
#upload-indicator {
  font-size: var(--text-xs);
  color: var(--accent);
  padding: var(--space-xs) var(--space-lg);
  display: none;
}

/* ── Character counter ── */
#char-counter {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: right;
  padding: 0 var(--space-lg);
  display: none;
}
#char-counter.warn { color: var(--warning); }
#char-counter.over { color: var(--danger); font-weight: 600; }

/* ── Reply bar ── */
#reply-bar {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  cursor: pointer;
}
#reply-preview {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#reply-preview .reply-author {
  color: var(--accent);
  font-weight: 600;
}
#reply-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-base);
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
}
#reply-cancel:hover { color: var(--text); }

/* ── Upload attachment button ── */
#attach-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
}
#attach-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Typing indicator ── */
#typing-indicator {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-xs) var(--space-lg);
  min-height: 1.2rem;
}

/* Mobile input tweaks */
@media (max-width: 640px) {
  /* Prevent iOS zoom on input focus */
  #msg-input { font-size: 16px; }

  /* Comfortable input area on mobile */
  #input-area {
    padding: var(--space-md);
    gap: var(--space-md);
  }
  #send-btn {
    padding: var(--space-lg) var(--space-xl);
    font-size: var(--text-base);
    min-width: 52px;
    min-height: 44px;
  }
  #help-btn {
    min-width: 36px;
    min-height: 36px;
    font-size: var(--text-base);
  }
  #msg-input {
    padding: var(--space-lg) var(--space-lg);
    min-height: 44px;
  }

  #cmd-palette { width: calc(100vw - 1rem); left: var(--space-md); right: var(--space-md); max-height: 55vh; }
}
