/* ── NORA — Checklist & Tab System ──────────────────── */

/* ── Checklist Items ─────────────────────────────────── */
#tab-container .tab-content { display: flex; flex-direction: column; gap: 6px; }

.time-group-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--hint);
  padding: 10px 4px 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--glass-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s,
              background 0.2s;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
}
.item-row:active { transform: scale(0.97); background: var(--glass-bg-strong); }
.item-row.done {
  opacity: 0.55;
  background: rgba(0, 204, 136, 0.04);
  border-color: rgba(0, 204, 136, 0.12);
}
.item-row.paused { opacity: 0.3; pointer-events: none; }
.item-row.critical:not(.done) {
  border-left: 3px solid var(--warning);
  background: rgba(255, 170, 0, 0.06);
}
.item-row.tooltip-open {
  align-items: flex-start;
}
.item-row.tooltip-open .item-check {
  margin-top: 2px;
}
.critical-badge { font-size: var(--text-xs); }

/* Custom circular checkbox */
.item-check {
  width: 26px; height: 26px;
  border: 2.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 0.8rem;
  color: #fff;
  position: relative;
}
.item-row.done .item-check {
  background: linear-gradient(135deg, var(--success), #00e09a);
  border-color: transparent;
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(0, 204, 136, 0.4);
}
.item-row.done .item-check::after {
  content: '✓';
  font-weight: 700;
}
/* Hide checkmark when spinner is showing (inflight) */
.item-check.loading::after {
  display: none;
}

.item-info { flex: 1; min-width: 0; }
.item-name { font-size: var(--text-base); font-weight: 500; }
.item-name-clickable {
  cursor: pointer;
  transition: color 0.2s ease;
}
.item-name-clickable.active,
.item-name-clickable:active {
  color: var(--warning);
}
.item-streak {
  font-size: var(--text-xs);
  color: var(--warning);
  margin-left: 4px;
  white-space: nowrap;
}
.item-detail {
  font-size: var(--text-xs);
  color: var(--hint);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-tooltip {
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 0.28s ease, opacity 0.2s ease, transform 0.2s ease, padding-top 0.2s ease;
}
.item-tooltip.open {
  padding-top: 8px;
  max-height: 400px;
  opacity: 1;
  transform: translateY(0);
}
.item-tooltip-description {
  font-size: var(--text-sm);
  line-height: 1.35;
  color: var(--fg);
  margin-bottom: 8px;
}
.item-tooltip-description.empty {
  color: var(--hint);
  font-style: italic;
}
.item-tooltip-editor {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.25);
  color: var(--fg);
  font-size: var(--text-sm);
  padding: 8px 10px;
  resize: vertical;
  min-height: 66px;
  margin-bottom: 8px;
}
.item-tooltip-editor:focus {
  outline: none;
  border-color: rgba(255, 170, 0, 0.45);
  box-shadow: 0 0 0 2px rgba(255, 170, 0, 0.16);
}
.item-tooltip-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.item-tooltip-line {
  font-size: var(--text-xs);
  color: var(--hint);
}
.item-tooltip-reactive {
  color: var(--warning);
}
.item-tooltip-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}
.item-tooltip-edit {
  padding: 6px 10px;
  font-size: var(--text-xs);
}

/* ── Item Spinner (in-flight) ────────────────────────── */
.item-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--hint);
  border-top-color: var(--btn-bg);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ═══════════════════════════════════════════════════════
   Tab System (Glassmorphism)
   ═══════════════════════════════════════════════════════ */
#tab-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

/* ── Tab Wrapper ── */
.tab-wrapper {
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.tab-wrapper.expanded {
  transform: translateY(-1px);
}

/* State-based outer glow */
.tab-wrapper[data-state="needs-action"] {
  box-shadow: var(--shadow-glow-amber), var(--shadow-card);
}
.tab-wrapper[data-state="all-done"] {
  box-shadow: var(--shadow-glow-green), var(--shadow-card);
}
.tab-wrapper[data-state="in-progress"] {
  box-shadow: var(--shadow-card), 0 0 12px rgba(91, 141, 239, 0.15);
}

/* ── Tab Header (Glassmorphism) ── */
.tab-header {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.tab-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.tab-header:active {
  transform: scale(0.97);
}

/* State colours */
.tab-header[data-state="needs-action"] {
  background: var(--tab-needs-action);
  border-color: rgba(255, 170, 0, 0.4);
}
.tab-header[data-state="in-progress"] {
  background: linear-gradient(135deg, rgba(91, 141, 239, 0.10), rgba(108, 92, 231, 0.06));
  border-color: rgba(91, 141, 239, 0.3);
}
.tab-header[data-state="all-done"] {
  background: var(--tab-complete);
  border-color: rgba(0, 204, 136, 0.35);
}
.tab-header[data-state="not-yet-due"] {
  background: var(--glass-bg);
  border-color: rgba(255, 255, 255, 0.06);
  opacity: 0.6;
}

.tab-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.tab-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.tab-title {
  font-size: var(--text-lg);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}
/* Bold header when needs action + glow */
.tab-header[data-state="needs-action"] .tab-title {
  font-weight: 700;
  color: var(--warning);
  text-shadow: 0 0 8px rgba(255, 170, 0, 0.3);
}
/* Green title when done + glow */
.tab-header[data-state="all-done"] .tab-title {
  color: var(--success);
  text-shadow: 0 0 8px rgba(0, 204, 136, 0.3);
}

.tab-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Badge state coloring */
.tab-header[data-state="needs-action"] .tab-badge {
  background: rgba(255, 170, 0, 0.2);
  color: var(--warning);
  border-color: rgba(255, 170, 0, 0.3);
}
.tab-header[data-state="all-done"] .tab-badge {
  background: rgba(0, 204, 136, 0.2);
  color: var(--success);
  border-color: rgba(0, 204, 136, 0.3);
}
/* Badge pop animation on update */
.tab-badge.pop {
  transform: scale(1.25);
}

.tab-chevron {
  font-size: 0.65rem;
  color: var(--hint);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  opacity: 0.7;
}
.tab-wrapper.expanded .tab-chevron {
  transform: rotate(0deg);
}
.tab-wrapper.collapsed .tab-chevron {
  transform: rotate(-90deg);
}

/* ── Collapsed Preview ── */
.tab-preview {
  padding: 2px 16px 10px;
  font-size: var(--text-sm);
  color: var(--hint);
  line-height: 1.4;
}
.tab-preview.hidden { display: none; }

/* ── Tab Content (expandable) ── */
.tab-content {
  padding: 4px 12px 14px;
  /* height + opacity transitions controlled by JS for smooth expand/collapse */
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0 0 var(--radius) var(--radius);
}
.tab-content.hidden {
  display: none;
}

/* ── Tab Actions (inside expanded tab) ── */
.tab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.tab-actions .action-btn {
  font-size: var(--text-sm);
  padding: 10px 14px;
}

/* ── Dashboard Actions (global, below tabs) ── */
#dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Celebration Overlay ── */
.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn 0.3s ease;
}
.celebration-overlay.fade-out {
  animation: fadeOut 0.5s ease forwards;
}
.celebration-content {
  text-align: center;
  animation: celebPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.celebration-emoji {
  font-size: var(--text-hero);
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}
.celebration-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--success);
  text-shadow: 0 0 30px rgba(0, 204, 136, 0.6), 0 0 60px rgba(0, 204, 136, 0.2);
  letter-spacing: 0.5px;
}
.celebration-streak {
  font-size: var(--text-lg);
  margin-top: 10px;
  color: var(--fg);
  opacity: 0.9;
}
.celebration-msg {
  font-size: 0.9rem;
  color: var(--hint);
  margin-top: 6px;
  max-width: 280px;
}

@keyframes celebPop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ── Confetti Particles ── */
.confetti-particle {
  pointer-events: none;
  z-index: 9999;
}

/* ── Attention Ping Animation ──────────────────────── */
@keyframes attentionPingAmber {
  0%   { box-shadow: 0 0 0 0 rgba(255, 170, 0, 0.45); }
  50%  { box-shadow: 0 0 18px 4px rgba(255, 170, 0, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(255, 170, 0, 0); }
}
@keyframes attentionPingGreen {
  0%   { box-shadow: 0 0 0 0 rgba(0, 204, 136, 0.45); }
  50%  { box-shadow: 0 0 18px 4px rgba(0, 204, 136, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(0, 204, 136, 0); }
}
.tab-header.attention-amber {
  animation: attentionPingAmber 0.6s ease-out 3;
}
.tab-header.attention-green {
  animation: attentionPingGreen 0.6s ease-out 3;
}
