/**
 * Race Day — Log page v4 redesign
 *
 * Row-based fuel picker with photo thumbs, inline fractions, and per-metric
 * delta strip. All rules scoped under .rd-log-v4 so they do not leak.
 *
 * Source: lap-log-redesign-v4.html mockup.
 */

.rd-log-v4 {
  --rd-l4-cyan:    #22D3EE;
  --rd-l4-red:     #EF4444;
  --rd-l4-green:   #22C55E;
  --rd-l4-dim:     rgba(148, 163, 184, 0.5);
  --rd-l4-muted:   rgba(148, 163, 184, 0.75);
  --rd-l4-border:  rgba(148, 163, 184, 0.14);
  --rd-l4-panel:   rgba(20, 24, 36, 0.65);
  --rd-l4-panel-2: rgba(15, 23, 42, 0.55);
  --rd-l4-food:    #F59E0B;
  --rd-l4-drink:   #22D3EE;
  --rd-l4-supp:    #A78BFA;
  --rd-l4-text:    #F4F6FB;

  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Section header */
.rd-log-v4__sec {
  padding: 14px 0 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rd-log-v4__sec-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rd-l4-muted);
  font-weight: 700;
}
.rd-log-v4__sec-meta {
  font-size: 10px;
  color: var(--rd-l4-dim);
  letter-spacing: 0.04em;
}
.rd-log-v4__quick-note {
  padding: 0 0 4px;
  font-size: 10px;
  color: var(--rd-l4-dim);
  letter-spacing: 0.02em;
}

/* Category divider */
.rd-log-v4__divider {
  margin: 10px 2px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--rd-l4-muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}
.rd-log-v4__divider::before,
.rd-log-v4__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rd-l4-border);
}

/* Rows container */
.rd-log-v4__rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Item row */
.rd-log-v4__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  background: var(--rd-l4-panel);
  border: 1px solid var(--rd-l4-border);
  border-radius: 14px;
  min-height: 56px;
  user-select: none;
  position: relative;
}
.rd-log-v4__row--active {
  background:
    linear-gradient(90deg, rgba(34, 211, 238, 0.08), rgba(34, 211, 238, 0.02)),
    var(--rd-l4-panel);
  border-color: rgba(34, 211, 238, 0.32);
}

/* Thumb */
.rd-log-v4__thumb {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: #1E293B;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rd-l4-border);
}
.rd-log-v4__thumb img { width: 100%; height: 100%; object-fit: cover; }
.rd-log-v4__thumb--food  { background: linear-gradient(135deg, #B45309, #F59E0B); }
.rd-log-v4__thumb--drink { background: linear-gradient(135deg, #0E7490, #22D3EE); }
.rd-log-v4__thumb--supp  { background: linear-gradient(135deg, #6D28D9, #A78BFA); }
.rd-log-v4__thumb--other { background: linear-gradient(135deg, #334155, #64748B); }
.rd-log-v4__dot {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 6px; height: 6px;
  border-radius: 999px;
  box-shadow: 0 0 0 1.5px var(--surface, #0B0F1A);
}
.rd-log-v4__dot--food  { background: var(--rd-l4-food);  }
.rd-log-v4__dot--drink { background: var(--rd-l4-drink); }
.rd-log-v4__dot--supp  { background: var(--rd-l4-supp);  }
.rd-log-v4__dot--other { background: var(--rd-l4-dim);   }

/* Info column */
.rd-log-v4__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rd-log-v4__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--rd-l4-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  min-width: 0;
  flex: 0 1 auto;
}
/* Name row wraps the item name + a small "boost" badge
   that marks items filling the lap's biggest macro gap. */
.rd-log-v4__name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.rd-log-v4__boost {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 999px;
  color: #34d399;               /* emerald-400 */
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.35);
  line-height: 1.3;
  white-space: nowrap;
}
.rd-log-v4__macros {
  display: inline-flex;
  gap: 4px;
  font-size: 10px;
  color: var(--rd-l4-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.rd-log-v4__macro {
  padding: 1px 5px;
  background: rgba(148, 163, 184, 0.06);
  border-radius: 5px;
  white-space: nowrap;
}
.rd-log-v4__macro .u { color: var(--rd-l4-dim); }

/* Controls */
.rd-log-v4__ctl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.rd-log-v4__minus {
  width: 22px; height: 22px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--rd-l4-red);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.rd-log-v4__value {
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(34, 211, 238, 0.14);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--rd-l4-cyan);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.rd-log-v4__add {
  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.12);
  color: var(--rd-l4-cyan);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rd-log-v4__add:active { background: rgba(34, 211, 238, 0.28); }

/* Fraction trigger */
.rd-log-v4__frac-btn {
  min-width: 34px; height: 22px;
  padding: 0 6px;
  border: 1px solid var(--rd-l4-border);
  background: rgba(148, 163, 184, 0.06);
  color: var(--rd-l4-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.rd-log-v4__frac-btn--open {
  background: rgba(34, 211, 238, 0.14);
  color: var(--rd-l4-cyan);
  border-color: rgba(34, 211, 238, 0.3);
}

.rd-log-v4__frac-pop {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(11, 15, 26, 0.97);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 999px;
  box-shadow: 0 8px 24px -10px rgba(0,0,0,0.7);
  animation: rd-log-v4-fracpop 140ms ease-out;
}
@keyframes rd-log-v4-fracpop {
  from { opacity: 0; transform: translate(6px, -50%); }
  to   { opacity: 1; transform: translate(0,  -50%); }
}
.rd-log-v4__frac-pop button {
  width: 30px; height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--rd-l4-text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.rd-log-v4__frac-pop button:active {
  background: rgba(34, 211, 238, 0.2);
  color: var(--rd-l4-cyan);
}

/* Crew notes textarea block */
.rd-log-v4-notes {
  padding: 6px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-log-v4-notes__label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rd-l4-muted);
  font-weight: 700;
}
.rd-log-v4-notes__meta {
  font-size: 10px;
  color: var(--rd-l4-dim);
}
.rd-log-v4-notes__input {
  width: 100%;
  padding: 10px 12px;
  background: var(--rd-l4-panel);
  border: 1px solid var(--rd-l4-border);
  border-radius: 10px;
  color: var(--rd-l4-text);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 48px;
  line-height: 1.4;
}
.rd-log-v4-notes__input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.4);
}
