:root {
  --text: #64748b;
  --text-h: #0f172a;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #0ea5e9;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

body {
  margin: 0;
  min-height: 100svh;
}

#root {
  min-height: 100svh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  color: var(--text-h);
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

p {
  margin: 0 0 1rem;
}

img {
  max-width: 100%;
  height: auto;
}

/* Layout */
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

/* Navbar */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo:hover {
  text-decoration: none;
}

.logo-img {
  display: block;
  height: 52px;
  width: auto;
}

.footer-logo {
  display: block;
  height: 48px;
  width: auto;
  margin-bottom: 0.75rem;
  border-radius: 6px;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}

.search-form {
  display: flex;
  gap: 0.35rem;
}

.search-form input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 160px;
  font-size: 0.9rem;
}

.search-form button {
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.search-form button:hover {
  background: var(--primary-hover);
}

/* Footer */
.footer {
  background: var(--text-h);
  color: #94a3b8;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
  display: grid;
  gap: 1.5rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-links a {
  color: #cbd5e1;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0ea5e9 100%);
  color: white;
  border-radius: var(--radius);
  margin: 1.5rem 0 2.5rem;
  padding: 3rem 2rem;
  text-align: center;
}

.hero-tag {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.hero h1 {
  color: white;
  margin-bottom: 1rem;
}

.hero-sub {
  max-width: 520px;
  margin: 0 auto 1.5rem;
  opacity: 0.95;
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.65rem 1.35rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-primary {
  background: white;
  color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.btn-outline {
  border-color: rgba(255, 255, 255, 0.6);
  color: white;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  text-decoration: none;
}

/* Sections */
.section {
  margin-bottom: 3rem;
}

.section-alt {
  background: var(--surface);
  margin-left: -1.25rem;
  margin-right: -1.25rem;
  padding: 2.5rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-header p {
  color: var(--text);
  margin-bottom: 0.5rem;
}

.section-link {
  font-weight: 600;
  font-size: 0.95rem;
}

.cta-strip {
  text-align: center;
  background: var(--primary-light);
  padding: 2.5rem 1.5rem;
  border-radius: var(--radius);
}

.cta-strip h2 {
  margin-bottom: 0.5rem;
}

/* Grids */
.phone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.brand-grid-full {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

/* Phone card */
.phone-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  transition: box-shadow 0.2s, transform 0.2s;
}

.phone-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.phone-rank {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  z-index: 1;
}

.phone-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.phone-card-link:hover {
  text-decoration: none;
}

.phone-card-img-wrap {
  background: #f1f5f9;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  aspect-ratio: 3 / 4;
}

.phone-card-img-wrap img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
}

.phone-card-body {
  padding: 1rem;
}

.phone-card-body h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}

.phone-meta {
  font-size: 0.8rem;
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.phone-desc {
  font-size: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

/* Brand card */
.brand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-h);
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
}

.brand-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.brand-card-name {
  font-weight: 600;
  font-size: 1rem;
}

.brand-card-count {
  font-size: 0.8rem;
  color: var(--text);
  margin-top: 0.25rem;
}

/* Page headers */
.page-header {
  margin: 1.5rem 0 2rem;
}

.page-header p {
  font-size: 1.05rem;
}

.breadcrumb {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--text);
}

.breadcrumb a {
  color: var(--primary);
}

/* Specs page */
.specs-hero {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  align-items: start;
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.specs-image-wrap {
  background: #f1f5f9;
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.specs-image {
  max-height: 280px;
  width: 100%;
  max-width: 200px;
  object-fit: contain;
}

.quick-specs {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.5rem;
}

.quick-specs li {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.quick-specs strong {
  color: var(--text-h);
  min-width: 120px;
}

.spec-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.spec-section h2 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-light);
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.spec-table th,
.spec-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.spec-table th {
  width: 38%;
  color: var(--text-h);
  font-weight: 500;
}

.specs-disclaimer {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 2rem;
}

/* Content pages */
.prose section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.prose ul {
  margin: 0;
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

/* Contact */
.contact-details {
  max-width: 480px;
  margin: 0 auto 2rem;
}

.contact-list {
  margin: 0;
}

.contact-list > div {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.5rem 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.contact-list > div:last-child {
  border-bottom: none;
}

.contact-list dt {
  margin: 0;
  font-weight: 600;
  color: var(--text-h);
}

.contact-list dd {
  margin: 0;
}

.whatsapp-contact {
  max-width: 420px;
  margin: 0 auto;
}

.whatsapp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 2rem;
  background: var(--surface);
  border: 2px solid #25d366;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-h);
  transition: box-shadow 0.2s, transform 0.2s, background 0.2s;
}

.whatsapp-card:hover {
  text-decoration: none;
  box-shadow: 0 8px 32px rgba(37, 211, 102, 0.25);
  transform: translateY(-2px);
  background: #f0fdf4;
}

.whatsapp-icon {
  color: #25d366;
  line-height: 0;
}

.whatsapp-label {
  font-size: 1.25rem;
  font-weight: 600;
}

.whatsapp-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #128c7e;
  letter-spacing: 0.02em;
}

.whatsapp-hint {
  font-size: 0.85rem;
  color: var(--text);
  margin-top: 0.5rem;
}

/* Filter */
.filter-bar {
  margin-bottom: 1.5rem;
}

.filter-bar input {
  width: 100%;
  max-width: 360px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

/* Loading & errors */
.loading {
  text-align: center;
  padding: 4rem 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-box {
  text-align: center;
  padding: 3rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  margin: 2rem 0;
}

.error-box button {
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text);
}

/* Responsive */
@media (max-width: 768px) {
  .navbar-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links {
    justify-content: center;
    flex-wrap: wrap;
  }

  .search-form {
    width: 100%;
  }

  .search-form input {
    flex: 1;
    min-width: 0;
  }

  .specs-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .specs-image {
    margin: 0 auto;
  }

  .section-alt {
    margin-left: 0;
    margin-right: 0;
  }
}
