/*===== ALL THE CSS FOR THE MESSAGES ====*/ 
.gravvin-badge{
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    transform: translateY(-8px);
    opacity: 0;
    z-index: 50;
    background: rgba(46, 46, 46, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(191, 200, 182, 0.25);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 400;
    color: rgba(244, 242, 238, 0.9);
    letter-spacing: 0.01em;
    pointer-events: none;
    font-family: -apple-system, 'SF Pro Display', 'Google Sans', Roboto, sans-serif;
    transition: opacity .2s ease, transform .2s ease;
}

.gravvin-badge.show{
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}


#badgeDot.badgeDot{ grid-area: dot; margin-top: 4px; transition: opacity .2s ease; }
#badgeText{
    color: #c4c4c4;
    flex: 1;
    min-width: 0;
    line-height: 1.125; 
    /*overflow-wrap:normal*/ 
    hyphens:auto;
    text-align: left;
    text-wrap: wrap;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    font-size: 12pt;
    font-family: -apple-system, 'SF Pro Display', 'Google Sans', Roboto, sans-serif;
    padding: 0.75em;
    
}
#badgeBtnRow{ grid-area: actions; display:none; gap:8px; white-space:nowrap; align-items:center; }
#badgeBtnRow.show{ display:inline-flex; }

.badgeDot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #A8FF60;
  box-shadow: 0 0 6px rgba(168,255,96,.45);
  display: none;
}
.badgeDot.hide{ opacity: 0; }

/* Error Mode */
.gravvin-badge.is-error{
  background: rgba(36,18,18,.94);
  border-color: rgba(255,82,82,.22);
}
.gravvin-badge.is-error .badgeDot{
  background: #FF5252;
  box-shadow: 0 0 6px rgba(255,82,82,.45);
}

/* Timer-Bar (wird per JS animiert) */
#badgeTimer.badgeTimer{
  grid-area: bar;
  height: 2px;
  border-radius: 99px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
  opacity: 0;
  margin-top: 2em; 
}

#badgeTimer.show{
  opacity: 1;
}

#badgeTimer::before{
  content:"";
  display:block;
  height:100%;
  width:100%;
  transform: scaleX(1);
  transform-origin: left center;
  /*background: rgba(168,255,96,.9);*/
  background: #C0C0C0; 

}

.gravvin-badge.is-error #badgeTimer::before{
  background: rgba(255,82,82,.9);
}

/* JS setzt die Dauer über CSS-Var */
#badgeTimer.run::before{
  animation: badgeCountdown var(--badge-ms, 3000ms) linear forwards;
}


.gravvin-badge.no-dot{
  grid-template-columns: 1fr auto;       /* kein Dot-Column mehr */
  grid-template-areas:
    "text actions"
    "bar  bar";
  column-gap: 12px;
}

/* Dot in diesem Mode wirklich aus dem Layout nehmen */
.gravvin-badge.no-dot #badgeDot{
  display: none;
}


.badgeCircle{
  width: 18px;
  height: 26px;
  display: none;          /* default hidden */
  align-self: center;
    /*position: fixed;*/
    /*margin-right: 8px;*/
}

.badgeCircle.show{
  display: block;
}

.badgeCircle svg{
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.badgeCircle circle{
  fill: none;
  stroke-width: 2;
}

.badgeCircle .bg{
  stroke: rgba(255,255,255,.18);
}

.badgeCircle .progress{
  stroke: rgba(168,255,96,.95);
  stroke-linecap: round;
  stroke-dasharray: 56.55;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset linear;
}

/* Error Farbe */
.gravvin-badge.is-error .badgeCircle .progress{
  stroke: rgba(255,82,82,.95);
}


@keyframes badgeCountdown{
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
