/* ==========================================================================
   ElectroShop Main Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ROOT & GENERAL STYLES
   -------------------------------------------------------------------------- */
:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --accent: #00b4d8;
  --accent-2: #10cab7;
  --muted: #6b7280;
  --text: #0f172a;
  --danger: #dc3545;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --container: 1200px;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4 {
  line-height: 1.15;
  margin: 0;
}

.container {
  max-width: var(--container);
  padding: 0 18px;
  margin: 0 auto;
}


/* --------------------------------------------------------------------------
   2. REUSABLE COMPONENTS (Buttons, Forms)
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  background: transparent;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  color: white;
  box-shadow: 0 8px 24px rgba(16, 202, 183, 0.15);
}

.btn-outline {
  border: 1px solid #e6eef6;
  background: white;
  color: var(--text);
}

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #e0e6ed;
  font-size: 1rem;
}


/* --------------------------------------------------------------------------
   3. HEADER & NAVIGATION
   -------------------------------------------------------------------------- */
.site-header {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid #e6eef6;
  backdrop-filter: blur(4px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
}

.brand {
  font-weight: 800;
  font-size: 22px;
  color: var(--text);
}

.brand span {
  color: var(--accent);
  margin-left: 4px;
}

.search {
  margin-left: 12px;
  flex: 1;
  max-width: 520px;
  display: flex;
}

.search input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #e3eef6;
  background: #fff;
  outline: none;
  font-size: 14px;
}

.search button {
  margin-left: -46px;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
}

.search button ion-icon {
  font-size: 18px;
}

.main-nav {
  margin-left: 20px;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 12px;
  margin: 0;
  padding: 0;
  align-items: center;
}

.main-nav a {
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 600;
}

.main-nav a:hover {
  background: rgba(16, 202, 183, 0.08);
  color: var(--accent-2);
}

.mobile-toggle {
  background: transparent;
  border: 0;
  padding: 8px;
  display: none;
  cursor: pointer;
}


/* --------------------------------------------------------------------------
   4. HEADER ICONS & USER DROPDOWN
   -------------------------------------------------------------------------- */
.auth-links-cart {
  white-space: normal;
}

.header-cart-icon {
  position: relative;
  color: var(--text);
  font-size: 24px;
  display: flex;
}

#cart-badge {
  position: absolute;
  top: -5px;
  right: -10px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.user-dropdown {
  position: relative;
}

.user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  font-family: "Poppins", sans-serif;
}

.user-dropdown-toggle ion-icon {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.user-dropdown-toggle:hover ion-icon {
  transform: translateY(2px);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 180px;
  padding: 8px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.user-dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-menu a {
  display: block;
  padding: 10px 12px;
  color: var(--text);
  border-radius: 8px;
  font-weight: 500;
}

.user-dropdown-menu a:hover {
  background-color: var(--bg);
}


/* --------------------------------------------------------------------------
   5. PAGE SECTIONS (Hero, Products, Newsletter, Footer)
   -------------------------------------------------------------------------- */
.hero {
  padding: 36px 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 28px;
  align-items: center;
}

.hero-slider {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: var(--shadow);
  height: 420px;
}

.hero-slider .slide {
  position: absolute;
  inset: 0;
  transition: opacity .7s ease;
  opacity: 0;
}

.hero-slider img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-cta h1 {
  font-size: 36px;
  margin: 0 0 12px;
}

.hero-cta p {
  color: var(--muted);
  margin-bottom: 18px;
}

.cta-actions {
  display: flex;
  gap: 12px;
}

.section-heading {
  text-align: center;
  padding: 36px 0 6px;
}

.section-heading h2 {
  margin-bottom: 6px;
}

.product-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
  flex-wrap: wrap;
  gap: 12px;
}

.product-controls label {
  margin-right: 6px;
  font-weight: 600;
}

.product-controls select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e0e6ed;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  padding: 18px 0;
}

.product {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}

.product:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
}

.product-media {
  height: 200px;
  overflow: hidden;
  background: #f3f6f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.product-body h3 {
  margin: 0;
  font-size: 16px;
}

.product-body .price {
  color: #e63946;
  font-weight: 700;
}

.product-body .desc {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.product .actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.product .actions .btn-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0px;
  border-radius: 10px;
  border: 1px solid #e6eef6;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease-in-out;

}

.product .actions .btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #e6eef6;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  white-space: nowrap;
}

.product .actions .btn-outline:hover {
  background-color: var(--bg);
  border-color: #dbe7f2;
  transform: translateY(-2px);
}

.product .actions .btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.product .actions .btn-primary:hover {
  background: #0097b5;
  border-color: #0097b5;
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 180, 216, 0.2);
}

.newsletter {
  background: linear-gradient(90deg, #fff, #f8fbfd);
  padding: 28px;
  border-radius: 12px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}

.newsletter-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.newsletter-form {
  display: flex;
  gap: 10px;
}

.newsletter-form input {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #e6eef6;
}

.newsletter-form button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.site-footer {
  margin-top: 28px;
  background: #051129;
  color: #e6eef6;
  padding: 30px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
  align-items: start;
}

.footer-col h4 {
  margin: 0 0 8px;
}

.footer-col p {
  color: #bcd3dd;
  font-size: 14px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col a {
  color: #cfeefa;
  font-size: 14px;
}

.footer-bottom {
  text-align: center;
  padding-top: 18px;
  color: #94b8c9;
}


/* --------------------------------------------------------------------------
   6. SPECIFIC PAGE STYLES (Auth, User Account, etc.)
   -------------------------------------------------------------------------- */
.auth-form-container {
  padding: 60px 20px;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-form-card {
  background: var(--card);
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 450px;
}

.auth-form-card h2 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 24px;
  font-weight: 700;
}

.form-group .auth-error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}

.form-actions a {
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
}

.form-actions .btn-primary {
  padding: 12px 24px;
}

.order-table {
  width: 100%;
  border-collapse: collapse;
}

.order-table th, .order-table td {
  padding: 12px;
  text-align: left;
}

.order-table thead tr {
  border-bottom: 2px solid #eef2f6;
}

.order-table tbody tr {
  border-bottom: 1px solid #eef2f6;
}

.order-details-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  align-items: start;
}


/* --------------------------------------------------------------------------
   7. MOBILE & RESPONSIVE STYLES
   -------------------------------------------------------------------------- */
@media (max-width: 980px) {
  .header-inner {
    padding: 14px 18px;
  }

  .main-nav {
    display: none;
  }

  .mobile-toggle {
    display: flex;
    align-items: center;
    font-size: 28px;
    margin-left: 10px;
    position: relative;
    right: 14px
  }

  .search {
    max-width: 380px;
  }

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

  .hero-slider {
    height: 360px;
    margin-bottom: 20px;
  }

  .cta-actions {
    justify-content: center;
  }

  .newsletter-inner {
    flex-direction: column;
    text-align: center;
  }

  .product-details-grid, .order-details-grid {
    grid-template-columns: 1fr;
  }



}


@media (max-width: 767px) {

  /* Guest users */

  body.guest .header-inner {
    gap: 10px;
  }

  /* Logged-in users */
  body.logged-in .header-inner {
    gap: 15vw;
  }


  .header-inner .brand {
    font-size: 20px;
  }

  .header-inner .search {
    display: none;
  }

  .auth-links-cart {
    gap: 10px;
  }

  .auth-links-cart .btn {
    white-space: nowrap;
    padding: 5px 10px;
    font-size: 13px;
  }

  .user-dropdown-toggle span {
    display: none;
  }

  .user-dropdown-toggle::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-left: 8px;
  }

  .user-dropdown-toggle ion-icon {
    display: none;
  }

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

  .hero-slider {
    height: 250px;
  }

  .hero-cta h1 {
    font-size: 28px;
  }

  .product-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
  }

  .product-media {
    height: 150px;
  }

  .product .actions {
    grid-template-columns: 1fr 1fr;

  }


  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .newsletter-form {
    flex-direction: column;
    width: 100%;
  }

  .newsletter-form input {
    width: 100%;
  }

  .checkout-grid {
    grid-template-columns: 1fr;
  }

  .order-list-card {
    overflow-x: auto;
  }

  .order-table td {
    padding: 0;
    text-align: left;
  }

}

.mobile-drawer {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  z-index: 100;
  padding: 28px;
}

.mobile-drawer ul {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  list-style: none;
  margin-top: 50px;
}

.mobile-drawer ul li {
  padding: 12px 0;
  border-bottom: 1px solid #eef2f6;
}

.mobile-drawer ul li:last-child {
  border-bottom: none;
}

.mobile-drawer a {
  color: var(--text);
  font-weight: 600;
  font-size: 1.1rem;
}

.mobile-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
}