/* ============================================================
   GYROPE — Complete Stylesheet
   Design: Dark cloud-blue communication app
   Fonts: Nunito (matches rounded logo wordmark)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Brand colors — matching logo gradient */
  --brand-start:   #0070d8;
  --brand-end:     #00c6f8;
  --brand-grad:    linear-gradient(135deg, #0070d8, #00c6f8);
  --brand-glow:    rgba(0, 140, 220, 0.28);

  /* Backgrounds */
  --bg-base:       #0a0a14;
  --bg-panel:      #111120;
  --bg-sidebar:    #13132a;
  --bg-hover:      #1c1c38;
  --bg-active:     #22224a;
  --bg-input:      #191930;
  --bg-modal:      #161630;
  --bg-sent:       #0070d8;
  --bg-recv:       #1c1c38;

  /* Text */
  --text-primary:  #e8eaf6;
  --text-secondary:#9098b8;
  --text-muted:    #5a6080;

  /* Status */
  --online:        #3de8a0;
  --away:          #f7c948;
  --busy:          #ff5b7a;
  --offline:       #444466;

  /* Borders */
  --border:        rgba(255,255,255,0.07);
  --border-focus:  rgba(0,180,240,0.5);

  /* Radii */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  18px;
  --r-xl:  26px;
  --r-full: 9999px;

  /* Shadows */
  --sh-sm: 0 2px 8px rgba(0,0,0,0.35);
  --sh-md: 0 4px 20px rgba(0,0,0,0.45);
  --sh-lg: 0 8px 40px rgba(0,0,0,0.65);

  --transition: 0.16s ease;
}

html, body {
  height: 100%;
  font-family: 'Nunito', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar           { width: 4px; }
::-webkit-scrollbar-track     { background: transparent; }
::-webkit-scrollbar-thumb     { background: var(--bg-hover); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Utility ────────────────────────────────────── */
.hidden { display: none !important; }

/* ============================================================
   AUTH PAGE
   ============================================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 15%, rgba(0,112,216,0.18) 0%, transparent 65%),
    radial-gradient(ellipse 55% 40% at 85% 85%, rgba(0,198,248,0.12) 0%, transparent 65%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(60,0,160,0.07) 0%, transparent 70%),
    var(--bg-base);
  z-index: 0;
}

.auth-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.035) 1px, transparent 0);
  background-size: 30px 30px;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 24px;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 44px 36px 40px;
  box-shadow: var(--sh-lg), 0 0 0 1px rgba(255,255,255,0.025) inset;
  animation: cardIn 0.45s cubic-bezier(0.34, 1.46, 0.64, 1);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Logo */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 30px;
}

.auth-logo-icon {
  width: 46px;
  height: 46px;
  background: var(--brand-grad);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 18px var(--brand-glow);
  flex-shrink: 0;
}

.auth-logo-text {
  font-size: 24px;
  font-weight: 800;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

/* Tabs */
.auth-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 24px;
  gap: 3px;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.auth-tab.active {
  background: var(--bg-active);
  color: var(--text-primary);
  box-shadow: var(--sh-sm);
}

/* Forms */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-input {
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.form-input::placeholder { color: var(--text-muted); }

/* Avatar Upload */
.avatar-upload {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-preview {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-muted);
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-upload-label {
  flex: 1;
  display: block;
  padding: 10px 14px;
  background: var(--bg-hover);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.avatar-upload-label:hover {
  border-color: var(--brand-end);
  color: var(--brand-end);
  background: rgba(0,198,248,0.06);
}

/* Buttons */
.btn-primary {
  padding: 12px;
  background: var(--brand-grad);
  border: none;
  border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 18px var(--brand-glow);
  letter-spacing: 0.2px;
  margin-top: 6px;
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 26px rgba(0,140,220,0.5);
  transform: translateY(-1px);
}

.btn-primary:active  { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  padding: 11px 18px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

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

/* Alert messages */
.auth-alert {
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  display: none;
}

.auth-alert.error {
  display: block;
  background: rgba(255,91,122,0.12);
  border: 1px solid rgba(255,91,122,0.28);
  color: #ff7a95;
}

.auth-alert.success {
  display: block;
  background: rgba(61,232,160,0.1);
  border: 1px solid rgba(61,232,160,0.28);
  color: #3de8a0;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   CHAT APP LAYOUT
   ============================================================ */

.chat-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  width: 295px;
  min-width: 260px;
  max-width: 295px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* ── Sidebar Header ── */
.sidebar-header {
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-wrap:hover .user-avatar {
  border-color: var(--brand-end);
}

.status-ring {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2.5px solid var(--bg-sidebar);
  transition: background var(--transition);
}

.status-ring.online  { background: var(--online); }
.status-ring.away    { background: var(--away); }
.status-ring.busy    { background: var(--busy); }
.status-ring.offline { background: var(--offline); }

/* Online pulse */
.status-ring.online::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--online);
  opacity: 0.3;
  animation: pulse-online 2s ease-in-out infinite;
}

@keyframes pulse-online {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50%       { transform: scale(1.7); opacity: 0; }
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-display-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.sidebar-icon-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 15px;
  transition: background var(--transition), color var(--transition);
}

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

/* ── Status Selector ── */
.status-selector {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.status-select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.status-select:focus {
  border-color: var(--border-focus);
}

/* ── Search + Add ── */
.sidebar-search {
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus { border-color: var(--border-focus); }
.search-input::placeholder { color: var(--text-muted); }

.add-contact-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-grad);
  border: none;
  cursor: pointer;
  font-size: 20px;
  font-weight: 300;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 2px 10px var(--brand-glow);
}

.add-contact-btn:hover {
  filter: brightness(1.1);
  transform: scale(1.08);
}

/* ── Contacts List ── */
.contacts-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.contacts-label {
  padding: 10px 16px 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.empty-contacts {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-contacts p:first-child {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.empty-contacts p {
  font-size: 13px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-radius: var(--r-md);
  margin: 1px 6px;
  position: relative;
}

.contact-item:hover     { background: var(--bg-hover); }
.contact-item.active    { background: var(--bg-active); }

.contact-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: white;
  overflow: hidden;
}

.contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-status-ring {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
}

.contact-status-ring.online  { background: var(--online); }
.contact-status-ring.away    { background: var(--away); }
.contact-status-ring.busy    { background: var(--busy); }
.contact-status-ring.offline { background: var(--offline); }

.contact-info {
  flex: 1;
  overflow: hidden;
}

.contact-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-last-msg {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.contact-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.contact-time {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.unread-badge {
  background: var(--brand-grad);
  color: white;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--r-full);
  min-width: 20px;
  text-align: center;
}

/* ============================================================
   CHAT MAIN
   ============================================================ */

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-panel);
  position: relative;
}

/* ── Empty State ── */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px;
  text-align: center;
}

.chat-empty-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: white;
  box-shadow: 0 8px 32px var(--brand-glow);
  margin-bottom: 8px;
}

.chat-empty h2 {
  font-size: 22px;
  font-weight: 800;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chat-empty p {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Chat Window ── */
.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.chat-header-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--offline);
  display: inline-block;
}

.chat-header-status.online::before   { background: var(--online); }
.chat-header-status.away::before     { background: var(--away); }
.chat-header-status.busy::before     { background: var(--busy); }
.chat-header-status.offline::before  { background: var(--offline); }

.chat-header-actions {
  display: flex;
  gap: 4px;
}

/* Messages Area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Date Separator */
.date-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}

.date-separator::before,
.date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.date-separator span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.4px;
}

/* Message Row */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 2px;
  animation: msgIn 0.2s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-row.sent {
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Spacer so consecutive messages from same sender don't show avatar each time */
.msg-avatar-spacer {
  width: 30px;
  flex-shrink: 0;
}

.msg-bubble-wrap {
  max-width: 65%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.msg-row.sent .msg-bubble-wrap {
  align-items: flex-end;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  word-break: break-word;
}

.msg-row.recv .msg-bubble {
  background: var(--bg-recv);
  color: var(--text-primary);
  border-bottom-left-radius: 5px;
}

.msg-row.sent .msg-bubble {
  background: var(--bg-sent);
  color: white;
  border-bottom-right-radius: 5px;
}

/* Consecutive messages: less rounded on the connected side */
.msg-row.recv.consecutive .msg-bubble { border-top-left-radius: 5px; }
.msg-row.sent.consecutive .msg-bubble { border-top-right-radius: 5px; }

.msg-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 4px;
}

.msg-time {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.msg-seen {
  font-size: 11px;
  color: var(--brand-end);
}

/* ── Message Input ── */
.message-input-area {
  padding: 14px 18px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
}

.emoji-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-sm);
  transition: transform var(--transition);
  flex-shrink: 0;
  line-height: 1;
}

.emoji-btn:hover { transform: scale(1.15); }

/* Emoji Picker */
.emoji-picker {
  position: absolute;
  bottom: 70px;
  left: 18px;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px;
  box-shadow: var(--sh-lg);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  z-index: 100;
  animation: fadeUp 0.18s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.emoji-picker span {
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  border-radius: var(--r-sm);
  text-align: center;
  transition: background var(--transition);
  line-height: 1;
}

.emoji-picker span:hover { background: var(--bg-hover); }

.message-input {
  flex: 1;
  padding: 11px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}

.message-input:focus {
  border-color: var(--border-focus);
}

.message-input::placeholder { color: var(--text-muted); }

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-grad);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 2px 10px var(--brand-glow);
}

.send-btn:hover {
  filter: brightness(1.1);
  transform: scale(1.08);
}

.send-btn svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: overlayIn 0.15s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--sh-lg);
  animation: modalIn 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-alert {
  padding: 10px 13px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  display: none;
}

.modal-alert.error {
  display: block;
  background: rgba(255,91,122,0.12);
  border: 1px solid rgba(255,91,122,0.28);
  color: #ff7a95;
}

.modal-alert.success {
  display: block;
  background: rgba(61,232,160,0.1);
  border: 1px solid rgba(61,232,160,0.28);
  color: #3de8a0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--border);
}

.modal-footer .btn-primary {
  padding: 11px 22px;
  margin-top: 0;
}

/* ============================================================
   LOADING SCREEN
   ============================================================ */

.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.loading-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: white;
  box-shadow: 0 6px 28px var(--brand-glow);
  animation: logoPulse 1.5s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 6px 28px var(--brand-glow); }
  50%       { box-shadow: 0 6px 50px rgba(0,140,220,0.55); }
}

.loading-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ============================================================
   TYPING INDICATOR
   ============================================================ */

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-recv);
  border-radius: 18px;
  border-bottom-left-radius: 5px;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingDot 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 680px) {
  .sidebar {
    width: 100%;
    max-width: 100%;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
    transform: translateX(0);
    transition: transform 0.25s ease;
  }

  .sidebar.hidden-mobile {
    transform: translateX(-100%);
  }

  .chat-main {
    width: 100%;
  }

  .back-btn {
    display: flex !important;
  }
}

.back-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--brand-end);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
}
