/* Component Styles */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 16px 28px;
  border-radius: var(--radius-md);
  font-weight: var(--font-semibold);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 54px;
  border: none;
  font-family: inherit;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, var(--color-pink), #c0027c);
  color: #fff;
  box-shadow: 0 4px 24px var(--color-pink-glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px var(--color-pink-glow);
}

/* Secondary Button */
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text);
}

/* Ghost Button */
.btn-ghost {
  background: none;
  color: var(--color-pink);
  border: none;
  padding: 8px 12px;
  font-weight: var(--font-medium);
}

.btn-ghost:hover {
  opacity: 0.8;
}

/* Small Button */
.btn-sm {
  padding: 10px 18px;
  font-size: 14px;
  min-height: 44px;
}

/* Large Button */
.btn-lg {
  padding: 18px 32px;
  font-size: 18px;
  min-height: 60px;
}

/* Icon Button */
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Form Inputs */
.input-text,
.input-textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  color: var(--color-text);
  font-size: 15px;
  width: 100%;
  outline: none;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.input-text::placeholder,
.input-textarea::placeholder {
  color: rgba(138, 138, 160, 0.6);
}

.input-text:focus,
.input-textarea:focus {
  border-color: var(--color-pink);
  box-shadow: 0 0 0 3px var(--color-pink-glow);
}

.input-textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

/* Select Input */
.input-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  color: var(--color-text);
  font-size: 15px;
  width: 100%;
  outline: none;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.input-select:focus {
  border-color: var(--color-pink);
  box-shadow: 0 0 0 3px var(--color-pink-glow);
}

/* Range Input */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-pink);
  cursor: pointer;
  transition: all var(--transition-fast);
}

input[type='range']::-webkit-slider-thumb:hover {
  box-shadow: 0 0 12px var(--color-pink-glow);
}

input[type='range']::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-pink);
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

/* Form Label */
.form-label {
  color: var(--color-muted);
  font-size: 14px;
  font-weight: var(--font-semibold);
  display: block;
  margin-bottom: 8px;
}

/* Form Group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

/* Cards */
.card {
  background: var(--color-glass);
  border: 1px solid var(--color-border);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 24px;
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--color-pink);
  box-shadow: 0 4px 24px var(--color-pink-glow);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: 18px;
  font-weight: var(--font-bold);
  color: var(--color-text);
}

.card-subtitle {
  font-size: 14px;
  color: var(--color-muted);
  margin-top: 4px;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-footer {
  border-top: 1px solid var(--color-border);
  padding-top: 16px;
  margin-top: 16px;
}

/* Avatar */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  font-weight: var(--font-bold);
  overflow: hidden;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 18px;
}

.avatar-md {
  width: 44px;
  height: 44px;
  font-size: 24px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 32px;
}

.avatar-xl {
  width: 80px;
  height: 80px;
  font-size: 40px;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: var(--font-semibold);
  white-space: nowrap;
  background: rgba(240, 5, 154, 0.15);
  color: var(--color-pink);
  border: 1px solid rgba(240, 5, 154, 0.3);
}

.badge-success {
  background: rgba(31, 204, 116, 0.15);
  color: var(--color-success);
  border-color: rgba(31, 204, 116, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--color-danger);
  border-color: rgba(244, 63, 94, 0.3);
}

/* Progress Bar */
.progress-bar-container {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  width: 100%;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--color-pink), #ff4dc4);
  animation: xpG 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(240, 5, 154, 0.4);
  transition: width 0.3s ease;
}

/* Loader/Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-md);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--spacing-lg) 0;
}

.divider-vertical {
  width: 1px;
  height: 100%;
  background: var(--color-border);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-3xl);
  text-align: center;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: var(--spacing-lg);
}

.empty-state-title {
  font-size: 18px;
  font-weight: var(--font-bold);
  color: var(--color-text);
  margin-bottom: var(--spacing-sm);
}

.empty-state-text {
  color: var(--color-muted);
  font-size: 14px;
  margin-bottom: var(--spacing-lg);
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.tooltip:hover::after {
  opacity: 1;
}

/* Skeleton loader variants */
.skeleton-line {
  height: 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line.wide { width: 100%; }
.skeleton-line.medium { width: 65%; }
.skeleton-line.short { width: 40%; }
.skeleton-line.title { height: 22px; }

.skeleton-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-xl);
  padding: 20px;
}

/* Inline button spinner */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}

/* Typing indicator (3 dots pulsing) */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ============================================================
   Emoji Picker Modal
   ============================================================ */
.emoji-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 200ms ease;
}

.emoji-picker-modal {
  background: var(--dash-surface, #1a1a22);
  border-radius: 22px;
  padding: 28px;
  max-width: 360px;
  width: calc(100vw - 40px);
  position: relative;
  text-align: center;
  border: 1px solid var(--dash-border, rgba(255,255,255,0.1));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  animation: modalIn 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.emoji-picker-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-picker-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  color: var(--dash-text, #fff);
}

.emoji-picker-preview {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  margin: 18px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  transition: background 0.2s;
}

.emoji-picker-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 28px;
  text-align: center;
  border-radius: 12px;
  border: 1.5px solid var(--dash-border, rgba(255,255,255,0.12));
  background: rgba(255, 255, 255, 0.05);
  color: var(--dash-text, #fff);
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}

.emoji-picker-input:focus {
  border-color: rgba(240, 5, 154, 0.6);
}

.emoji-picker-hint {
  font-size: 12px;
  color: var(--dash-muted, rgba(255,255,255,0.45));
  margin: 10px 0 0;
  line-height: 1.4;
}

.emoji-picker-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.emoji-picker-actions button {
  flex: 1;
}

/* ============================================================
   Notification Dropdown Animations & Mobile Bottom Sheet
   ============================================================ */
.dash-notification-panel {
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.dash-notification-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dash-notification-backdrop {
  position: fixed;
  inset: 0;
  z-index: 998;
}

@media (max-width: 600px) {
  .dash-notification-panel {
    width: 92vw !important;
    max-width: 92vw !important;
    right: 4vw !important;
    border-radius: 12px !important;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Icon styles */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
}

.icon-sm {
  font-size: 18px;
}

.icon-md {
  font-size: 24px;
}

.icon-lg {
  font-size: 32px;
}

.icon-xl {
  font-size: 48px;
}

/* ============================================================
   Connection banner (online/offline indicator)
   ============================================================ */
.connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  z-index: 99999;
  animation: bannerSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.connection-banner.online {
  background: linear-gradient(180deg, #1fcc74, #15a85e);
  color: #fff;
}
.connection-banner.reconnecting {
  background: linear-gradient(180deg, #f59e0b, #d97706);
  color: #1a1500;
}
.connection-banner.offline {
  background: linear-gradient(180deg, #dc2626, #b91c1c);
  color: #fff;
}
.connection-banner.anim-pulse {
  animation: bannerSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1), bannerPulse 1.5s ease-in-out infinite;
}
@keyframes bannerSlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes bannerSlideUp {
  to { transform: translateY(-100%); opacity: 0; }
}
@keyframes bannerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}
.connection-banner.fade-out {
  animation: bannerSlideUp 0.3s ease forwards;
}

/* ============================================================
   Achievement unlock + claim animations
   ============================================================ */
@keyframes achUnlockPop {
  0% { transform: scale(0.7); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes achGlowPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(240, 5, 154, 0.4); }
  50% { box-shadow: 0 0 22px rgba(240, 5, 154, 0.95); }
}
@keyframes achPlatinumShine {
  0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.5); }
  50% { box-shadow: 0 0 40px rgba(245, 158, 11, 0.95), 0 0 60px rgba(245, 158, 11, 0.4); }
}
@keyframes navDotPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 6px rgba(240, 5, 154, 0.7); }
  50% { transform: scale(1.18); box-shadow: 0 0 14px rgba(240, 5, 154, 1); }
}
@keyframes confettiFly {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx, 0), var(--dy, -120px)) rotate(540deg); opacity: 0; }
}

/* ============================================================
   Notification swipe animations
   ============================================================ */
@keyframes notifSwipeOut {
  to { transform: translateX(-110%); opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; }
}
@keyframes notifFlash {
  0%, 100% { background: transparent; }
  50% { background: rgba(240, 5, 154, 0.18); }
}
.notification-swipe-wrapper {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}
.notification-swipe-wrapper .dash-notification-item {
  transition: transform 0.18s ease, background-color 0.18s ease;
  will-change: transform;
}
.notification-swipe-bg {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  pointer-events: none;
  font-size: 13px;
  font-weight: 800;
}
.swipe-action-left { color: #ef4444; opacity: 0; transition: opacity 0.15s; }
.swipe-action-right { color: #f0059a; opacity: 0; transition: opacity 0.15s; }
.notification-swipe-wrapper.swiping-left .swipe-action-left { opacity: 1; }
.notification-swipe-wrapper.swiping-right .swipe-action-right { opacity: 1; }

/* ===== XP Popup Overlay ===== */
.xp-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.xp-popup-card {
  background: var(--dash-surface, #1a1a22);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 340px;
  width: calc(100vw - 48px);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.xp-popup-card.leveled-up {
  border-color: #f0059a;
  box-shadow: 0 0 40px rgba(240, 5, 154, 0.35), 0 20px 60px rgba(0, 0, 0, 0.5);
}
.xp-popup-levelup {
  color: #f0059a;
  font-size: 17px;
  font-weight: 900;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.xp-popup-emoji {
  font-size: 48px;
  margin-bottom: 6px;
  line-height: 1;
}
.xp-popup-level {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 18px;
}
.xp-popup-bar-wrap {
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}
.xp-popup-bar {
  height: 100%;
  background: linear-gradient(90deg, #f0059a, #9b02c8);
  border-radius: 6px;
  transition: width 1.1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(240, 5, 154, 0.5);
}
.xp-popup-numbers {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 22px;
}
.xp-gained {
  color: #f0059a;
  font-weight: 900;
  font-size: 16px;
}
.xp-before, .xp-after {
  font-size: 12px;
}
.xp-popup-close {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #f0059a, #c0027c);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(240, 5, 154, 0.4);
}
.xp-popup-close:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(240, 5, 154, 0.5);
}

/* ============================================================
   Connection Indicator (persistent dot in header)
   ============================================================ */
.conn-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  padding: 4px;
  border-radius: 50%;
  transition: background 0.2s;
}
.conn-indicator:hover {
  background: rgba(255, 255, 255, 0.08);
}

.conn-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

.conn-dot.online {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.conn-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.conn-dot.reconnecting {
  background: #3b82f6;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.7);
  animation: connPulse 0.8s ease-in-out infinite;
}

@keyframes connPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.conn-queue-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #f59e0b;
  color: #1a1500;
  font-size: 10px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  display: none;
  line-height: 16px;
}

/* ============================================================
   Loading skeleton container (dashboard sections)
   ============================================================ */
.loading-skeleton-container {
  padding: var(--spacing-md, 12px) 0;
}

.skel-greeting {
  margin-bottom: 8px;
}

/* Transition suave ao trocar skeleton → conteúdo real */
.loading-skeleton-container + .dash-tab-content,
.dash-tab-content > .loading-skeleton-container {
  animation: fadeInContent 0.25s ease;
}

@keyframes fadeInContent {
  from { opacity: 0.5; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Inline spinner used by loading-states.js */
.inline-loading-spinner {
  display: inline-block;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
