/* MobiArabia — phone finder (filters) and compare tool. Loaded after site.css. */

/* ── finder ─────────────────────────────────────────── */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.list-head .page-title { margin-bottom: 12px; }
.list-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.btn-ghost { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; transition: border-color .15s, color .15s; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost .ic { width: 18px; height: 18px; }
.filter-toggle { display: none; }
.fcount { background: var(--accent); color: #fff; border-radius: 999px; font-size: .75rem; min-width: 20px; height: 20px;
  display: inline-grid; place-items: center; padding: 0 6px; }
.fcount[hidden] { display: none; }
.sort-box { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.sort-box select, .f-range input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 10px; }
.finder { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; align-items: start; }
.filters { position: sticky; top: 86px; max-height: calc(100vh - 100px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 16px 20px; box-shadow: var(--shadow-sm); scrollbar-width: thin; }
.f-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: .85rem; padding: 0; }
.filters fieldset { border: 0; border-top: 1px solid var(--line); padding: 12px 0 4px; margin: 0; min-width: 0; }
.filters legend { font-weight: 600; font-size: .88rem; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
[dir="rtl"] .filters legend { float: right; }
.f-chips, .f-seg { display: flex; flex-wrap: wrap; gap: 6px; clear: both; }
.f-chip, .f-seg label { position: relative; }
.f-chip input, .f-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.f-chip span, .f-seg span, .f-preset { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: .84rem;
  cursor: pointer; background: var(--surface); transition: all .12s; color: var(--text); font-family: inherit; line-height: 1.5; }
.f-chip input:checked + span, .f-seg input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.f-chip span:hover, .f-seg span:hover, .f-preset:hover { border-color: var(--accent); }
.f-chip input:focus-visible + span, .f-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.f-range { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; clear: both; }
.f-range input { width: 100%; min-width: 0; }
.f-check { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .9rem; cursor: pointer; clear: both; }
.f-check input { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.f-done { display: none; width: 100%; margin-top: 14px; }
.empty-note { text-align: center; color: var(--muted); padding: 40px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.finder .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* ── compare ────────────────────────────────────────── */
.vs { color: var(--muted); font-weight: 500; font-size: .7em; margin: 0 .2em; }
.cmp-slots { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 14px; margin: 6px 0 18px; }
.cmp-slot { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; box-shadow: var(--shadow-sm); min-width: 0; }
.cmp-slot.add { border-style: dashed; justify-content: center; color: var(--muted); }
.cmp-add-ic { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 1.6rem; }
.cmp-img { width: 100%; height: 170px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.cmp-img img, .cmp-img svg { max-width: 100%; max-height: 100%; object-fit: contain; }
.cmp-name { font-weight: 700; line-height: 1.35; }
.cmp-price { color: var(--accent); font-weight: 700; font-size: .92rem; }
.cmp-x { position: absolute; top: 8px; inset-inline-end: 8px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--muted); }
.cmp-x:hover { color: var(--bad); border-color: var(--bad); }
.cmp-search { width: 100%; max-width: 100%; margin: 6px 0 0; flex: none; }
.cmp-search input { padding-inline: 14px; }
.cmp-search .search-results { text-align: start; }
.cmp-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.cmp-table-wrap:empty { display: none; }
.cmp-table { width: 100%; border-collapse: collapse; }
.cmp-table th, .cmp-table td { text-align: start; padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; font-size: .93rem; }
.cmp-table tr:first-child > th { border-top: 0; }
.cmp-table tbody tr > th { color: var(--muted); font-weight: 500; width: 22%; }
.cmp-table td { overflow-wrap: anywhere; }
.cmp-table .cmp-sec th { background: var(--surface-2); color: var(--accent); font-weight: 700; font-size: .9rem; width: auto; }
.cmp-table td.win-cell { background: color-mix(in srgb, var(--good) 10%, transparent); font-weight: 700; }
.win .ic { width: 16px; height: 16px; color: var(--good); stroke-width: 2.6; vertical-align: -3px; }
.cmp-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.pair-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pair { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 14px; transition: border-color .15s; }
.pair:hover { border-color: var(--accent); color: inherit; }
.pair-imgs { display: flex; flex: none; color: var(--muted); }
.pair-imgs img, .pair-imgs svg { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 8px; }
.pair-imgs > * + * { margin-inline-start: -10px; }
.pair-names { font-weight: 600; font-size: .9rem; line-height: 1.35; }
.pair-names em { font-style: normal; color: var(--muted); font-weight: 500; }
.ph-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.rival { font-size: .85rem; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--surface); color: var(--text-2); }
.rival:hover { border-color: var(--accent); }

@media (max-width: 900px) {
  .finder { grid-template-columns: 1fr; }
  .filter-toggle { display: inline-flex; }
  .filters { display: none; position: fixed; inset: auto 0 0 0; max-height: 82vh; z-index: 40; border-radius: 20px 20px 0 0;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, .3); padding-bottom: 24px; }
  .filters.open { display: block; }
  body.sheet-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 39; }
  .f-done { display: flex; }
}
@media (max-width: 760px) {
  .cmp-slots { gap: 8px; }
  .cmp-slot { padding: 12px 8px; }
  .cmp-img { height: 110px; }
  .cmp-name { font-size: .85rem; }
  .cmp-slot.add b { font-size: .85rem; }
  .cmp-table th, .cmp-table td { padding: 9px 8px; font-size: .84rem; }
  .cmp-table tbody tr > th { width: 26%; }
}

/* Photos are pre-framed 1200×1200 squares (core/photos.py) — let them fill their boxes edge to edge. */
.card-img { padding: 0; background: #fff; }
.card-img img { object-fit: cover; }
.card-img svg { padding: 18px; }
.ph-stage { padding: 0; overflow: hidden; background: #fff; }
.ph-main { object-fit: cover; }
.ph-stage svg.ph-main { padding: 28px; object-fit: contain; }
.thumb { padding: 0; overflow: hidden; }
.thumb img { object-fit: cover; }
.art-phone-img { padding: 0; overflow: hidden; }
.art-phone-img img { object-fit: cover; }
.cmp-img { height: auto; aspect-ratio: 1; max-width: 190px; border-radius: 12px; overflow: hidden; background: #fff; }
.cmp-img img { width: 100%; height: 100%; object-fit: cover; }
.sr-item img, .pair-imgs img { object-fit: cover; }
.guide-cover img { border-radius: 10px; }
@media (max-width: 760px) { .cmp-img { max-width: 110px; } }
