/* ══════════════════════════════════════════════════
   filament-finder.css
   With full light / dark mode support via CSS variables
══════════════════════════════════════════════════ */

/* ── Theme tokens ── */
:root {
  --ff-bg-card:           #181818;
  --ff-border-card:       #2a2a2a;
  --ff-shadow-card:       0 10px 30px rgba(0,0,0,.6);
  --ff-color-heading:     #ff9c2f;
  --ff-color-sub:         #aaa;
  --ff-bg-controls:       #181818;
  --ff-border-controls:   #2a2a2a;
  --ff-bg-input:          #111;
  --ff-border-input:      #333;
  --ff-color-input:       #ccc;
  --ff-bg-pill:           #111;
  --ff-border-pill:       #333;
  --ff-color-pill:        #aaa;
  --ff-bg-pill-active:    #2a1500;
  --ff-color-pill-active: #ff9c2f;
  --ff-bg-results:        #181818;
  --ff-border-results:    #2a2a2a;
  --ff-color-prompt:      #555;
  --ff-color-prompt-str:  #777;
  --ff-color-count:       #666;
  --ff-bg-tile:           #111;
  --ff-border-tile:       #2a2a2a;
  --ff-color-tile-name:   #ccc;
  --ff-color-tile-brand:  #555;
  --ff-bg-tile-flag:      #0d0d0d;
  --ff-border-tile-inner: #1a1a1a;
  --ff-bg-divider:        #151515;
  --ff-border-divider:    #222;
  --ff-bg-rb-tile:        #111;
  --ff-border-rb-tile:    #2a2a2a;
  --ff-color-rb-name:     #888;
  --ff-bg-compare:        #181818;
  --ff-bg-cmp-item:       #111;
  --ff-border-cmp-item:   #333;
  --ff-color-cmp-name:    #ccc;
  --ff-color-cmp-hint:    #555;
  --ff-bg-cmp-clear:      #222;
  --ff-color-cmp-clear:   #888;
  --ff-border-cmp-clear:  #333;
  --ff-bg-modal:          #181818;
  --ff-border-modal:      #2a2a2a;
  --ff-bg-cmp-card:       #111;
  --ff-border-cmp-card:   #2a2a2a;
  --ff-color-cmp-name2:   #eee;
  --ff-color-cmp-brand:   #666;
  --ff-color-cmp-hex:     #aaa;
  --ff-bg-toast:          #222;
  --ff-color-toast:       #ff9c2f;
  --ff-bg-zoom:           #111;
  --ff-color-recent-title:#666;
  --ff-color-results-cnt: #666;
  --ff-color-page-btn:    #888;
  --ff-bg-page-btn:       #111;
  --ff-border-page-btn:   #333;
  --ff-bg-page-active:    #2a1500;
  --ff-bg-reset:          #111;
  --ff-border-reset:      #333;
  --ff-color-reset:       #666;
  --ff-border-flag-check: #554444;
  --ff-bg-flag-check:     #1a1010;
  --ff-color-flag-label:  #664444;
  --ff-bg-fav:            rgba(0,0,0,.65);
  --ff-color-fav:         #888;
  --ff-color-state:       #aaa;
}

body.light-mode {
  --ff-bg-card:           #ffffff;
  --ff-border-card:       #e8e8e8;
  --ff-shadow-card:       0 4px 16px rgba(0,0,0,.08);
  --ff-color-heading:     #e07000;
  --ff-color-sub:         #777;
  --ff-bg-controls:       #ffffff;
  --ff-border-controls:   #e8e8e8;
  --ff-bg-input:          #f5f5f5;
  --ff-border-input:      #ccc;
  --ff-color-input:       #333;
  --ff-bg-pill:           #f5f5f5;
  --ff-border-pill:       #ccc;
  --ff-color-pill:        #555;
  --ff-bg-pill-active:    #fff3e0;
  --ff-color-pill-active: #e07000;
  --ff-bg-results:        #ffffff;
  --ff-border-results:    #e8e8e8;
  --ff-color-prompt:      #aaa;
  --ff-color-prompt-str:  #888;
  --ff-color-count:       #999;
  --ff-bg-tile:           #fafafa;
  --ff-border-tile:       #e0e0e0;
  --ff-color-tile-name:   #333;
  --ff-color-tile-brand:  #888;
  --ff-bg-tile-flag:      #f5f5f5;
  --ff-border-tile-inner: #e8e8e8;
  --ff-bg-divider:        #efefef;
  --ff-border-divider:    #e0e0e0;
  --ff-bg-rb-tile:        #fafafa;
  --ff-border-rb-tile:    #e0e0e0;
  --ff-color-rb-name:     #888;
  --ff-bg-compare:        #ffffff;
  --ff-bg-cmp-item:       #f5f5f5;
  --ff-border-cmp-item:   #ddd;
  --ff-color-cmp-name:    #333;
  --ff-color-cmp-hint:    #999;
  --ff-bg-cmp-clear:      #eee;
  --ff-color-cmp-clear:   #666;
  --ff-border-cmp-clear:  #ccc;
  --ff-bg-modal:          #ffffff;
  --ff-border-modal:      #e8e8e8;
  --ff-bg-cmp-card:       #f5f5f5;
  --ff-border-cmp-card:   #e0e0e0;
  --ff-color-cmp-name2:   #111;
  --ff-color-cmp-brand:   #888;
  --ff-color-cmp-hex:     #666;
  --ff-bg-toast:          #fff3e0;
  --ff-color-toast:       #e07000;
  --ff-bg-zoom:           #fafafa;
  --ff-color-recent-title:#999;
  --ff-color-results-cnt: #999;
  --ff-color-page-btn:    #666;
  --ff-bg-page-btn:       #f5f5f5;
  --ff-border-page-btn:   #ccc;
  --ff-bg-page-active:    #fff3e0;
  --ff-bg-reset:          #f5f5f5;
  --ff-border-reset:      #ccc;
  --ff-color-reset:       #888;
  --ff-border-flag-check: #ccc;
  --ff-bg-flag-check:     #f0f0f0;
  --ff-color-flag-label:  #aaa;
  --ff-bg-fav:            rgba(255,255,255,.8);
  --ff-color-fav:         #aaa;
  --ff-color-state:       #888;
}

/* ── Layout ── */
.hero {
  text-align: center;
  padding: 40px 20px 30px;
  margin-bottom: 16px;
  background: var(--ff-bg-card);
  border: 1px solid var(--ff-border-card);
  border-radius: 10px;
  box-shadow: var(--ff-shadow-card);
  transition: background .25s, border-color .25s, box-shadow .25s;
}
.hero h1 { font-size: 36px; font-weight: 700; color: var(--ff-color-heading); margin: 0 0 8px; }
.hero p  { color: var(--ff-color-sub); font-size: 13px; margin: 0; }

.stats-box {
  background: var(--ff-bg-card);
  border: 1px solid var(--ff-border-card);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: var(--ff-shadow-card);
  display: flex;
  justify-content: center;
  gap: 60px;
  transition: background .25s, border-color .25s;
}
.stats-number { font-size: 34px; font-weight: 700; color: var(--ff-color-heading); }
.stats-label  { color: var(--ff-color-sub); font-size: 11px; text-transform: uppercase; margin-top: 3px; }

/* ── Controls bar ── */
.controls-bar {
  background: var(--ff-bg-controls);
  border: 1px solid var(--ff-border-controls);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  transition: background .25s, border-color .25s;
}
.controls-bar input[type=text] { flex: 1; min-width: 160px; }
.controls-bar select { min-width: 160px; }
.ctrl-group { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.size-value { font-size: 11px; color: var(--ff-color-sub); min-width: 28px; text-align: right; }

.btn-reset {
  padding: 7px 12px;
  background: var(--ff-bg-reset);
  border: 1px solid var(--ff-border-reset);
  color: var(--ff-color-reset);
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: border-color .15s, color .15s, background .25s;
  white-space: nowrap;
}
.btn-reset:hover { border-color: #ff8c00; color: #ff9c2f; }

/* ── Colour family pills ── */
.colour-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.cpill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--ff-border-pill);
  background: var(--ff-bg-pill);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--ff-color-pill);
  transition: border-color .15s, color .15s, background .15s;
  user-select: none;
}
.cpill:hover { border-color: #ff8c00; color: var(--ff-color-tile-name); }
.cpill.active { border-color: #ff8c00; background: var(--ff-bg-pill-active); color: var(--ff-color-pill-active); }
.cpill .cswatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgba(128,128,128,.3); }

/* ── Sort + view controls ── */
.sort-select {
  padding: 7px 10px;
  background: var(--ff-bg-input);
  border: 1px solid var(--ff-border-input);
  color: var(--ff-color-input);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: background .25s, color .25s, border-color .25s;
}
.view-btns { display: flex; gap: 4px; }
.view-btn {
  padding: 7px 10px;
  background: var(--ff-bg-input);
  border: 1px solid var(--ff-border-input);
  color: var(--ff-color-reset);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
  line-height: 1;
}
.view-btn.active { border-color: #ff8c00; color: #ff9c2f; background: var(--ff-bg-pill-active); }
.size-slider { width: 80px; accent-color: #ff8c00; cursor: pointer; }

/* ── Results header ── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.results-count { font-size: 12px; color: var(--ff-color-results-cnt); }
.pagination { display: flex; gap: 6px; align-items: center; }
.page-btn {
  padding: 5px 11px;
  background: var(--ff-bg-page-btn);
  border: 1px solid var(--ff-border-page-btn);
  color: var(--ff-color-page-btn);
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  transition: all .15s;
}
.page-btn:hover  { border-color: #ff8c00; color: #ff9c2f; }
.page-btn.active { border-color: #ff8c00; background: var(--ff-bg-page-active); color: #ff9c2f; font-weight: 700; }
.page-btn:disabled { opacity: .3; cursor: default; pointer-events: none; }

/* ── Results grid ── */
.state-box { padding: 60px; text-align: center; color: var(--ff-color-state); font-size: 13px; }
#resultsGrid {
  background: var(--ff-bg-results);
  border: 1px solid var(--ff-border-results);
  border-radius: 10px;
  box-shadow: var(--ff-shadow-card);
  min-height: 180px;
  padding: 16px;
  transition: background .25s, border-color .25s;
}
.select-prompt { padding: 60px 20px; text-align: center; color: var(--ff-color-prompt); font-size: 14px; }
.select-prompt .prompt-icon { font-size: 40px; display: block; margin-bottom: 12px; opacity: .4; }
.select-prompt strong { color: var(--ff-color-prompt-str); display: block; font-size: 16px; margin-bottom: 5px; }

/* Grid view */
.tilesWrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile-size,130px), 1fr)); gap: 14px; }

/* List view */
.tilesWrap.list-view { display: flex; flex-direction: column; gap: 8px; }
.tilesWrap.list-view .filamentTile { flex-direction: row; height: 60px; }
.tilesWrap.list-view .tileTopLink  { flex-direction: row; align-items: center; gap: 12px; padding: 0 10px; }
.tilesWrap.list-view .tileThumb,
.tilesWrap.list-view .tileThumbColor { width: 44px; height: 44px; aspect-ratio: 1/1; border-radius: 6px; flex-shrink: 0; }
.tilesWrap.list-view .tileName  { font-size: 12px; text-align: left; padding: 0; flex: 1; }
.tilesWrap.list-view .tileBrand { font-size: 11px; text-align: left; padding: 0; min-width: 80px; }
.tilesWrap.list-view .tileAmazon {
  width: 90px; flex-shrink: 0;
  border-top: none;
  border-left: 1px solid var(--ff-border-tile-inner);
  height: 100%; justify-content: center;
}
.tilesWrap.list-view .tileFlag {
  width: 90px; flex-shrink: 0;
  border-top: none;
  border-left: 1px solid var(--ff-border-tile-inner);
  height: 100%; justify-content: center;
  flex-direction: column; gap: 3px;
}

/* ── Tile ── */
.filamentTile {
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--ff-border-tile);
  background: var(--ff-bg-tile);
  transition: border-color .15s, transform .15s, background .25s;
  display: flex;
  flex-direction: column;
  position: relative;
}
.filamentTile:hover { border-color: #ff8c00; transform: translateY(-2px); }
.tileTopLink  { display: flex; flex-direction: column; flex: 1; text-decoration: none; color: inherit; }
.tileThumb    { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.tileThumbColor { width: 100%; aspect-ratio: 1/1; display: block; }
.tileName  { font-size: 10px; color: var(--ff-color-tile-name); text-align: center; padding: 5px 6px 2px; line-height: 1.3; word-break: break-word; }
.tileBrand { font-size: 9px; color: var(--ff-color-tile-brand); text-align: center; padding: 0 6px 4px; }

/* ── Hover zoom overlay ── */
.tile-zoom {
  position: fixed; z-index: 999; pointer-events: none;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.8);
  border: 2px solid #ff8c00;
  width: 220px; height: 220px;
  opacity: 0; transition: opacity .15s;
  background: var(--ff-bg-zoom);
}
.tile-zoom img      { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-zoom .zoom-color { width: 100%; height: 100%; }
.tile-zoom.visible  { opacity: 1; }

/* ── Amazon button ── */
.tileAmazon {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 8px 6px 10px;
  background: #ff9900;
  border-top: 1px solid var(--ff-border-tile-inner);
  text-decoration: none;
  transition: background .12s;
  flex-shrink: 0;
}
.tileAmazon:hover { background: #e68800; }
.tileAmazon .amz-label  { font-size: 9px; font-weight: 700; font-family: Arial,sans-serif; color: #111; letter-spacing: .2px; line-height: 1; }
.tileAmazon .amz-swoosh {
  display: inline-block; width: 30px; height: 9px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 28'%3E%3Cpath d='M55.3 20.8c-7.5 5.5-18.3 8.5-27.7 8.5C14.5 29.3 2.7 24.4-6.2 16.4c-.7-.6-.1-1.4.8-1 9.6 5.6 21.5 8.9 33.8 8.9 8.3 0 17.4-1.7 25.8-5.3 1.2-.6 2.3.8 1.1 1.8z' fill='%23111'/%3E%3Cpath d='M58.4 17.3c-.9-1.2-6.2-.6-8.6-.3-.7.1-.8-.5-.2-.9 4.2-3 11.1-2.1 11.9-1.1.8 1-.2 7.9-4.1 11.2-.6.5-1.2.2-.9-.4.9-2.2 2.8-7.3 1.9-8.5z' fill='%23111'/%3E%3C/svg%3E") center/contain no-repeat;
  flex-shrink: 0; position: relative; top: 1px;
}

/* ── Tile divider ── */
.tile-divider {
  height: 6px;
  background: var(--ff-bg-divider);
  border-top: 1px solid var(--ff-border-divider);
  border-bottom: 1px solid var(--ff-border-divider);
  flex-shrink: 0;
  transition: background .25s, border-color .25s;
}

/* ── Fav button ── */
.tileFav {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px;
  background: var(--ff-bg-fav);
  border: 1px solid #555;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1;
  color: var(--ff-color-fav);
  transition: background .15s, border-color .15s, color .15s, transform .15s;
  z-index: 3;
  text-decoration: none;
}
.tileFav:hover { background: var(--ff-bg-fav); border-color: #ff3366; color: #ff3366; transform: scale(1.15); }
.tileFav.faved { border-color: #ff3366; background: rgba(200,0,60,.25); color: #ff3366; }

.tilesWrap.list-view .tileFav {
  top: 50%; right: auto; left: 26px;
  transform: translateY(-50%);
  width: 22px; height: 22px; font-size: 12px;
}
.tilesWrap.list-view .tileFav:hover { transform: translateY(-50%) scale(1.15); }

/* ── Wrong colour flag ── */
.tileFlag {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 6px;
  background: var(--ff-bg-tile-flag);
  border-top: none;
  cursor: pointer;
  transition: background .12s;
  flex-shrink: 0;
  text-decoration: none;
}
.tileFlag:hover { background: var(--ff-bg-input); }
.tileFlag:hover .flag-label { color: #ff4c4c; }
.flag-check {
  width: 11px; height: 11px;
  border: 1px solid var(--ff-border-flag-check);
  border-radius: 2px;
  background: var(--ff-bg-flag-check);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .12s, background .12s;
}
.tileFlag:hover .flag-check { border-color: #ff4c4c; background: #2a0808; }
.flag-check svg { display: none; width: 7px; height: 7px; }
.tileFlag.flagged .flag-check { border-color: #ff4c4c; background: #ff4c4c; }
.tileFlag.flagged .flag-check svg { display: block; }
.flag-label { font-size: 9px; font-weight: 600; color: var(--ff-color-flag-label); white-space: nowrap; transition: color .12s; }

/* ── Recently viewed bar ── */
#recentBar { margin-bottom: 16px; display: none; }
#recentBar .rb-title { font-size: 11px; color: var(--ff-color-recent-title); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }
.rb-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; scrollbar-color: var(--ff-border-input) transparent; }
.rb-tile {
  flex-shrink: 0; width: 52px; cursor: pointer;
  border-radius: 7px; overflow: hidden;
  border: 1px solid var(--ff-border-rb-tile);
  background: var(--ff-bg-rb-tile);
  text-decoration: none;
  transition: border-color .15s, background .25s;
}
.rb-tile:hover { border-color: #ff8c00; }
.rb-tile img, .rb-tile .rb-color { width: 52px; height: 52px; object-fit: cover; display: block; }
.rb-tile .rb-name { font-size: 8px; color: var(--ff-color-rb-name); text-align: center; padding: 3px 2px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Compare tray ── */
#compareTray {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--ff-bg-compare);
  border-top: 2px solid #ff8c00;
  padding: 10px 20px;
  z-index: 500;
  display: none; align-items: center; gap: 12px; flex-wrap: wrap;
  transition: background .25s;
}
.cmp-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--ff-bg-cmp-item);
  border: 1px solid var(--ff-border-cmp-item);
  border-radius: 8px; padding: 6px 10px;
  transition: background .25s, border-color .25s;
}
.cmp-swatch  { width: 28px; height: 28px; border-radius: 5px; border: 1px solid #444; flex-shrink: 0; }
.cmp-name    { font-size: 11px; color: var(--ff-color-cmp-name); max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-remove  { cursor: pointer; color: var(--ff-color-cmp-hint); font-size: 14px; line-height: 1; margin-left: 4px; transition: color .12s; }
.cmp-remove:hover { color: #ff4c4c; }
.cmp-actions { margin-left: auto; display: flex; gap: 8px; }
.btn-cmp     { padding: 7px 14px; border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; border: none; transition: background .15s; }
.btn-cmp-go  { background: #ff8c00; color: #000; }
.btn-cmp-go:hover { background: #e67e00; }
.btn-cmp-clear {
  background: var(--ff-bg-cmp-clear);
  color: var(--ff-color-cmp-clear);
  border: 1px solid var(--ff-border-cmp-clear) !important;
  transition: background .25s, color .25s;
}
.btn-cmp-clear:hover { color: var(--ff-color-tile-name); }
.cmp-hint { font-size: 11px; color: var(--ff-color-cmp-hint); flex: 1; }

/* ── Compare modal ── */
.cmp-modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; display: none;
}
.cmp-modal {
  background: var(--ff-bg-modal);
  border: 1px solid var(--ff-border-modal);
  border-radius: 14px; padding: 28px;
  max-width: 900px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.8);
  transition: background .25s, border-color .25s;
}
.cmp-modal h2    { color: var(--ff-color-heading); font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.cmp-grid        { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 16px; }
.cmp-card {
  background: var(--ff-bg-cmp-card);
  border: 1px solid var(--ff-border-cmp-card);
  border-radius: 10px; overflow: hidden; text-align: center;
  transition: background .25s, border-color .25s;
}
.cmp-card img,
.cmp-card .cmp-card-color { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.cmp-card-body   { padding: 12px; }
.cmp-card-name   { font-size: 13px; font-weight: 700; color: var(--ff-color-cmp-name2); margin-bottom: 4px; }
.cmp-card-brand  { font-size: 11px; color: var(--ff-color-cmp-brand); margin-bottom: 8px; }
.cmp-card-hex    { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ff-color-cmp-hex); margin-bottom: 10px; }
.cmp-card-hex .ch-dot { width: 14px; height: 14px; border-radius: 3px; border: 1px solid #444; }
.cmp-card .btn-amz { display: block; padding: 6px; background: #ff9900; color: #000; font-size: 10px; font-weight: 700; text-decoration: none; border-radius: 6px; text-align: center; margin-top: 6px; }
.cmp-close       { float: right; background: none; border: none; color: var(--ff-color-cmp-brand); font-size: 22px; cursor: pointer; line-height: 1; }
.cmp-close:hover { color: var(--ff-color-tile-name); }

/* ── Toast notification ── */
.ff-toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ff-bg-toast);
  border: 1px solid #ff8c00;
  color: var(--ff-color-toast);
  padding: 10px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  z-index: 999; opacity: 0;
  transition: opacity .2s, transform .2s, background .25s, color .25s;
  pointer-events: none; white-space: nowrap;
}
.ff-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ══════════════════════════════════════════════════
   Styles extracted from filament-finder.php
   All colours converted to CSS variables
══════════════════════════════════════════════════ */

/* Additional dark/light tokens for extracted styles */
:root {
  --ff-bg-favs-btn:        #2a2a2a;
  --ff-border-favs-btn:    #555;
  --ff-color-favs-btn:     #ccc;
  --ff-bg-favs-active:     #5a1a2a;
  --ff-border-favs-active: #c0446a;
  --ff-color-favs-active:  #f4a0bc;
  --ff-bg-eyedropper:      #2a1a08;
  --ff-border-eyedropper:  #a05a10;
  --ff-color-eyedropper:   #ff9c2f;
  --ff-bg-drawer:          #0f111a;
  --ff-border-drawer:      #2a2f3e;
  --ff-border-drawer-inner:#1e2230;
  --ff-color-drawer-title: #e8edf5;
  --ff-color-drawer-sub:   #7a8499;
  --ff-bg-result-thumb:    #111520;
  --ff-border-result-thumb:#1e2230;
  --ff-color-result-title: #c8d3e0;
  --ff-color-result-price: #fff;
  --ff-bg-skel:            #1a1f2a;
  --ff-bg-skel-shine:      #222840;
  --ff-border-result-row:  #1a1f2a;
  --ff-color-tile-fav:     #666;
}

body.light-mode {
  --ff-bg-favs-btn:        #f0f0f0;
  --ff-border-favs-btn:    #bbb;
  --ff-color-favs-btn:     #555;
  --ff-bg-favs-active:     #ffeef3;
  --ff-border-favs-active: #e07090;
  --ff-color-favs-active:  #c0304a;
  --ff-bg-eyedropper:      #fff8f0;
  --ff-border-eyedropper:  #e0a060;
  --ff-color-eyedropper:   #c06010;
  --ff-bg-drawer:          #ffffff;
  --ff-border-drawer:      #e0e0e0;
  --ff-border-drawer-inner:#eeeeee;
  --ff-color-drawer-title: #111;
  --ff-color-drawer-sub:   #888;
  --ff-bg-result-thumb:    #f5f5f5;
  --ff-border-result-thumb:#e0e0e0;
  --ff-color-result-title: #333;
  --ff-color-result-price: #111;
  --ff-bg-skel:            #e8e8e8;
  --ff-bg-skel-shine:      #f0f0f0;
  --ff-border-result-row:  #eeeeee;
  --ff-color-tile-fav:     #aaa;
}

/* ── Tile actions ── */
.tile-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 3px;
}
.tile-actions .fav-row { display: flex; justify-content: center; }
.tile-actions .amz-row,
.tile-actions .flag-row { display: flex; justify-content: center; }
.tile-actions .amz-row .tileAmazon { width: 100%; }
.tile-actions .flag-row .tileFlag  { width: 100%; justify-content: center; }

/* Fav button */
.tileFav {
  position: static !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: none;
  border: none;
  padding: 2px 8px;
  cursor: pointer;
  color: var(--ff-color-tile-fav);
  transition: color .15s, transform .15s;
  line-height: 1;
}
.tileFav:hover { color: #e05080; transform: scale(1.1); }
.tileFav.faved { color: #e03060; }
.tileFav svg   { display: block; width: 16px; height: 16px; flex-shrink: 0; }
.tileFav .fav-label {
  font-size: 7px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* List view: flatten tile actions */
.list-view .tile-actions { flex-direction: row; align-items: center; gap: 6px; }
.list-view .fav-row,
.list-view .amz-row,
.list-view .flag-row { display: contents; }
.list-view .amz-row .tileAmazon { width: auto; flex: 0 0 auto; }
.list-view .flag-row .tileFlag  { width: auto; justify-content: flex-start; }
.list-view .tileFav { padding: 0 4px; }

/* ── Favourites-only toggle ── */
.btn-favs-only {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  height: 38px;
  border: 1px solid var(--ff-border-favs-btn);
  border-radius: 6px;
  background: var(--ff-bg-favs-btn);
  color: var(--ff-color-favs-btn);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-favs-only:hover {
  filter: brightness(1.1);
  border-color: #999;
}
.btn-favs-only.active {
  background: var(--ff-bg-favs-active);
  border-color: var(--ff-border-favs-active);
  color: var(--ff-color-favs-active);
}

/* ── Filament type badge ── */
.tileType {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 10px;
  margin-top: 3px;
  background: rgba(255,140,0,.15);
  border: 1px solid rgba(255,140,0,.3);
  color: #ff9c2f;
  line-height: 1.4;
}
.list-view .tileType { margin-top: 0; margin-left: 4px; }

/* ── Search + eyedropper ── */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.search-wrap #searchInput { flex: 1; min-width: 160px; }

.btn-eyedropper {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  height: 38px;
  border: 1px solid var(--ff-border-eyedropper);
  border-radius: 6px;
  background: var(--ff-bg-eyedropper);
  color: var(--ff-color-eyedropper);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-eyedropper:hover {
  filter: brightness(1.15);
  border-color: var(--ff-color-eyedropper);
}
.btn-eyedropper svg { flex-shrink: 0; }

/* ── Eyedropper result pill ── */
.eyedropper-result {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--ff-bg-eyedropper);
  border: 1px solid var(--ff-border-eyedropper);
  border-radius: 20px;
  padding: 3px 10px 3px 6px;
  font-size: 12px;
  color: var(--ff-color-eyedropper);
  animation: edFadeIn .2s ease;
  transition: background .25s, border-color .25s;
}
@keyframes edFadeIn { from{opacity:0;transform:scale(.9)} to{opacity:1;transform:scale(1)} }
.ed-swatch {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(128,128,128,.25);
  display: inline-block;
  flex-shrink: 0;
}
.ed-hex   { font-family: monospace; letter-spacing: .04em; }
.ed-clear {
  background: none; border: none;
  color: var(--ff-border-eyedropper);
  cursor: pointer; font-size: 13px; line-height: 1; padding: 0 0 0 4px;
}
.ed-clear:hover { color: var(--ff-color-eyedropper); }

/* ── Amazon Price Drawer ── */
.amz-drawer-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  display: none;
}
.amz-drawer-bg.open { opacity: 1; pointer-events: all; display: block; }

.amz-drawer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--ff-bg-drawer);
  border-top: 1px solid var(--ff-border-drawer);
  border-radius: 18px 18px 0 0;
  padding: 0 0 env(safe-area-inset-bottom,0);
  z-index: 1001; max-height: 82vh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1), background .25s;
  box-shadow: 0 -20px 60px rgba(0,0,0,.4);
  overflow: hidden;
  visibility: hidden;
}
.amz-drawer.open { transform: translateY(0); visibility: visible; }

.amz-drawer-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--ff-border-drawer);
  margin: 12px auto 0; flex-shrink: 0; cursor: pointer;
  transition: background .25s;
}
.amz-drawer-head {
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--ff-border-drawer-inner);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.amz-drawer-swatch {
  width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
  border: 1px solid rgba(128,128,128,.2); overflow: hidden;
}
.amz-drawer-swatch img           { width: 100%; height: 100%; object-fit: cover; }
.amz-drawer-swatch-color         { width: 100%; height: 100%; }
.amz-drawer-title                { flex: 1; min-width: 0; }
.amz-drawer-title strong {
  font-size: 15px; color: var(--ff-color-drawer-title); display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .25s;
}
.amz-drawer-title span { font-size: 12px; color: var(--ff-color-drawer-sub); transition: color .25s; }
.amz-drawer-close {
  background: none;
  border: 1px solid var(--ff-border-drawer);
  color: var(--ff-color-drawer-sub);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: border-color .15s, color .15s;
}
.amz-drawer-close:hover { border-color: #ff6b2b; color: #ff6b2b; }

/* Sort pills inside drawer */
.amz-drawer-sort {
  display: flex; gap: 6px; padding: 10px 20px 8px; flex-shrink: 0;
  border-bottom: 1px solid var(--ff-border-drawer-inner);
  flex-wrap: wrap; align-items: center;
}
.amz-drawer-sort-label { font-size: 11px; color: var(--ff-color-drawer-sub); margin-right: 2px; }
.amz-dpill {
  padding: 4px 12px; border-radius: 14px;
  border: 1px solid var(--ff-border-drawer);
  background: transparent;
  color: var(--ff-color-drawer-sub);
  font-size: 11px; cursor: pointer; transition: .15s; font-family: inherit;
}
.amz-dpill:hover  { border-color: rgba(255,107,43,.4); color: var(--ff-color-drawer-title); }
.amz-dpill.active { background: rgba(255,107,43,.12); border-color: rgba(255,107,43,.4); color: #ff6b2b; }

/* Scrollable results area */
.amz-drawer-body { overflow-y: auto; padding: 14px 20px 20px; flex: 1; }

/* Result rows */
.amz-result-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--ff-border-result-row);
  text-decoration: none; color: inherit;
  transition: background .15s; border-radius: 8px;
  margin: 0 -8px; padding-left: 8px; padding-right: 8px;
}
.amz-result-row:hover         { background: rgba(128,128,128,.05); }
.amz-result-row:last-child    { border-bottom: none; }
.amz-result-thumb {
  width: 72px; height: 72px; border-radius: 8px; object-fit: contain;
  background: var(--ff-bg-result-thumb);
  flex-shrink: 0; padding: 4px;
  border: 1px solid var(--ff-border-result-thumb);
}
.amz-result-thumb-placeholder {
  width: 72px; height: 72px; border-radius: 8px;
  background: var(--ff-bg-result-thumb);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  border: 1px solid var(--ff-border-result-thumb);
}
.amz-result-info  { flex: 1; min-width: 0; }
.amz-result-title {
  font-size: 13px; color: var(--ff-color-result-title); line-height: 1.4; margin-bottom: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color .25s;
}
.amz-result-meta    { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.amz-result-price   { font-size: 17px; font-weight: 700; color: var(--ff-color-result-price); font-family: 'DM Mono',monospace; transition: color .25s; }
.amz-result-unit    { font-size: 10px; color: var(--ff-color-drawer-sub); }
.amz-result-stars   { font-size: 11px; color: #f5c518; letter-spacing: 1px; }
.amz-result-reviews { font-size: 11px; color: var(--ff-color-drawer-sub); }
.amz-result-prime   { font-size: 10px; font-weight: 700; color: #00a8e8; }
.amz-result-badge {
  font-size: 9px; padding: 2px 6px; border-radius: 4px;
  background: rgba(46,204,113,.15); border: 1px solid rgba(46,204,113,.3);
  color: #2ecc71; font-family: 'DM Mono',monospace; text-transform: uppercase;
}
.amz-result-cta {
  display: inline-block; margin-top: 6px; padding: 5px 12px;
  background: #FF9900; color: #000; border-radius: 6px;
  font-size: 11px; font-weight: 700; text-decoration: none;
  transition: background .15s; flex-shrink: 0;
}
.amz-result-cta:hover { background: #e68a00; }

/* Skeleton rows */
.amz-row-skel {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--ff-border-result-row);
}
.amz-row-skel-img {
  width: 72px; height: 72px; border-radius: 8px;
  background: linear-gradient(90deg, var(--ff-bg-skel) 25%, var(--ff-bg-skel-shine) 50%, var(--ff-bg-skel) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite; flex-shrink: 0;
}
.amz-row-skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.amz-row-skel-line {
  height: 11px; border-radius: 4px;
  background: linear-gradient(90deg, var(--ff-bg-skel) 25%, var(--ff-bg-skel-shine) 50%, var(--ff-bg-skel) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.amz-row-skel-line.w80 { width: 80%; }
.amz-row-skel-line.w50 { width: 50%; }
.amz-row-skel-line.w35 { width: 35%; }

/* Empty / error */
.amz-drawer-empty      { text-align: center; padding: 40px 20px; color: var(--ff-color-drawer-sub); }
.amz-drawer-empty-icon { font-size: 36px; margin-bottom: 10px; opacity: .5; }

@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
