:root {
  --blue:   #1a73e8;
  --blue-d: #1558b0;
  --gray:   #f5f5f5;
  --border: #e0e0e0;
  --text:   #202124;
  --muted:  #5f6368;
  --green:  #34a853;
  --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  background: #fff;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ── HEADER ── */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.header-nav-bar {
  background: #fff;
  padding: 8px 0;
}
.header-nav-bar .container {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  justify-content: center;
}
.header-nav-bar nav { display: flex; gap: 10px; }
.header-nav-bar nav a { color: var(--blue); font-size: .9rem; font-weight: 500; }
.header-nav-bar nav a:hover { color: var(--blue-d); text-decoration: none; }
.header-search {
  display: flex; max-width: 320px; min-width: 180px;
}
.header-search input {
  flex: 1; padding: 6px 11px;
  border: 1px solid var(--border); border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: .9rem; outline: none; background: var(--gray);
}
.header-search input:focus { border-color: var(--blue); background: #fff; }
.header-search button {
  padding: 6px 11px; background: var(--blue); color: #fff;
  border: none; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer;
}
.header-search button:hover { background: var(--blue-d); }

/* ── MAIN ── */
main.container { padding-top: 24px; padding-bottom: 40px; min-height: 70vh; }

/* ── HERO / HOME ── */
.hero {
  text-align: center; padding: 48px 16px 32px;
}
.hero h1 { font-size: 2rem; margin-bottom: 12px; }
.hero p  { color: var(--muted); font-size: 1.1rem; margin-bottom: 24px; }

/* ── BRAND GRID ── */
.section-title {
  font-size: 1.3rem; margin: 32px 0 16px; font-weight: 600;
}
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px; margin-bottom: 32px;
}
.brand-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 8px 10px; text-align: center;
  transition: box-shadow .15s, border-color .15s;
  background: #fff;
}
.brand-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.1); border-color: var(--blue);
  text-decoration: none;
}
.brand-logo-wrap {
  height: 44px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.brand-logo-wrap img {
  max-height: 38px; max-width: 100px;
  width: auto; height: auto;
  object-fit: contain;
}
.brand-card .brand-name { font-size: .82rem; font-weight: 600; color: var(--text); }
.brand-card .brand-count { font-size: .72rem; color: var(--muted); margin-top: 2px; }

/* ── PHONE GRID ── */
.phone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.phone-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow .15s, border-color .15s;
  background: #fff; display: flex; flex-direction: column;
}
.phone-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1); border-color: var(--blue);
  text-decoration: none;
}
.phone-card-img {
  aspect-ratio: 3/4; overflow: hidden; background: var(--gray);
  display: flex; align-items: center; justify-content: center;
}
.phone-card-img img {
  width: 100%; height: 100%; object-fit: contain; padding: 12px;
}
.phone-card-img .no-img { font-size: 3rem; opacity: .3; }
.phone-card-body { padding: 10px 12px; flex: 1; }
.phone-card-body .brand { font-size: .75rem; color: var(--muted); }
.phone-card-body .model { font-size: .9rem; font-weight: 600; color: var(--text); }
.phone-card-body .year  { font-size: .75rem; color: var(--muted); }
.quality-badge {
  display: inline-block; font-size: .7rem; padding: 1px 6px;
  border-radius: 10px; margin-top: 4px;
}
.q-high { background: #e8f5e9; color: #2e7d32; }
.q-mid  { background: #fff3e0; color: #e65100; }
.q-low  { background: #fce4ec; color: #b71c1c; }

/* ── FICHA ── */
.phone-detail { display: grid; grid-template-columns: 280px 1fr; gap: 32px; }
@media (max-width: 680px) { .phone-detail { grid-template-columns: 1fr; } }

.phone-gallery img {
  width: 100%; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.phone-gallery .no-img {
  aspect-ratio: 3/4; background: var(--gray); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; font-size: 5rem; opacity: .3;
}
.phone-title { font-size: 1.8rem; font-weight: 700; margin-bottom: 6px; }
.phone-brand-link { color: var(--muted); font-size: .95rem; margin-bottom: 16px; display: block; }

.specs-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.specs-table th {
  background: var(--blue); color: #fff; text-align: left;
  padding: 8px 12px; font-size: .85rem; letter-spacing: .5px;
}
.specs-table td {
  padding: 7px 12px; font-size: .9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.specs-table tr:nth-child(even) td { background: var(--gray); }
.specs-table td:first-child { color: var(--muted); width: 38%; font-size: .85rem; }
.specs-section { margin-bottom: 4px; }

/* ── BREADCRUMB ── */
.breadcrumb {
  font-size: .85rem; color: var(--muted); margin-bottom: 20px;
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb .sep { opacity: .5; }

/* ── SEARCH ── */
.search-bar {
  display: flex; gap: 8px; margin-bottom: 24px;
}
.search-bar input {
  flex: 1; padding: 10px 14px; border: 2px solid var(--border);
  border-radius: var(--radius); font-size: 1rem;
}
.search-bar input:focus { border-color: var(--blue); outline: none; }
.search-bar button {
  padding: 10px 20px; background: var(--blue); color: #fff;
  border: none; border-radius: var(--radius); cursor: pointer; font-size: 1rem;
}

.results-info { color: var(--muted); margin-bottom: 16px; font-size: .9rem; }

/* ── FILTERS ── */
.filters {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px;
  padding: 16px; background: var(--gray); border-radius: var(--radius);
}
.filter-group label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.filter-group select, .filter-group input {
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 4px; font-size: .9rem; background: #fff;
}

/* ── PAGINATION ── */
.pagination {
  display: flex; gap: 4px; justify-content: center; margin-top: 32px; flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 4px;
  font-size: .9rem;
}
.pagination a:hover { background: var(--gray); text-decoration: none; }
.pagination .current { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── COMPARE ── */
.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th, .compare-table td {
  padding: 8px 12px; border: 1px solid var(--border); font-size: .85rem;
  text-align: left; vertical-align: top;
}
.compare-table th { background: var(--blue); color: #fff; }
.compare-table tr:nth-child(even) td { background: var(--gray); }
.compare-table td:first-child { color: var(--muted); font-weight: 500; width: 22%; }
.compare-highlight { background: #e8f5e9 !important; font-weight: 600; }

/* ── COMPARE SELECTOR ── */
.compare-selector {
  display: flex; gap: 16px; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap;
}
.compare-slot {
  flex: 1; min-width: 240px;
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.compare-slot:focus-within { border-color: var(--blue); }
.slot-label { font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.compare-dropdowns { display: flex; flex-direction: column; gap: 10px; }
.compare-dropdowns select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 4px; font-size: .9rem; background: #fff;
}
.compare-preview {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 10px; background: var(--gray);
  border-radius: 6px; font-size: .85rem;
}
.compare-preview img { height: 60px; width: 50px; object-fit: contain; }
.compare-preview .no-img { font-size: 2rem; }
.compare-vs {
  font-size: 1.5rem; font-weight: 900; color: var(--muted);
  align-self: center; padding: 0 4px;
}

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-info { background: #e3f2fd; color: #1565c0; }
.alert-warn { background: #fff8e1; color: #f57f17; }

/* ── LOGO BAR (blanca, centrada) ── */
.header-logo-bar {
  background: #fff;
  text-align: center;
  padding: 14px 16px 10px;
}
.logo-link { display: block; line-height: 0; margin: 0 auto; width: fit-content; }
.logo-link img {
  width: 200px; height: auto;
  max-width: 60vw;
  display: block;
}

/* ── FOOTER Just Dust style ── */
.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 1rem 2rem;
  border-top: 1px solid var(--border);
  font-size: .72rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: .06em;
  line-height: 2;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--blue); }
.site-footer a.active { color: var(--text); border-bottom: 1px solid var(--border); }
.footer-links {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: .2rem .8rem; margin-bottom: .5rem;
}
.footer-links a { font-size: .68rem; opacity: .7; letter-spacing: .08em; }
.footer-links a:hover { opacity: 1; }
.footer-links a.active { opacity: 1; }

/* ── LANG SELECTOR ── */
.lang-selector {
  display: flex; gap: 3px; flex-wrap: wrap;
}
.lang-btn {
  font-size: .7rem; padding: 2px 6px; border-radius: 3px;
  color: var(--muted); background: var(--gray);
  text-decoration: none; font-weight: 600; border: 1px solid var(--border);
}
.lang-btn:hover {
  background: #e8e8e8; color: var(--text); text-decoration: none;
}
.lang-btn.active {
  background: var(--blue); color: #fff; border-color: var(--blue); text-decoration: none;
}

/* ── PWA INSTALL BUTTON ── */
.btn-install {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.2rem;
  z-index: 200;
  padding: .55rem 1rem;
  background: var(--blue);
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 24px;
  box-shadow: 0 4px 16px rgba(26,115,232,.4);
  transition: background .2s, transform .15s, box-shadow .2s;
  gap: .4rem;
}
.btn-install:hover {
  background: var(--blue-d);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26,115,232,.5);
}
.btn-install.visible { display: flex; align-items: center; }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .phone-grid { grid-template-columns: repeat(2, 1fr); }
  .brand-grid { grid-template-columns: repeat(3, 1fr); }
}
