/* ═══════════════════════════════════════════════════════════════════
   favorites-widget.css
   Sağ kenarda sabit yüzen favori widget'ı
   ═══════════════════════════════════════════════════════════════════ */

/* ── Widget container ───────────────────────────────────────────── */
.favorites-widget {
  position: fixed !important;
  bottom: 80px !important;
  right: -340px !important; /* kapalıyken ekran dışında */
  left: auto !important;
  width: 300px;
  max-width: calc(100vw - 24px);
  z-index: 9990;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(2, 6, 23, 0.12);
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.favorites-widget.open {
  right: 16px !important;  /* açıkken sağdan 16px */
  left: auto !important;
}

/* Dark mode */
.favorites-widget.dark {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

/* ── Toggle butonu (sağ kenarda her zaman görünür) ──────────────── */
.favorites-widget-toggle {
  position: fixed !important;
  bottom: 80px !important;
  right: 0 !important;
  left: auto !important;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -3px 0 12px rgba(99, 102, 241, 0.35);
  transition: background 0.2s ease, transform 0.15s ease;
  z-index: 9991;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.favorites-widget-toggle:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.favorites-widget-toggle:active {
  transform: scale(0.92);
}

/* ── Header ─────────────────────────────────────────────────────── */
.favorites-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
}

.favorites-widget.dark .favorites-widget-header {
  background: #1e293b;
  border-bottom-color: #334155;
}

.favorites-widget-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.favorites-widget-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Refresh butonu ─────────────────────────────────────────────── */
.favorites-widget-refresh {
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border: none;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.3s ease, background 0.2s ease;
  line-height: 1.4;
}

.favorites-widget-refresh:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  transform: rotate(180deg);
}

.favorites-widget.dark .favorites-widget-refresh {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* ── Body / liste ───────────────────────────────────────────────── */
.favorites-widget-body {
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.favorites-widget-body::-webkit-scrollbar {
  width: 4px;
}

.favorites-widget-body::-webkit-scrollbar-track {
  background: transparent;
}

.favorites-widget-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* ── Satır ──────────────────────────────────────────────────────── */
.favorites-widget-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 10px;
  margin-bottom: 3px;
  background: #f8fafc;
  cursor: pointer;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.favorites-widget.dark .favorites-widget-item {
  background: #1e293b;
}

.favorites-widget-item:hover {
  background: #e2e8f0;
}

.favorites-widget.dark .favorites-widget-item:hover {
  background: #334155;
}

/* ── Logo ───────────────────────────────────────────────────────── */
.favorites-widget-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Placeholder div (harf gösterimi) */
div.favorites-widget-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 10px;
}

/* ── Coin bilgisi ───────────────────────────────────────────────── */
.favorites-widget-info {
  flex: 1;
  min-width: 0;
}

.favorites-widget-symbol {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorites-widget-price {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.favorites-widget.dark .favorites-widget-price {
  color: #94a3b8;
}

/* ── Değişim ────────────────────────────────────────────────────── */
.favorites-widget-change {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.favorites-widget-change.positive { color: #10b981; }
.favorites-widget-change.negative { color: #ef4444; }

/* ── Kaldır butonu ──────────────────────────────────────────────── */
.favorites-widget-remove {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid #fca5a5;
  background: #fff1f2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.favorites-widget-remove:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  transform: scale(1.1);
}

.favorites-widget.dark .favorites-widget-remove {
  background: #1e293b;
  border-color: #f59e0b;
  color: #fbbf24;
}

.favorites-widget.dark .favorites-widget-remove:hover {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #ffffff;
}

/* ── Boş durum ──────────────────────────────────────────────────── */
.favorites-widget-empty {
  padding: 20px 16px;
  text-align: center;
  font-size: 12px;
  color: #64748b;
  line-height: 1.6;
}

.favorites-widget.dark .favorites-widget-empty {
  color: #94a3b8;
}

.favorites-widget-empty a {
  color: #6366f1;
  text-decoration: none;
}

.favorites-widget-empty a:hover {
  text-decoration: underline;
}

/* ── Mobil (≤640px) ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Widget: kapalıyken ekranın altına gizle */
  .favorites-widget {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    /* kapalıyken tamamen aşağıda gizli */
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .favorites-widget.open {
    right: 0 !important;   /* override desktop right:16px */
    left: 0 !important;
    transform: translateY(0);
  }

  /* Toggle butonu: sağ altta sabit */
  .favorites-widget-toggle {
    bottom: 16px;
    right: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px 0 0 10px;
  }

  .favorites-widget-body {
    max-height: 50vh;
  }

  .favorites-widget-header {
    padding: 12px 16px;
  }
}

/* ── Admin bottom nav varsa yukarı kaydır ───────────────────────── */
@media (max-width: 1023px) {
  body:has(nav.lg\:hidden.fixed.bottom-0) .favorites-widget-toggle {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px) + 8px);
  }

  body:has(nav.lg\:hidden.fixed.bottom-0) .favorites-widget {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px) + 8px);
  }
}
