/* ── SMS (Twilio) ───────────────────────────────────────────────────────────── */
/* Mirrors the WhatsApp mocker layout with the Twilio red accent (#f22f46). */

/* Sidebar */
.sms-left {
  width: 290px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
}
.sms-left-hdr {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-lt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.sms-left-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-navy);
  letter-spacing: 0.2px;
}
.sms-new-btn {
  background: #f22f46;
  color: #fff;
  border: none;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  font-family: inherit;
}
.sms-new-btn:hover { background: #d81e35; }

.sms-thread-list { flex: 1; overflow-y: auto; }

/* Thread item */
.sms-thread-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  border-left: 3px solid transparent;
  transition: background 0.12s;
}
.sms-thread-item:hover { background: #fdf3f4; }
.sms-thread-item.active {
  background: #fde8ea;
  border-left-color: #f22f46;
}
.sms-thread-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.sms-thread-info { flex: 1; min-width: 0; }
.sms-thread-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}
.sms-thread-name {
  font-size: 13px;
  font-weight: 600;
  color: #111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sms-thread-time { font-size: 10px; color: #aaa; flex-shrink: 0; }
.sms-thread-preview {
  font-size: 11px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.sms-thread-preview .sms-check { color: #f22f46; font-weight: 700; margin-right: 3px; }

/* Empty list */
.sms-thread-empty {
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #ccc;
  font-size: 12px;
  text-align: center;
}

/* Status section (bottom of sidebar) */
.sms-status-section {
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
  padding: 12px 14px 12px;
}
.sms-status-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
}
.sms-status-banner.pending {
  background: #fff8e7;
  border: 1px solid #ffe0a3;
  color: #8a5a00;
}
.sms-status-banner.ready {
  background: #ecfdf3;
  border: 1px solid #a3e7c0;
  color: #166534;
}
.sms-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
  margin-top: 4px;
}
.sms-status-banner.ready .sms-status-dot { background: #22c55e; }
/* From-number picker (shown once Twilio is configured) */
.sms-from-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}
.sms-from-row label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #999;
}
.sms-from-select {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  background: #fff;
  color: #222;
  outline: none;
  cursor: pointer;
}
.sms-from-select:focus { border-color: #f22f46; }

.sms-status-title { font-weight: 600; font-size: 12px; line-height: 1.3; }
.sms-status-sub {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 1px;
  word-break: break-word;
}

/* Main pane */
.sms-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f4f6f5;
}
.sms-pane {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

/* Empty state in main */
.sms-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 24px;
  text-align: center;
  background: #f4f6f5;
}
.sms-empty-icon { width: 64px; height: 64px; opacity: 0.55; }
.sms-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: #555;
  margin: 0;
}
.sms-empty-sub {
  font-size: 12px;
  color: #888;
  line-height: 1.6;
  max-width: 280px;
  margin: -4px 0 0;
}
.sms-cta-btn {
  background: #f22f46;
  color: #fff;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 4px;
  font-family: inherit;
  transition: background 0.12s;
}
.sms-cta-btn:hover { background: #d81e35; }

/* Chat header */
.sms-chat-header {
  padding: 10px 16px;
  background: #1f2933;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sms-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f22f46;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sms-avatar-lg { width: 38px; height: 38px; font-size: 16px; }
.sms-chat-info { flex: 1; min-width: 0; }
.sms-chat-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sms-chat-phone {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}
.sms-icon-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: none;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.sms-icon-btn:hover { background: rgba(255,255,255,0.22); }

.sms-new-fields {
  flex: 1;
  display: flex;
  gap: 8px;
}
.sms-compose-input {
  flex: 1;
  padding: 7px 10px;
  font-size: 12px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  outline: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  transition: background 0.15s;
}
.sms-compose-input::placeholder { color: rgba(255,255,255,0.55); }
.sms-compose-input:focus { background: rgba(255,255,255,0.22); }

/* Chat body */
.sms-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f4f6f5;
}
.sms-chat-empty-hint {
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 13px;
  text-align: center;
}

/* Message rows */
.sms-msg-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 4px;
}
.sms-msg-row.in  { align-items: flex-start; }
.sms-msg-row.out { align-items: flex-end; }

.sms-bubble {
  max-width: 70%;
  padding: 7px 11px 6px;
  font-size: 13px;
  line-height: 1.45;
  color: #111;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
  position: relative;
}
.sms-msg-row.in  .sms-bubble {
  background: #fff;
  border-radius: 8px 8px 8px 2px;
}
.sms-msg-row.out .sms-bubble {
  background: #f22f46;
  color: #fff;
  border-radius: 8px 8px 2px 8px;
}
.sms-bubble-meta {
  font-size: 10px;
  color: #888;
  margin-top: 2px;
  padding: 0 4px;
}
.sms-bubble-err {
  max-width: 70%;
  font-size: 10px;
  color: #c62828;
  margin-top: 2px;
  padding: 0 4px;
}

/* Input bar */
.sms-input-bar {
  padding: 10px 14px;
  background: #f0f0f0;
  border-top: 1px solid #ddd;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}
.sms-textarea {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  background: #fff;
  min-height: 40px;
  max-height: 100px;
  line-height: 1.4;
}

/* Send button + spinner */
@keyframes sms-spin { to { transform: rotate(360deg); } }
.sms-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f22f46;
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s, opacity 0.12s;
}
.sms-send-btn:hover:not(:disabled) { background: #d81e35; }
.sms-send-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.sms-send-btn .sms-btn-icon { line-height: 1; }
.sms-send-btn .sms-btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sms-spin 0.7s linear infinite;
}
.sms-send-btn.loading .sms-btn-icon    { display: none; }
.sms-send-btn.loading .sms-btn-spinner { display: block; }

/* Status line */
.sms-status {
  padding: 4px 14px 8px;
  font-size: 12px;
  background: #f0f0f0;
  min-height: 22px;
  color: #888;
  flex-shrink: 0;
}

/* Visibility — controlled by JS toggling .active, default hidden */
#sms-main-empty,
#sms-main-new,
#sms-main-chat { display: none; }
#sms-main-empty.active,
#sms-main-new.active,
#sms-main-chat.active { display: flex; }
