/* ══════════════════════════════════════════════════════════════
   RealTime Spend — Squads & Huddle Styles (squads-style.css)
   Uses existing CSS vars from style.css: --bg, --surface, --surface2,
   --surface3, --text, --text2, --text3, --accent, --accent2, --green,
   --red, --radius, --radius-sm, --font
   ══════════════════════════════════════════════════════════════ */

/* ── Squad List Header ── */
.sq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.sq-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.sq-actions {
  display: flex;
  gap: .5rem;
}

/* ── Buttons ── */
.sq-btn {
  font-family: var(--font, inherit);
  font-size: .82rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm, 8px);
  padding: .5rem 1rem;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.sq-btn-primary {
  background: var(--accent);
  color: var(--bg, #0e0e12);
}
.sq-btn-primary:hover { opacity: .85; }
.sq-btn-outline {
  background: transparent;
  border: 1px solid var(--surface3, #2c2c38);
  color: var(--text2, #a9a8b3);
}
.sq-btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.sq-btn-ghost {
  background: transparent;
  color: var(--text2);
  padding: .4rem .75rem;
}
.sq-btn-ghost:hover { color: var(--accent); }
.sq-btn-sm { padding: .35rem .6rem; font-size: .78rem; }
.sq-btn-danger { background: rgba(252, 165, 165, .15); color: var(--red, #fca5a5); }
.sq-btn-danger:hover { background: rgba(252, 165, 165, .25); }
.sq-btn-send { padding: .5rem 1.2rem; }

/* ── Loading ── */
.sq-loading {
  display: flex; justify-content: center; padding: 3rem 0;
}
.sq-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--surface3, #2c2c38);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: sq-spin .7s linear infinite;
}
@keyframes sq-spin { to { transform: rotate(360deg); } }

/* ── Empty State ── */
.sq-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text3, #6b6a76);
}
.sq-empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.sq-empty p { margin: 0 0 .4rem; }
.sq-empty-sub { font-size: .8rem; max-width: 300px; margin: 0 auto; line-height: 1.5; }

/* ── Squad Cards ── */
.sq-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.sq-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface, #18181f);
  border: 1px solid var(--surface2, #22222c);
  border-radius: var(--radius, 12px);
  padding: .85rem 1rem;
  cursor: pointer;
  transition: all .2s;
}
.sq-card:hover {
  border-color: var(--accent);
  transform: translateX(3px);
}
.sq-card-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.sq-card-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface3, #2c2c38);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  flex-shrink: 0;
}
.sq-card-info { min-width: 0; }
.sq-card-name {
  font-weight: 600;
  font-size: .92rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sq-card-meta {
  font-size: .75rem;
  color: var(--text3, #6b6a76);
  margin-top: .15rem;
}
.sq-card-arrow {
  font-size: 1.3rem;
  color: var(--text3);
  flex-shrink: 0;
  margin-left: .5rem;
}

/* ══════════════════════════════════════
   Huddle Chat
   ══════════════════════════════════════ */

.hd-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.hd-title-wrap { flex: 1; min-width: 0; }
.hd-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hd-subtitle {
  font-size: .72rem;
  color: var(--text3);
}
.hd-header-actions {
  display: flex;
  gap: .25rem;
}

/* ── Message Feed ── */
.hd-messages {
  flex: 1;
  overflow-y: auto;
  padding: .75rem .25rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  min-height: 300px;
  max-height: 50vh;
  border: 1px solid var(--surface2, #22222c);
  border-radius: var(--radius, 12px);
  background: var(--bg, #0e0e12);
  scroll-behavior: smooth;
}
.hd-messages::-webkit-scrollbar { width: 5px; }
.hd-messages::-webkit-scrollbar-thumb {
  background: var(--surface3); border-radius: 3px;
}

.hd-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--text3); font-size: .85rem;
  text-align: center; padding: 2rem;
}

/* ── Message Bubbles ── */
.hd-msg {
  display: flex;
  gap: .5rem;
  max-width: 80%;
  animation: hd-fade-in .25s ease;
}
@keyframes hd-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.hd-msg-me {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.hd-msg-them { align-self: flex-start; }

.hd-msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface3);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: .15rem;
}

.hd-msg-body { min-width: 0; }

.hd-msg-name {
  font-size: .68rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: .15rem;
  padding: 0 .5rem;
}

.hd-msg-bubble {
  padding: .55rem .85rem;
  border-radius: 16px;
  font-size: .85rem;
  line-height: 1.45;
  word-break: break-word;
}
.hd-msg-them .hd-msg-bubble {
  background: var(--surface, #18181f);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.hd-msg-me .hd-msg-bubble {
  background: var(--accent);
  color: var(--bg, #0e0e12);
  border-bottom-right-radius: 4px;
}

.hd-msg-time {
  font-size: .62rem;
  color: var(--text3);
  margin-top: .15rem;
  padding: 0 .5rem;
}
.hd-msg-me .hd-msg-time { text-align: right; }

/* ── Input Bar ── */
.hd-input-bar {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
}
.hd-input {
  flex: 1;
  font-family: var(--font, inherit);
  font-size: .88rem;
  padding: .6rem .9rem;
  border-radius: 20px;
  border: 1px solid var(--surface3, #2c2c38);
  background: var(--surface, #18181f);
  color: var(--text);
  outline: none;
  transition: border .2s;
}
.hd-input:focus { border-color: var(--accent); }
.hd-input::placeholder { color: var(--text3); }

.sq-btn-send {
  border-radius: 20px;
}

/* ══════════════════════════════════════
   Modals
   ══════════════════════════════════════ */

.sq-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity .2s;
  padding: 1rem;
}
.sq-modal-overlay.sq-modal-visible { opacity: 1; }

.sq-modal {
  background: var(--surface, #18181f);
  border: 1px solid var(--surface2, #22222c);
  border-radius: var(--radius, 12px);
  padding: 1.5rem;
  max-width: 380px;
  width: 100%;
  animation: sq-modal-pop .25s ease;
}
@keyframes sq-modal-pop {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.sq-modal h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .75rem;
}
.sq-modal-desc {
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.5;
  margin: 0 0 1rem;
}
.sq-modal-input {
  width: 100%;
  font-family: var(--font, inherit);
  font-size: .92rem;
  padding: .6rem .8rem;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--surface3, #2c2c38);
  background: var(--bg, #0e0e12);
  color: var(--text);
  outline: none;
  margin-bottom: 1rem;
  transition: border .2s;
}
.sq-modal-input:focus { border-color: var(--accent); }

.sq-code-display {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: .35em;
  text-align: center;
  color: var(--accent);
  background: var(--bg, #0e0e12);
  border: 2px dashed var(--surface3);
  border-radius: var(--radius-sm, 8px);
  padding: .8rem;
  margin-bottom: 1rem;
  user-select: all;
}

.sq-modal-btns {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
}

/* ── Toast (fallback) ── */
.sq-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  color: var(--text);
  padding: .6rem 1.2rem;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 500;
  border: 1px solid var(--surface3);
  opacity: 0;
  transition: all .3s;
  z-index: 10000;
  pointer-events: none;
}
.sq-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ── */
@media (max-width: 480px) {
  .sq-header { flex-direction: column; align-items: stretch; }
  .sq-actions { justify-content: stretch; }
  .sq-actions .sq-btn { flex: 1; text-align: center; }
  .hd-messages { max-height: 45vh; min-height: 250px; }
  .hd-msg { max-width: 88%; }
  .hd-header { gap: .4rem; }
}