/* ═══════════════════════════════════════════════════════
   YACHAY LAB — STREAK CSS
   Widget flotante + Panel + Notificaciones + Confeti
═══════════════════════════════════════════════════════ */

/* ── WIDGET FLOTANTE ─────────────────────────────────── */
.streak-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  background: #0a0e1a;
  border: 1.5px solid rgba(90, 95, 224, 0.35);
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(90, 95, 224, 0.15);
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.3s,
    width 0.4s ease;
  min-width: 180px;
  user-select: none;
}
.streak-widget:hover {
  transform: translateY(-3px) scale(1.02);
  border-color: rgba(90, 95, 224, 0.6);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(90, 95, 224, 0.2);
}
.sw-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}
.sw-shrink {
  min-width: 0;
  width: 54px;
  padding: 10px;
  border-radius: 50%;
  overflow: hidden;
}
.sw-shrink .sw-info,
.sw-shrink .sw-xp,
.sw-shrink .sw-bar-wrap {
  display: none;
}
.sw-shrink .sw-flame {
  font-size: 22px;
  text-align: center;
}

/* Pop animation al ganar */
.sw-pop {
  animation: swPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes swPop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.14);
  }
  70% {
    transform: scale(0.97);
  }
  100% {
    transform: scale(1);
  }
}

.sw-main {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.sw-flame {
  font-size: 26px;
  line-height: 1;
  animation: flameDance 1.8s ease-in-out infinite alternate;
  flex-shrink: 0;
}
@keyframes flameDance {
  0% {
    transform: rotate(-4deg) scale(1);
  }
  100% {
    transform: rotate(4deg) scale(1.1);
  }
}
.sw-info {
  flex: 1;
}
.sw-num {
  font-size: 22px;
  font-weight: 900;
  color: #f59e0b;
  line-height: 1;
  font-family: "Plus Jakarta Sans", sans-serif;
}
.sw-lbl {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 1px;
}
.sw-xp {
  font-size: 12px;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 20px;
  padding: 3px 9px;
  white-space: nowrap;
  animation: xpPop 0.5s ease;
}
@keyframes xpPop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.sw-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sw-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}
.sw-fill {
  height: 100%;
  background: linear-gradient(90deg, #5a5fe0, #f59e0b);
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.sw-next {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}

/* ── NOTIFICACIÓN HITO ────────────────────────────────── */
.streak-milestone {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 5000;
  background: #0a0e1a;
  border: 2px solid var(--mc, #f59e0b);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(245, 158, 11, 0.2);
  animation: milestoneIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 320px;
}
@keyframes milestoneIn {
  0% {
    transform: translateX(120%) scale(0.8);
    opacity: 0;
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}
.sm-out {
  animation: milestoneOut 0.4s ease forwards;
}
@keyframes milestoneOut {
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}
.sm-icon {
  font-size: 36px;
  animation: flameDance 1.5s ease-in-out infinite alternate;
}
.sm-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}
.sm-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 3px;
}

/* ── CONFETI ──────────────────────────────────────────── */
.streak-confetti {
  position: fixed;
  top: -10px;
  z-index: 9000;
  animation: confettiFall 2s ease-out forwards;
  pointer-events: none;
}
@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ── PANEL COMPLETO — REDISEÑO PREMIUM ─────────────────── */
.streak-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}

.streak-panel-box {
  background: #0a0e1a;
  border: 1.5px solid rgba(90, 95, 224, 0.3);
  border-radius: 22px;
  padding: 0;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: none;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: panelUp 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.streak-panel-box::-webkit-scrollbar {
  display: none;
}
@keyframes panelUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header */
.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #0a0e1a 80%, transparent);
}
.sp-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sp-fire-ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.2),
    rgba(239, 68, 68, 0.15)
  );
  border: 1.5px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.sp-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}
.sp-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 1px;
}
.sp-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.15s;
}
.sp-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Hero: Ring + Stats */
.sp-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sp-ring-wrap {
  position: relative;
  flex-shrink: 0;
  width: 130px;
  height: 130px;
}
.sp-ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.sp-ring-num {
  font-size: 36px;
  font-weight: 900;
  color: #f59e0b;
  font-family: "JetBrains Mono", monospace;
  line-height: 1;
}
.sp-ring-lbl {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sp-hero-stats {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}
.sp-hstat {
  text-align: center;
}
.sp-hstat-num {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  line-height: 1;
}
.sp-hstat-lbl {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 3px;
}
.sp-hstat-div {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
}

/* Weekly Calendar */
.sp-week {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sp-week-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.sp-week-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.sp-week-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
}
.sp-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.sp-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: 0.2s;
}
.sp-day-today {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
}
.sp-day-active {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.15),
    rgba(239, 68, 68, 0.1)
  );
  border-color: rgba(245, 158, 11, 0.35);
}
.sp-day-future {
  opacity: 0.35;
}
.sp-day-name {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}
.sp-day-ico {
  font-size: 14px;
  line-height: 1;
}
.sp-day-xp {
  font-size: 8px;
  color: #f59e0b;
  font-weight: 700;
  min-height: 10px;
}

/* Milestone */
.sp-milestone-wrap {
  margin: 0 20px 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
}
.sp-milestone-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.sp-milestone-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.sp-milestone-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.sp-milestone-days {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 1px;
}
.sp-milestone-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.5);
  font-family: "JetBrains Mono", monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 9px;
  border-radius: 20px;
}
.sp-milestone-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
}
.sp-milestone-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px currentColor;
}
.sp-milestone-max {
  color: #f59e0b;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

/* Milestones row */
.sp-milestones-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.spm-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  opacity: 0.35;
  filter: grayscale(1);
  transition: 0.2s;
  min-width: 40px;
}
.spm-item.spm-earned {
  opacity: 1;
  filter: none;
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.12),
    rgba(239, 68, 68, 0.08)
  );
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.1);
}
.spm-icon {
  font-size: 18px;
}
.spm-at {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
}
.spm-item.spm-earned .spm-at {
  color: #f59e0b;
}

/* History */
.sp-history-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 6px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sp-hist-count {
  background: rgba(90, 95, 224, 0.2);
  color: #a5b4ff;
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 10px;
}
.sp-history {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px 12px;
}
.sp-hist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: 0.15s;
  cursor: default;
}
.sp-hist-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.shi-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.shi-info {
  flex: 1;
  min-width: 0;
}
.shi-label {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shi-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 1px;
}
.shi-xp {
  font-size: 12px;
  font-weight: 800;
  color: #10b981;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}
.sp-empty {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  padding: 16px;
}

/* CTA */
.sp-cta {
  display: block;
  width: calc(100% - 40px);
  margin: 12px 20px 20px;
  padding: 13px;
  background: linear-gradient(135deg, #5a5fe0, #8056d6);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
  box-shadow: 0 4px 20px rgba(90, 95, 224, 0.4);
}
.sp-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(90, 95, 224, 0.55);
}

/* Responsive */
@media (max-width: 480px) {
  .streak-widget {
    bottom: 14px;
    right: 14px;
  }
  .streak-panel-backdrop {
    padding: 0;
    align-items: flex-end;
    justify-content: center;
  }
  .streak-panel-box {
    width: 100%;
    border-radius: 22px 22px 0 0;
    max-height: 88vh;
  }
  .sp-hero-stats {
    grid-template-columns: 1fr auto 1fr auto;
  }
}

/* ── WEEKLY STREAK BANNER (Home) ─────────────────────────── */
.weekly-streak-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #080d1e, #0f1735);
  border: 1.5px solid rgba(245, 158, 11, 0.25);
  border-radius: 16px;
  padding: 16px 20px;
  cursor: pointer;
  transition: 0.2s;
  position: relative;
  overflow: hidden;
}
.weekly-streak-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 0% 50%,
    rgba(245, 158, 11, 0.07),
    transparent 60%
  );
  pointer-events: none;
}
.weekly-streak-banner:hover {
  border-color: rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.1);
}
.wsb-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.wsb-fire {
  font-size: 28px;
  animation: fireFloat 2s ease-in-out infinite alternate;
}
@keyframes fireFloat {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.15);
  }
}
.wsb-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
}
.wsb-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
}

/* Days grid */
.wsb-days {
  display: flex;
  gap: 5px;
  flex: 1;
  justify-content: center;
}
.wsb-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 5px;
  border-radius: 9px;
  min-width: 32px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: 0.2s;
}
.wsb-day.wsb-active {
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.15),
    rgba(239, 68, 68, 0.1)
  );
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}
.wsb-day.wsb-today {
  border-color: rgba(90, 95, 224, 0.5);
  background: rgba(90, 95, 224, 0.1);
}
.wsb-day.wsb-future {
  opacity: 0.3;
}
.wsb-day-name {
  font-size: 8.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}
.wsb-day-dot {
  font-size: 13px;
  line-height: 1;
}

/* Right counter */
.wsb-right {
  text-align: center;
  flex-shrink: 0;
}
.wsb-count {
  font-size: 28px;
  font-weight: 900;
  color: #f59e0b;
  font-family: "JetBrains Mono", monospace;
  line-height: 1;
}
.wsb-lbl {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@media (max-width: 600px) {
  .weekly-streak-banner {
    flex-wrap: wrap;
    gap: 12px;
  }
  .wsb-left {
    width: 100%;
  }
  .wsb-days {
    width: 100%;
  }
  .wsb-right {
    display: none;
  }
}
