/* --- RESET & VARIABLES --- */
:root {
  /* Light Theme Palette */
  --bg-body: #f8f9fa;       /* Very light grey background */
  --bg-card: #ffffff;       /* White cards */
  --bg-header: #ffffff;     /* White header */
  
  --accent: #0088cc;        /* Vibrant Tech Blue */
  --accent-hover: #006699;  /* Darker Blue for hover */
  --accent-secondary: #00d2ff; /* Cyan highlight */

  --text-main: #2c3e50;     /* Dark Blue-Grey for main text */
  --text-heading: #1a1a1a;  /* Near Black for headings */
  --text-muted: #6c757d;    /* Standard Grey */
  
  --border: #e9ecef;        /* Very subtle border */
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.1);

  --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --container-width: 1200px;
}

/* --- FOUC PREVENTION --- */
body {
  opacity: 0;
  transition: opacity 0.12s ease-out;
}

body.loaded {
  opacity: 1;
}

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

html {
  overflow-x: hidden;
}

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: 0.2s;
}

ul {
  list-style: none;
}

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

/* --- UTILITIES --- */
.container {
  width: 90%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 2rem 1rem;
}

.text-center { text-align: center; }
.mb-2 { margin-bottom: 2rem; }
.mt-2 { margin-top: 2rem; }

.error-message {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
  padding: 1rem;
  border-radius: 4px;
  text-align: center;
  margin: 1rem 0;
}

/* --- HEADER --- */
header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px; /* Slightly taller header */
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent);
  text-transform: uppercase;
}
.logo img {
  height: 60px;
  width: 220px;
}

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

.nav-links a {
  color: var(--text-main);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--accent);
}

/* --- HERO SECTION --- */
.hero {
  text-align: center;
  padding: 8rem 1rem;
  background: linear-gradient(135deg, rgba(1, 13, 37, 0.9) 0%, rgba(1, 69, 138, 0.5) 100%), url('/assets/images/hero.webp') center/cover no-repeat;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: 2.4rem;
  margin-bottom: 1rem;
  color: #ffffff;
  line-height: 1.2;
}

.detail-hero-title {
  font-size: 4rem !important;
}

.hero p {
  color: #ffffff;
  font-size: 1.3rem;
  max-width: 700px;
  margin: 0 auto 2.5rem;
  font-weight: 300;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.hero .btn-secondary {
  background-color: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.hero .btn-secondary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}


/* --- BUTTONS --- */
.btn {
  display: inline-block;
  background-color: var(--accent);
  color: #fff;
  padding: 0.3rem 0.6rem;
  font-weight: 600;
  font-size: 0.7rem;
  border-radius: 50px; /* Pill shaped buttons */
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: 2px solid var(--accent);
  box-shadow: 0 4px 6px rgba(0, 136, 204, 0.2);
  white-space: nowrap;
}

.btn:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 136, 204, 0.3);
  color: #fff;
}

.btn-secondary {
  background-color: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  box-shadow: none;
}

.btn-secondary:hover {
  background-color: var(--accent);
  color: #fff;
}

/* --- GRID SYSTEM --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
}

/* --- CARDS --- */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  position: relative;
  min-height: 200px;
}

.product-card {
    height: 350px;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-secondary);
}

.grid .card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem 1rem;
}

/* Desktop: shift card content down by 2rem */
@media (min-width: 769px) {
  .grid .card {
    justify-content: flex-start;
    padding-top: 0.5rem;
  }
}

.grid .card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
  transform: none;
}

.card-img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    background-color: #ffffff;
}

.card-images {
  display: flex;
  gap: 0.25rem;
}

.card-images .card-img {
  width: calc(50% - 0.125rem);
}

.four-columns {
  grid-template-columns: repeat(4, 1fr);
}

.grid .category-card {
  padding-top: 2rem;
  padding-bottom: 0.5rem;
}

/* Desktop: increase category card height by 20px */
@media (min-width: 769px) {
  .grid .category-card {
    height: 220px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

.card-body {
    padding: 0.5rem 1.2rem 3rem 1.2rem;
    position: relative;
}

.card-title {
    font-size: 1.1rem;
    margin: 0.5rem 0;
    color: var(--text-heading);
    text-align: center;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0.5rem 0 0.5rem 0;
  text-align: center;
}

/* Product cards specific */
.product-card .card-title {
    font-size: 0.9rem;
    min-height: 4.5rem;
    max-height: 4.5rem;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.product-card .card-desc {
    min-height: 3.75rem;
    font-size: 0.75rem;
    margin-bottom: 1.5rem;
}

.voltage-converters .card-desc {
    margin-top: 0.2rem;
    margin-bottom: 1rem;
}

.product-card .btn {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: fit-content;
  font-size: 0.35rem;
}

/* Larger button on desktop */
@media (min-width: 769px) {
  .product-card .btn {
    font-size: 0.7rem;
  }
}

.product-card .card-body {
  padding-bottom: 1.2rem;
  position: static;
}

.card-price {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--accent);
  display: block;
  margin-bottom: 1rem;
  text-align: center;
}

/* Center and bottom-align buttons in cards */
.card .btn {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: fit-content;
}

/* --- SERVICES --- */
.service-card {
  padding: 2.5rem;
  text-align: center;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.3s;
  width: 100%;
  min-width: 0;
  position: relative;
}

.service-card:hover {
  transform: translateY(-5px);
}

.service-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  display: block;
  color: var(--accent); /* Colorize the icons */
}

.service-card h3 {
  color: var(--text-heading);
  margin-bottom: 0.5rem;
}

.service-card .btn {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
}

.service-banner-overlay {
  background: linear-gradient(to right, rgba(0, 56, 119, 0.8) 0%, rgba(0, 56, 119, 0.3) 100%);
}

/* Back button style */
.back-btn {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 1rem;
}

.back-btn:hover {
  color: var(--accent-hover);
}

/* Hide back button on mobile */
@media (max-width: 768px) {
  .back-btn {
    display: none;
  }
}

/* --- PRODUCT DETAIL --- */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  margin-top: 2rem;
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.product-image-large {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.product-right h1 {
  color: var(--text-heading);
}

.specs-list {
  margin: 1.5rem 0;
  padding-left: 1.2rem;
  color: var(--text-main);
}

.specs-list li {
  margin-bottom: 0.5rem;
  list-style-type: square;
}

/* --- CONTACT FORM --- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-heading);
  font-weight: 600;
}

.form-control {
  width: 100%;
  padding: 12px;
  background-color: #fff;
  border: 1px solid #ced4da;
  color: var(--text-main);
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 136, 204, 0.1);
}

/* --- FOOTER (Dark Theme Match) --- */
.main-footer {
  margin-top: auto;
  background-color: #0b1120; /* Dark blue/black */
  padding: 4rem 0 2rem 0;
  color: #94a3b8; /* Slate text */
  border-top: none;
  font-size: 0.95rem;
}

.footer-container {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr; /* Brand wider than links */
  gap: 3rem;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.footer-col h3 {
  color: #fff;
  font-size: 1.25rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.footer-col h4 {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.footer-desc {
  line-height: 1.6;
  margin-bottom: 2rem;
  max-width: 400px;
}

.footer-links li {
  margin-bottom: 0.8rem;
}

.footer-links a {
  color: #94a3b8;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #fff;
}

.footer-copyright {
  margin-top: 3rem;
  font-size: 0.85rem;
  color: #64748b;
}

/* --- MOBILE --- */
@media (max-width: 1023px) {
  .hero { padding: 4rem 1rem; flex-direction: column-reverse; }
  .detail-hero-title { font-size: 2rem !important; text-align: center; }
  .hero-buttons { flex-direction: column; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 1.1rem; text-align: justify; max-width: none; margin: 0 0 2.5rem 0; }
  .product-detail, .contact-grid { grid-template-columns: 1fr; }
  .navbar { position: relative; height: 85px; padding: 0.5rem 1rem 0 1rem; display: flex; align-items: flex-start; }
  .logo { margin-top: 7px; }
  .logo img { height: 35px; width: 128px; }
  .hamburger { margin-left: auto; margin-top: 7px; background: none; border: none; font-size: 1.5rem; cursor: pointer; height: 35px; display: flex; align-items: center; }
  .mobile-menu { position: absolute; top: 100%; left: 0; width: 100%; background: white; border: 1px solid #ccc; box-shadow: 0 2px 5px rgba(0,0,0,0.1); display: none; z-index: 1000; }
  .mobile-menu a { display: block; padding: 0.75rem 1rem; border-bottom: 1px solid #eee; text-decoration: none; color: #333; }
  .mobile-menu a:last-child { border-bottom: none; }
  .mobile-menu a:hover { background: #f5f5f5; }

  /* Allow 1 category per row on mobile */
  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .benefits-grid {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 1rem;
    padding-left: 12.5vw;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .benefits-grid::-webkit-scrollbar {
    display: none;
  }

  .benefits-grid .card {
    flex: 0 0 75vw;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem 1rem;
  }

  .benefits-grid .card:hover,
  .benefits-grid .card:active,
  .benefits-grid .card:focus {
    border-color: var(--border);
    box-shadow: var(--shadow);
    -webkit-tap-highlight-color: transparent;
  }

  .grid .card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow);
  }

  .carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
  }

  .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ccc;
    transition: background-color 0.3s;
  }

  .dot.active {
    background-color: var(--accent);
  }

  /* Reduce product card width */
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  /* Smaller card elements on mobile */
  .grid .card {
    height: 200px;
  }
  .grid .category-card {
    padding-top: 2rem;
    padding-bottom: 0.5rem;
  }
  .grid .product-card {
    height: 210px;
  }
  .card-body {
    padding: 0.5rem 0.8rem 3rem 0.8rem;
    position: static;
  }
  .product-card .card-body {
    padding-bottom: 1.2rem;
  }
  .card-img {
    height: 100px;
  }

  .product-card .card-img {
    height: 80px;
  }
  .card-title {
    font-size: 1.3rem;
  }

  .product-card .card-title {
    font-size: 0.95rem;
  }

  .product-card .btn {
    font-size: 0.6rem;
    padding: 0.1rem 0.2rem;
    position: absolute;
    bottom: 0.3rem;
    left: 50%;
    transform: translateX(-50%);
  }

  .product-card .card-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 3;
    min-height: auto;
  }

  .product-card .card-title {
    min-height: 2rem;
  }

  .product-card .card-desc {
    display: none;
  }

  /* Smaller buttons on mobile */
  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }

  /* Smaller service icons */
  .service-icon {
    font-size: 1.25rem;
  }

  .service-card {
    padding: 2rem;
  }

  .service-card .btn {
    bottom: 1rem;
  }

  /* Center product titles */
  .product-right h1 {
    text-align: center;
  }

  /* Stack back to store button above title on mobile */
  .container > div:first-child {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    margin: 0.5rem 0;
  }

  /* Make product detail full width on mobile */
  .product-detail {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 1rem;
  }

  /* Smaller back to store button on mobile */
  .btn.btn-secondary {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  /* Hide back to store button */
  .back-to-store {
    display: none;
  }

  /* Reduce container top padding on mobile */
  .container {
    padding: 1rem 0.75rem 2rem 0.75rem;
  }


  .service-detail-container {
    padding: 0;
    width: 100%;
  }

  .service-detail-card {
    padding: 1rem;
  }

  .service-detail-container p {
    font-size: 0.75rem;
  }

  .service-detail-container h3 {
    font-size: 1rem;
  }

  /* Footer Mobile */
  .footer-container {
      grid-template-columns: 1fr;
      gap: 2rem;
      text-align: center;
  }
  .footer-desc { margin: 0 auto 2rem; }
}

/* Mobile-first styling */
body {
  font-family: 'Inter', sans-serif; /* Similar to Ifixit */
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* Layout grid like iFixit product list */
.products-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px;
}

.product-card {
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 0 8px rgba(0,0,0,0.05);
  margin-bottom: 10px;
}

.product-card img {
  width: 100%;
  height: auto;
}

/* Mobile */
@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr; /* One per row like ifixit */
  }
}

/* Desktop */
@media (min-width: 800px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr); /* or 4 */
  }

  /* Center buttons in product categories on desktop */
  .products-grid .btn {
    display: block;
    margin: 0 auto;
    width: fit-content;
  }
}

/* Enlarge hero buttons on desktop */
@media (min-width: 1024px) {
  .hero .btn {
    font-size: 1.05rem;
    padding: 0.45rem 0.9rem;
  }

  .service-card {
    padding: 1.5rem;
    min-height: 300px;
  }
}
