/* ===================================================
   LAGift Live Community Chat & Gift Transfer Styling
   =================================================== */

:root {
  --chat-bg: #0e0d18;
  --chat-surface: #19172c;
  --chat-surface-card: #201d38;
  --chat-accent: #7c3aed;
  --chat-accent-glow: rgba(124, 58, 237, 0.45);
  --chat-gold: #f59e0b;
  --chat-emerald: #10b981;
  --chat-text: #ffffff;
  --chat-text-muted: #9490b8;
  --chat-border: rgba(255, 255, 255, 0.08);
}

/* Floating Chat Action Button */
.lagift-chat-fab {
  position: fixed;
  bottom: 84px;
  right: 16px;
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 8px 24px var(--chat-accent-glow), 0 0 0 1px rgba(255, 255, 255, 0.2);
  cursor: pointer;
  font-family: SF Pro, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.lagift-chat-fab:active {
  transform: scale(0.94);
}

.lagift-chat-fab .fab-icon {
  font-size: 18px;
  line-height: 1;
}

.lagift-chat-fab .fab-badge {
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 2px;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

/* Chat Full-Screen / Modal Overlay */
.lagift-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lagift-chat-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.lagift-chat-container {
  width: 100%;
  max-width: 480px;
  height: 92vh;
  max-height: 850px;
  background: var(--chat-bg);
  border-radius: 28px 28px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.lagift-chat-overlay.active .lagift-chat-container {
  transform: translateY(0);
}

/* Header */
.chat-header {
  padding: 16px 20px;
  background: rgba(25, 23, 44, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

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

.chat-header-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.chat-header-titles h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--chat-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-header-titles p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--chat-text-muted);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-header-gift {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  transition: transform 0.15s;
}

.btn-header-gift:active {
  transform: scale(0.95);
}

.btn-chat-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}

/* Chat Messages Stream */
.chat-messages-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Message row */
.chat-msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 88%;
  animation: msgFadeIn 0.22s ease-out;
}

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

.chat-msg-row.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #3730a3;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

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

.chat-msg-bubble {
  background: var(--chat-surface);
  border: 1px solid var(--chat-border);
  padding: 10px 14px;
  border-radius: 18px 18px 18px 4px;
  color: var(--chat-text);
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
}

.chat-msg-row.mine .chat-msg-bubble {
  background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  border-color: rgba(255, 255, 255, 0.2);
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.25);
}

.chat-msg-sender {
  font-size: 11px;
  font-weight: 700;
  color: #a78bfa;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-msg-row.mine .chat-msg-sender {
  color: #fde047;
}

.chat-msg-time {
  font-size: 10px;
  color: var(--chat-text-muted);
  margin-top: 4px;
  text-align: right;
  opacity: 0.8;
}

/* System Message */
.chat-msg-system {
  align-self: center;
  max-width: 90%;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  margin: 6px auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Gift Message Card */
.chat-gift-card {
  background: linear-gradient(145deg, #1f1b3c 0%, #17132e 100%);
  border: 1.5px solid #8b5cf6;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25), inset 0 0 20px rgba(139, 92, 246, 0.15);
  border-radius: 20px;
  padding: 12px;
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-gift-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-gift-badge {
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-gift-media {
  width: 100%;
  height: 140px;
  border-radius: 14px;
  background: radial-gradient(circle, #2d2358 0%, #151128 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.chat-gift-media video,
.chat-gift-media img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.chat-gift-details h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-gift-details .gift-num {
  color: #f59e0b;
  font-size: 13px;
}

.chat-gift-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.gift-tag {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
}

.chat-gift-note {
  font-size: 12px;
  color: #cbd5e1;
  font-style: italic;
  margin-top: 4px;
}

.chat-gift-btn-claim {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.chat-gift-btn-claim:active {
  transform: scale(0.96);
}

.chat-gift-claimed-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  text-align: center;
  padding: 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

/* Chat Input Bar */
.chat-input-bar {
  padding: 12px 16px;
  background: rgba(25, 23, 44, 0.98);
  border-top: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-open-picker {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.chat-input-box {
  flex: 1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.chat-input-box:focus {
  border-color: #8b5cf6;
}

.btn-chat-send {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #7c3aed;
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.btn-chat-send:active {
  transform: scale(0.92);
}

/* Gift Picker Modal */
.gift-picker-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 20, 0.94);
  backdrop-filter: blur(14px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: 28px 28px 0 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.gift-picker-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.picker-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.picker-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.picker-mode-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.picker-mode-tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--chat-text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.picker-mode-tab.active {
  background: #7c3aed;
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.picker-gifts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.picker-gift-item {
  background: var(--chat-surface-card);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.picker-gift-item.selected {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}

.picker-gift-item video,
.picker-gift-item img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.picker-gift-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-top: 6px;
  text-align: center;
}

.picker-gift-model {
  font-size: 10px;
  color: #a78bfa;
}

.picker-recipient-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.picker-recipient-select option {
  background: #19172c;
  color: #fff;
}

.picker-note-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}

.btn-confirm-send-gift {
  background: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
  transition: all 0.2s;
  margin-top: 10px;
}

.btn-confirm-send-gift:active {
  transform: scale(0.97);
}
