/* ============================================
   MichiPhone - Estilos Principales
   ============================================ */

/* --- Variables CSS --- */
:root {
  --color-primary: #1a1a1a;
  --color-accent: #c9a84c;
  --color-accent-hover: #b8943f;
  --color-bg: #ffffff;
  --color-bg-soft: #f7f7f7;
  --color-bg-card: #ffffff;
  --color-text: #2c2c2c;
  --color-text-secondary: #6b6b6b;
  --color-text-light: #999999;
  --color-border: #e8e8e8;
  --color-border-light: #f0f0f0;
  --color-success: #25d366;
  --color-danger: #d94040;
  --color-discount: #d94040;
  --color-liquidation: #c9a84c;
  --color-price-offer: #1a1a1a;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1280px;
  --header-height: 64px;
}

/* --- Reset y Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-fast);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* --- Utilidades --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border-light);
  height: var(--header-height);
  backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.95);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-logo img {
  height: 36px;
  width: auto;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.5px;
}

.logo-text span {
  color: var(--color-accent);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
  white-space: nowrap;
}

.header-nav a:hover {
  color: var(--color-primary);
}

.btn-whatsapp-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background-color: var(--color-success);
  color: #fff;
  border-radius: var(--radius-xl);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-whatsapp-header:hover {
  background-color: #20bd5a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp-header i {
  font-size: 1rem;
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  font-size: 1.25rem;
}

.mobile-menu-btn:hover {
  background-color: var(--color-bg-soft);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
  background-color: var(--color-bg-soft);
  padding: 48px 0 40px;
  text-align: center;
  border-bottom: 1px solid var(--color-border-light);
}

.hero-section h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.hero-section h1 span {
  color: var(--color-accent);
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--color-text-secondary);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ============================================
   FILTERS
   ============================================ */
.filters-section {
  padding: 28px 0 20px;
  background-color: var(--color-bg);
}

.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.filter-group i.filter-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-light);
  font-size: 0.875rem;
  pointer-events: none;
}

.filter-input,
.filter-select {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: all var(--transition-fast);
  appearance: none;
}

.filter-select {
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.filter-input:focus,
.filter-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}

.filter-input::placeholder {
  color: var(--color-text-light);
}

.btn-clear-filters {
  height: 44px;
  padding: 0 20px;
  background-color: var(--color-bg-soft);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-clear-filters:hover {
  background-color: var(--color-border-light);
  color: var(--color-text);
}

.results-count {
  width: 100%;
  padding-top: 12px;
  font-size: 0.8125rem;
  color: var(--color-text-light);
}

.results-count strong {
  color: var(--color-text);
  font-weight: 600;
}

/* ============================================
   PRODUCTS GRID
   ============================================ */
.products-section {
  padding: 12px 0 60px;
  flex: 1;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ============================================
   PRODUCT CARD
   ============================================ */
.product-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  position: relative;
}

.product-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

/* Card badges */
.card-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-xl);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.badge-discount {
  background-color: var(--color-discount);
  color: #fff;
}

.badge-liquidation {
  background-color: var(--color-liquidation);
  color: #fff;
}

/* Card image */
.card-image {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background-color: var(--color-bg-soft);
  overflow: hidden;
}

.card-image a {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--transition-normal);
}

.product-card:hover .card-image img {
  transform: scale(1.05);
}

/* Image placeholder / fallback */
.img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f0f0 0%, #e4e4e4 100%);
  color: var(--color-text-light);
  gap: 8px;
}

.img-placeholder i {
  font-size: 2.5rem;
  opacity: 0.4;
}

.img-placeholder span {
  font-size: 0.75rem;
  opacity: 0.5;
}

/* Card body */
.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  flex: 1;
}

.card-details {
  flex: 1;
  min-width: 0;
}

.card-model {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.3;
  margin-bottom: 2px;
}

.card-model a {
  color: inherit;
}

.card-model a:hover {
  color: var(--color-accent);
}

.card-capacity {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.card-color {
  font-size: 0.75rem;
  color: var(--color-text-light);
  font-weight: 500;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-color i {
  font-size: 0.6875rem;
  color: var(--color-accent);
}

/* Card pricing */
.card-pricing {
  text-align: right;
  flex-shrink: 0;
}

.price-original {
  font-size: 0.8125rem;
  color: var(--color-text-light);
  text-decoration: line-through;
  line-height: 1.3;
}

.price-offer {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-price-offer);
  line-height: 1.3;
}

.price-normal {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-price-offer);
  line-height: 1.3;
}

.discount-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  background-color: rgba(217, 64, 64, 0.08);
  color: var(--color-discount);
  border-radius: var(--radius-xl);
  font-size: 0.6875rem;
  font-weight: 700;
}

/* Card button */
.btn-detail {
  display: block;
  width: 100%;
  padding: 11px 0;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary);
  background-color: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  margin-top: auto;
}

.btn-detail:hover {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ============================================
   STATES: Loading, Error, Empty
   ============================================ */
.state-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
}

.state-message i {
  font-size: 2.5rem;
  color: var(--color-text-light);
  margin-bottom: 16px;
  display: block;
  opacity: 0.5;
}

.state-message h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.state-message p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.5;
}

.state-message .btn-clear-filters {
  margin-top: 16px;
}

/* Loading spinner */
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background-color: var(--color-primary);
  color: rgba(255, 255, 255, 0.6);
  padding: 32px 0;
  text-align: center;
  font-size: 0.8125rem;
  margin-top: auto;
}

.site-footer strong {
  color: #fff;
  font-weight: 600;
}

.site-footer a {
  color: var(--color-accent);
}

.site-footer a:hover {
  color: var(--color-accent-hover);
}

/* ============================================
   RESPONSIVE: Tablet (max 1024px)
   ============================================ */
@media (max-width: 1100px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .header-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--color-bg);
    border-bottom: 1px solid var(--color-border-light);
    flex-direction: column;
    padding: 16px 20px;
    gap: 12px;
    box-shadow: var(--shadow-md);
  }

  .header-nav.active {
    display: flex;
  }

  .header-nav a {
    font-size: 1rem;
    padding: 8px 10px;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .hero-section {
    padding: 32px 0 28px;
  }

  .hero-section h1 {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 0.875rem;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    max-width: 100%;
    min-width: 0;
  }

  .btn-clear-filters {
    align-self: flex-start;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card-body {
    padding: 12px;
  }

  .card-model {
    font-size: 0.8125rem;
  }

  .card-capacity {
    font-size: 0.75rem;
  }

  .price-offer,
  .price-normal {
    font-size: 1rem;
  }

  .price-original {
    font-size: 0.75rem;
  }
}

/* ============================================
   RESPONSIVE: Mobile (max 480px)
   ============================================ */
@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .product-card {
    max-width: 100%;
  }

  .card-image {
    padding-top: 85%;
  }

  .hero-section {
    padding: 24px 0 20px;
  }

  .hero-section h1 {
    font-size: 1.3rem;
  }

  .site-footer {
    padding: 24px 0;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card {
  animation: fadeIn 0.4s ease forwards;
}

.product-card:nth-child(1) { animation-delay: 0.02s; }
.product-card:nth-child(2) { animation-delay: 0.06s; }
.product-card:nth-child(3) { animation-delay: 0.10s; }
.product-card:nth-child(4) { animation-delay: 0.14s; }
.product-card:nth-child(5) { animation-delay: 0.18s; }
.product-card:nth-child(6) { animation-delay: 0.22s; }
.product-card:nth-child(7) { animation-delay: 0.26s; }
.product-card:nth-child(8) { animation-delay: 0.30s; }
.product-card:nth-child(9) { animation-delay: 0.34s; }
.product-card:nth-child(10) { animation-delay: 0.38s; }
