/* ============================================================
   GheReCess -- components.css
   ============================================================ */

/* ---------- Auth card ---------- */
.auth-card {
  width: min(380px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  box-shadow: var(--shadow-soft);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  text-align: center;
}

.brand-mark {
  width: 80px;
}

.brand-wordmark {
  font-size: var(--text-lg);
  letter-spacing: 0.01em;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-logo {
  width: 32px;
}

.sidebar-wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-md);
}

.brand-tagline {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.screen-title {
  font-size: var(--text-lg);
  margin-bottom: var(--space-1);
}

.screen-subtitle {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

/* ---------- Fields ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.field input,
.settings-row select {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

.field input:focus,
.settings-row select:focus {
  border-color: var(--accent-500);
}

.form-error {
  color: var(--accent-600);
  font-size: var(--text-sm);
  min-height: 1.1em;
}

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: transform var(--transition-fast), background var(--transition-fast), opacity var(--transition-fast);
}

.btn:active {
  transform: scale(0.98);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--accent-500);
  color: var(--accent-text-on);
}

.btn-primary:hover {
  background: var(--accent-600);
}

.btn-secondary {
  background: var(--bg-raised-2);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-send {
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.only-mobile {
  display: none;
}

/* ---------- Choice cards (PIN vs biometric) ---------- */
.choice-row {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.choice-card {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-align: left;
  transition: border-color var(--transition-fast);
}

.choice-card[data-selected="true"] {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 1px var(--accent-500) inset;
}

.choice-title {
  font-weight: 700;
  font-size: var(--text-sm);
}

.choice-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---------- Avatars ---------- */
.avatar {
  border-radius: 50%;
  background: var(--accent-500);
  color: var(--accent-text-on);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  flex-shrink: 0;
  position: relative;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  font-size: var(--text-sm);
}

.avatar-md {
  width: 44px;
  height: 44px;
  font-size: var(--text-md);
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: var(--text-lg);
}

.avatar::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text-faint);
  border: 2px solid var(--bg-surface);
}

.avatar[data-status="online"]::after {
  background: #8FC9A0;
  box-shadow: 0 0 6px #8fc9a0aa;
}

.avatar[data-status="away"]::after {
  background: #E0C27A;
}

.avatar[data-status="dnd"]::after {
  background: #D17C7C;
}

/* ---------- Chat list ---------- */
.chat-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  text-align: left;
  margin-bottom: 2px;
  transition: background var(--transition-fast);
}

.chat-list-item:hover {
  background: var(--bg-raised);
}

.chat-list-item[data-active="true"] {
  background: var(--bg-raised-2);
}

.chat-list-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-list-name {
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-preview {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
}

.chat-list-time {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.unread-dot {
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent-500);
  color: var(--accent-text-on);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---------- Chat header ---------- */
.chat-header-name {
  font-weight: 700;
  font-size: var(--text-md);
}

.chat-header-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ---------- Messages ---------- */
.message-row {
  display: flex;
  flex-direction: column;
  max-width: 68%;
  align-self: flex-start;
}

.message-row[data-mine="true"] {
  align-self: flex-end;
  align-items: flex-end;
}

.message-sender {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: 0 var(--space-2) 2px;
}

.message-bubble {
  background: var(--bubble-other);
  color: var(--bubble-other-text);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-md);
  line-height: 1.45;
  box-shadow: var(--shadow-card);
  white-space: pre-wrap;
  word-break: break-word;
  cursor: pointer;
}

.message-meta {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin: 3px var(--space-2) 0;
}

.message-row[data-grouped="true"] .message-sender {
  display: none;
}

/* ---------- Typing indicator ---------- */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* ---------- Composer ---------- */
.composer textarea {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  line-height: 1.4;
}

.composer textarea:focus {
  border-color: var(--accent-500);
}

/* ---------- Modal ---------- */
.modal-card,
.modal-sheet {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-soft);
}

.modal-title {
  font-size: var(--text-lg);
  margin-bottom: var(--space-4);
}

.modal-action {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
  color: var(--text-primary);
}

.modal-action:hover {
  background: var(--bg-raised);
}

.modal-action-danger {
  color: var(--text-muted);
}

.reminder-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.reminder-chip {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

.reminder-chip[data-selected="true"] {
  border-color: var(--accent-500);
  background: var(--accent-300);
  color: var(--accent-text-on);
}

/* ---------- Settings ---------- */
.settings-heading {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.segmented {
  display: flex;
  background: var(--bg-raised);
  border-radius: 999px;
  padding: 3px;
  border: 1px solid var(--border-soft);
}

.segmented button {
  background: transparent;
  border: none;
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.segmented button[data-active="true"] {
  background: var(--accent-500);
  color: var(--accent-text-on);
}

.swatch-row {
  display: flex;
  gap: var(--space-2);
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
}

.swatch[data-accent="pink"] { background: #DD90AC; }
.swatch[data-accent="blue"] { background: #8FB4DC; }
.swatch[data-accent="red"] { background: #D08A77; }
.swatch[data-accent="purple"] { background: #A893D9; }

.swatch[data-active="true"] {
  border-color: var(--text-primary);
}

.chat-info-member {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chat-info-member input {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  color: var(--text-primary);
}
