/* ==========================================================================
   Anchor HQ - Stardew Valley Themed Components
   Reusable pixel-aesthetic UI components
   ========================================================================== */

/* ─── Design Tokens ─── */
:root {
  /* Parchment & Paper */
  --parchment:        #f5e6c8;
  --parchment-dark:   #e8d4a8;
  --parchment-light:  #faf3e3;
  --parchment-shadow: rgba(139, 109, 56, 0.18);

  /* Wood & Earth */
  --wood:             #8b6914;
  --wood-light:       #b8943a;
  --wood-dark:        #5c4510;
  --wood-border:      #6b4f1a;
  --earth:            #4a3728;
  --earth-light:      #6b5344;

  /* Dark Panels */
  --panel-pixel:      #1a1520;
  --panel-pixel-soft: #231e2a;
  --panel-pixel-border: #3a2f48;

  /* Gold & XP */
  --gold:             #ffd700;
  --gold-soft:        #ffeaa7;
  --gold-dark:        #c8a800;
  --gold-bg:          rgba(255, 215, 0, 0.12);
  --gold-border:      rgba(255, 215, 0, 0.35);

  /* Pixel Colors */
  --pixel-green:      #5cb85c;
  --pixel-green-bg:   rgba(92, 184, 92, 0.14);
  --pixel-green-bdr:  rgba(92, 184, 92, 0.35);
  --pixel-red:        #d9534f;
  --pixel-red-bg:     rgba(217, 83, 79, 0.14);
  --pixel-red-bdr:    rgba(217, 83, 79, 0.35);
  --pixel-blue:       #5bc0de;
  --pixel-blue-bg:    rgba(91, 192, 222, 0.14);
  --pixel-blue-bdr:   rgba(91, 192, 222, 0.35);
  --pixel-yellow:     #f0ad4e;
  --pixel-yellow-bg:  rgba(240, 173, 78, 0.14);
  --pixel-yellow-bdr: rgba(240, 173, 78, 0.35);
  --pixel-orange:     #e87e04;

  /* Text */
  --text-pixel:       #3d2b1f;
  --text-pixel-muted: #7a6652;
  --text-pixel-light: #e8e0d4;

  /* Pixel Border Widths */
  --pixel-border:     3px;
  --pixel-border-sm:  2px;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  12px;
  --space-lg:  18px;
  --space-xl:  24px;

  /* Border Radius - kept small for pixel look */
  --radius-pixel:    4px;
  --radius-pixel-sm: 2px;
  --radius-pixel-lg: 6px;
}


/* ==========================================================================
   CARDS
   ========================================================================== */

.card {
  background: var(--parchment);
  border: var(--pixel-border) solid var(--wood-border);
  border-radius: var(--radius-pixel);
  padding: var(--space-lg);
  position: relative;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.35),
    inset -1px -1px 0 rgba(0, 0, 0, 0.08),
    2px 2px 0 rgba(0, 0, 0, 0.15);
  color: var(--text-pixel);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  image-rendering: pixelated;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--wood-light);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.35),
    inset -1px -1px 0 rgba(0, 0, 0, 0.08),
    2px 4px 0 rgba(0, 0, 0, 0.18),
    0 0 0 2px rgba(184, 148, 58, 0.2);
}

.card-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wood-dark);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: 'Press Start 2P', 'Courier New', monospace;
}

.card-title .icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  image-rendering: pixelated;
}

.card-dark {
  background: var(--panel-pixel);
  border-color: var(--panel-pixel-border);
  color: var(--text-pixel-light);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.05),
    inset -1px -1px 0 rgba(0, 0, 0, 0.2),
    2px 2px 0 rgba(0, 0, 0, 0.3);
}

.card-dark:hover {
  border-color: var(--gold-dark);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.05),
    inset -1px -1px 0 rgba(0, 0, 0, 0.2),
    2px 4px 0 rgba(0, 0, 0, 0.35),
    0 0 0 2px rgba(255, 215, 0, 0.12);
}

.card-dark .card-title {
  color: var(--gold-soft);
}


/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 8px 16px;
  border: var(--pixel-border-sm) solid;
  border-radius: var(--radius-pixel-sm);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: filter 120ms ease;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
  image-rendering: pixelated;
  /* 3D embossed base */
  border-top-color: rgba(255, 255, 255, 0.3);
  border-left-color: rgba(255, 255, 255, 0.2);
  border-bottom-color: rgba(0, 0, 0, 0.35);
  border-right-color: rgba(0, 0, 0, 0.25);
}

.btn:active {
  transform: translateY(2px);
  border-top-color: rgba(0, 0, 0, 0.2);
  border-left-color: rgba(0, 0, 0, 0.15);
  border-bottom-color: rgba(255, 255, 255, 0.15);
  border-right-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Primary - Golden/Orange */
.btn-primary {
  background: linear-gradient(180deg, #ffcc33 0%, #e6a800 100%);
  color: var(--earth);
  border-top-color: #ffe066;
  border-left-color: #ffd633;
  border-bottom-color: #996d00;
  border-right-color: #b38600;
  box-shadow: 0 2px 0 #8a6100;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-primary:active {
  background: linear-gradient(180deg, #e6a800 0%, #cc9600 100%);
  box-shadow: none;
}

/* Secondary - Wooden/Brown */
.btn-secondary {
  background: linear-gradient(180deg, #a07830 0%, #7a5a20 100%);
  color: var(--parchment-light);
  border-top-color: #b8943a;
  border-left-color: #a07830;
  border-bottom-color: #4a3518;
  border-right-color: #5c4510;
  box-shadow: 0 2px 0 #3d2d12;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.btn-secondary:hover {
  filter: brightness(1.1);
}

.btn-secondary:active {
  background: linear-gradient(180deg, #7a5a20 0%, #5c4510 100%);
  box-shadow: none;
}

/* Success - Green */
.btn-success {
  background: linear-gradient(180deg, #6bcf6b 0%, #4a9e4a 100%);
  color: #1a3a1a;
  border-top-color: #8bdf8b;
  border-left-color: #6bcf6b;
  border-bottom-color: #2d6b2d;
  border-right-color: #3a8a3a;
  box-shadow: 0 2px 0 #245a24;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-success:hover {
  filter: brightness(1.1);
}

.btn-success:active {
  background: linear-gradient(180deg, #4a9e4a 0%, #3a8a3a 100%);
  box-shadow: none;
}

/* Danger - Red */
.btn-danger {
  background: linear-gradient(180deg, #e05555 0%, #b83a3a 100%);
  color: #fff;
  border-top-color: #f07070;
  border-left-color: #e05555;
  border-bottom-color: #7a2020;
  border-right-color: #902a2a;
  box-shadow: 0 2px 0 #6b1a1a;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.btn-danger:hover {
  filter: brightness(1.1);
}

.btn-danger:active {
  background: linear-gradient(180deg, #b83a3a 0%, #902a2a 100%);
  box-shadow: none;
}

/* Ghost - Transparent with border */
.btn-ghost {
  background: transparent;
  color: var(--wood);
  border: var(--pixel-border-sm) solid var(--wood-border);
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(139, 105, 20, 0.08);
  color: var(--wood-dark);
}

.btn-ghost:active {
  background: rgba(139, 105, 20, 0.14);
  box-shadow: none;
}

/* Size Variants */
.btn-sm {
  padding: 4px 10px;
  font-size: 0.55rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.75rem;
}


/* ==========================================================================
   BADGES & TAGS
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.5rem;
  font-weight: 700;
  border: var(--pixel-border-sm) solid rgba(0, 0, 0, 0.12);
  line-height: 1.6;
  white-space: nowrap;
}

.badge-gold {
  background: var(--gold-bg);
  color: var(--gold-dark);
  border-color: var(--gold-border);
  text-shadow: 0 0 4px rgba(255, 215, 0, 0.3);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pixel-sm);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.5rem;
  font-weight: 700;
  border: var(--pixel-border-sm) solid;
  line-height: 1.6;
  white-space: nowrap;
}

/* Priority Tags - Wax seal style */
.tag-urgent {
  color: #fff;
  background: radial-gradient(ellipse at 35% 35%, #e05555, #a02020);
  border-color: #7a1818;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    1px 1px 0 rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  padding: 5px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag-normal {
  color: #3d2b1f;
  background: radial-gradient(ellipse at 35% 35%, #f0d060, #d4a820);
  border-color: #a08018;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    1px 1px 0 rgba(0, 0, 0, 0.15);
  border-radius: 50%;
  padding: 5px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag-low {
  color: #1a3a1a;
  background: radial-gradient(ellipse at 35% 35%, #6bcf6b, #3a8a3a);
  border-color: #2a6a2a;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    1px 1px 0 rgba(0, 0, 0, 0.15);
  border-radius: 50%;
  padding: 5px 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wood-dark);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--parchment-light);
  border: var(--pixel-border-sm) solid var(--wood-border);
  border-radius: var(--radius-pixel-sm);
  color: var(--text-pixel);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, 0.1),
    inset 0 0 0 1px rgba(0, 0, 0, 0.03);
}

.form-input:focus {
  border-color: var(--gold-dark);
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, 0.1),
    0 0 0 2px rgba(255, 215, 0, 0.25);
}

.form-input::placeholder {
  color: var(--text-pixel-muted);
  opacity: 0.6;
}

.form-textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--parchment-light);
  border: var(--pixel-border-sm) solid var(--wood-border);
  border-radius: var(--radius-pixel-sm);
  color: var(--text-pixel);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  min-height: 80px;
  resize: vertical;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, 0.1),
    inset 0 0 0 1px rgba(0, 0, 0, 0.03);
}

.form-textarea:focus {
  border-color: var(--gold-dark);
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, 0.1),
    0 0 0 2px rgba(255, 215, 0, 0.25);
}

.form-select {
  width: 100%;
  padding: 8px 32px 8px 12px;
  background: var(--parchment-light);
  border: var(--pixel-border-sm) solid var(--wood-border);
  border-radius: var(--radius-pixel-sm);
  color: var(--text-pixel);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, 0.1),
    inset 0 0 0 1px rgba(0, 0, 0, 0.03);
  /* Pixel-style down arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='%235c4510'%3E%3Cpath d='M0 0h2v2h2v2h2V2h2V0h2v2H8v2H6v2H4V4H2V2H0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.form-select:focus {
  border-color: var(--gold-dark);
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, 0.1),
    0 0 0 2px rgba(255, 215, 0, 0.25);
}

.form-select option {
  background: var(--parchment);
  color: var(--text-pixel);
}


/* ==========================================================================
   MODALS
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.7);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--parchment);
  border: var(--pixel-border) solid var(--wood);
  border-radius: var(--radius-pixel);
  width: 100%;
  max-width: 460px;
  position: relative;
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.25),
    inset -2px -2px 0 rgba(0, 0, 0, 0.15),
    0 0 0 3px var(--wood-dark),
    0 0 0 6px var(--wood-border),
    4px 8px 0 rgba(0, 0, 0, 0.3);
  color: var(--text-pixel);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: var(--pixel-border-sm) solid var(--wood-border);
  background: linear-gradient(180deg, var(--parchment-light), var(--parchment));
}

.modal-header h3 {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--wood-dark);
  margin: 0;
}

.modal-close {
  width: 24px;
  height: 24px;
  border: var(--pixel-border-sm) solid var(--wood-border);
  border-radius: var(--radius-pixel-sm);
  background: var(--parchment-dark);
  color: var(--wood-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.6rem;
  line-height: 1;
  transition: all 120ms ease;
  padding: 0;
}

.modal-close:hover {
  background: var(--pixel-red);
  color: #fff;
  border-color: #7a2020;
}

.modal-body {
  padding: var(--space-xl);
}

.modal-footer {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  padding: var(--space-lg) var(--space-xl);
  border-top: var(--pixel-border-sm) solid var(--wood-border);
  background: var(--parchment-dark);
}


/* ==========================================================================
   TOASTS / NOTIFICATIONS
   ========================================================================== */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  max-width: 360px;
}

.toast {
  pointer-events: auto;
  background: var(--parchment);
  border: var(--pixel-border) solid var(--wood-border);
  border-radius: var(--radius-pixel);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  color: var(--text-pixel);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.3),
    2px 3px 0 rgba(0, 0, 0, 0.2);
  animation: toastSlideIn 250ms ease forwards;
  font-size: 0.8rem;
  line-height: 1.4;
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.55rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.toast-dismiss {
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--text-pixel-muted);
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: color 120ms;
}

.toast-dismiss:hover {
  color: var(--pixel-red);
}

.toast-success {
  border-left: 4px solid var(--pixel-green);
}

.toast-success .toast-icon {
  color: var(--pixel-green);
}

.toast-warning {
  border-left: 4px solid var(--pixel-yellow);
}

.toast-warning .toast-icon {
  color: var(--pixel-yellow);
}

.toast-error {
  border-left: 4px solid var(--pixel-red);
}

.toast-error .toast-icon {
  color: var(--pixel-red);
}

.toast-info {
  border-left: 4px solid var(--pixel-blue);
}

.toast-info .toast-icon {
  color: var(--pixel-blue);
}


/* ==========================================================================
   TOOLTIPS
   ========================================================================== */

.tooltip {
  position: absolute;
  z-index: 1500;
  background: var(--parchment);
  border: var(--pixel-border) solid var(--wood);
  border-radius: var(--radius-pixel);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.78rem;
  color: var(--text-pixel);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.3),
    2px 3px 0 rgba(0, 0, 0, 0.2);
  max-width: 240px;
  line-height: 1.4;
  pointer-events: none;
  white-space: normal;
}

/* Speech-bubble pixel tail pointing down */
.tooltip::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--parchment);
  filter: drop-shadow(0 2px 0 var(--wood));
}

.tooltip::before {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--wood);
}

/* Tail pointing up */
.tooltip.tooltip-top::after {
  bottom: auto;
  top: -8px;
  border-top: none;
  border-bottom: 8px solid var(--parchment);
}

.tooltip.tooltip-top::before {
  bottom: auto;
  top: -12px;
  border-top: none;
  border-bottom: 10px solid var(--wood);
}


/* ==========================================================================
   PILL FILTERS
   ========================================================================== */

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-btn {
  padding: 5px 14px;
  border-radius: 999px;
  border: var(--pixel-border-sm) solid var(--wood-border);
  background: var(--parchment);
  color: var(--text-pixel-muted);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
}

.filter-btn:hover {
  background: var(--parchment-dark);
  color: var(--wood-dark);
  border-color: var(--wood);
}

.filter-btn.active {
  background: linear-gradient(180deg, #ffcc33, #e6a800);
  color: var(--earth);
  border-color: var(--gold-dark);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    1px 2px 0 rgba(0, 0, 0, 0.15);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}


/* ==========================================================================
   SEARCH
   ========================================================================== */

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--parchment-light);
  border: var(--pixel-border-sm) solid var(--wood-border);
  border-radius: 999px;
  color: var(--text-pixel);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  position: relative;
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, 0.08);
  background-image:
    linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 3%, transparent 6%),
    linear-gradient(90deg, transparent 94%, rgba(255, 255, 255, 0.15) 97%, transparent 100%);
}

.search-input:focus {
  border-color: var(--gold-dark);
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, 0.08),
    0 0 0 2px rgba(255, 215, 0, 0.2);
}

.search-input::placeholder {
  color: var(--text-pixel-muted);
  opacity: 0.5;
}

/* Magnifying glass icon wrapper */
.search-wrapper {
  position: relative;
  display: inline-flex;
  width: 100%;
}

.search-wrapper::before {
  content: '\1F50D';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 1;
  image-rendering: pixelated;
}


/* ==========================================================================
   AVATARS
   ========================================================================== */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pixel);
  border: var(--pixel-border-sm) solid var(--wood-border);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  flex-shrink: 0;
  image-rendering: pixelated;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, var(--pixel-blue), #3a8ab0);
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 0.4rem;
  border-width: 1px;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 0.7rem;
  border-width: 3px;
}

/* Color variations for name-hash assignment */
.avatar[data-color="red"]    { background: linear-gradient(135deg, #e05555, #a03030); }
.avatar[data-color="green"]  { background: linear-gradient(135deg, #5cb85c, #3a8a3a); }
.avatar[data-color="blue"]   { background: linear-gradient(135deg, #5bc0de, #3a8ab0); }
.avatar[data-color="purple"] { background: linear-gradient(135deg, #9b59b6, #6d3a80); }
.avatar[data-color="orange"] { background: linear-gradient(135deg, #e87e04, #b05e00); }
.avatar[data-color="teal"]   { background: linear-gradient(135deg, #1abc9c, #0e8c74); }
.avatar[data-color="pink"]   { background: linear-gradient(135deg, #e84393, #b03070); }
.avatar[data-color="gold"]   { background: linear-gradient(135deg, #f0c040, #c8a000); }


/* ==========================================================================
   STATUS INDICATORS
   ========================================================================== */

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.15);
  transition: all 250ms ease;
}

.status-dot.online {
  background: var(--pixel-green);
  box-shadow:
    0 0 0 3px var(--pixel-green-bg),
    0 0 8px rgba(92, 184, 92, 0.4);
  animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.idle {
  background: var(--pixel-yellow);
  box-shadow: 0 0 0 3px var(--pixel-yellow-bg);
}

.status-dot.offline {
  background: var(--pixel-red);
  box-shadow: 0 0 0 3px var(--pixel-red-bg);
}

@keyframes statusPulse {
  0%, 100% {
    box-shadow:
      0 0 0 3px var(--pixel-green-bg),
      0 0 8px rgba(92, 184, 92, 0.4);
  }
  50% {
    box-shadow:
      0 0 0 5px var(--pixel-green-bg),
      0 0 14px rgba(92, 184, 92, 0.6);
  }
}


/* ==========================================================================
   NOTIFICATION BELL & CENTER
   ========================================================================== */

.notification-bell {
  margin-left: auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pixel-sm);
  border: 1px solid var(--wood-border);
  background: transparent;
  cursor: pointer;
  position: relative;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: all 180ms ease;
}

.notification-bell:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: var(--gold-dark);
}

.notification-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  background: var(--pixel-red);
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  border: 1px solid #ff6060;
  padding: 0 3px;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
  image-rendering: pixelated;
  line-height: 1;
}

.notification-center {
  display: none;
  position: fixed;
  top: 10px;
  left: 250px;
  width: 320px;
  max-height: 400px;
  background: var(--parchment, #f5e6c8);
  border: var(--pixel-border, 3px) solid var(--wood, #8b6914);
  border-radius: var(--radius-pixel, 4px);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.3),
    inset -1px -1px 0 rgba(0, 0, 0, 0.1),
    4px 6px 0 rgba(0, 0, 0, 0.25);
  z-index: 9998;
  overflow: hidden;
  animation: commandBarIn 150ms ease;
}

.notification-center.open {
  display: block;
}

.notification-center-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 2px solid var(--wood-border, #6b4f1a);
  background: linear-gradient(180deg, var(--parchment-light, #faf3e3), var(--parchment, #f5e6c8));
}

.notification-clear-btn {
  background: none;
  border: 1px solid var(--wood-border, #6b4f1a);
  border-radius: var(--radius-pixel-sm);
  color: var(--text-pixel-muted, #7a6652);
  font-size: 0.68rem;
  cursor: pointer;
  padding: 2px 8px;
  transition: all 150ms;
}

.notification-clear-btn:hover {
  background: rgba(217, 83, 79, 0.1);
  color: var(--pixel-red);
  border-color: var(--pixel-red);
}

.notification-center-list {
  max-height: 340px;
  overflow-y: auto;
}

.notification-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-pixel-muted, #7a6652);
  font-size: 0.82rem;
  font-style: italic;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(107, 79, 26, 0.15);
  color: var(--text-pixel, #3d2b1f);
  font-size: 0.82rem;
  line-height: 1.4;
  transition: background 150ms;
}

.notification-item:hover {
  background: rgba(255, 215, 0, 0.06);
}

.notification-item:last-child {
  border-bottom: none;
}


/* ==========================================================================
   COMMAND BAR (Cmd+K Spotlight)
   ========================================================================== */

.command-bar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.command-bar-overlay.open {
  display: flex;
}

.command-bar {
  width: 560px;
  max-width: 90vw;
  background: var(--panel, #1e1914);
  border: 2px solid var(--wood, #6b4423);
  border-radius: var(--radius, 6px);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(218, 165, 32, 0.1),
    var(--shadow-glow);
  overflow: hidden;
  animation: commandBarIn 150ms ease;
}

@keyframes commandBarIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.command-bar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.command-bar-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.command-bar-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--font-body);
  caret-color: var(--gold);
}

.command-bar-input::placeholder {
  color: var(--muted);
}

.command-bar-kbd {
  font-family: var(--font-pixel);
  font-size: 0.42rem;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 3px 6px;
  flex-shrink: 0;
}

.command-bar-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 0;
}

.command-bar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 100ms;
  border-left: 2px solid transparent;
}

.command-bar-item:hover,
.command-bar-item.active {
  background: var(--gold-soft, rgba(218, 165, 32, 0.12));
  border-left-color: var(--gold);
}

.command-bar-item-icon {
  font-size: 0.9rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.command-bar-item-label {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}

.command-bar-item.active .command-bar-item-label {
  color: var(--gold-bright, #f0c040);
}

.command-bar-item-hint {
  font-size: 0.68rem;
  color: var(--muted);
  flex-shrink: 0;
}

.command-bar-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
}

/* ─── Sync Indicator ─── */
.sync-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text);
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: all 200ms ease;
  pointer-events: none;
}

.sync-indicator.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.sync-indicator.syncing {
  border-color: var(--yellow);
  background: rgba(240, 173, 78, 0.08);
}

.sync-indicator.synced {
  border-color: var(--green);
  background: rgba(92, 184, 92, 0.08);
}

.sync-indicator.offline {
  border-color: var(--yellow);
  background: rgba(240, 173, 78, 0.08);
}

.sync-indicator.error {
  border-color: var(--red);
  background: rgba(217, 83, 79, 0.08);
}

.sync-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.sync-text {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .sync-indicator {
    bottom: 15px;
    right: 15px;
    padding: 6px 10px;
    font-size: 0.7rem;
  }
  
  .sync-text {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
