@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-primary: #fafafa;
  --bg-secondary: #f0f0f0;
  --bg-tertiary: #e8e8e8;
  --text-primary: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-tertiary: #999999;
  --border-color: #e5e5e5;
  --border-light: #f0f0f0;
  --accent-color: #1a1a1a;
  --accent-secondary: #4a4a4a;
  --button-bg: #1a1a1a;
  --button-text: #ffffff;
  --success: #2d7d46;
  --error: #c41e3a;
  --toast-bg: rgba(255, 255, 255, 0.94);
  --toast-text: #1a1a1a;
  --toast-muted: #6b6b6b;
  --toast-border: rgba(0, 0, 0, 0.06);
  --toast-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --toast-accent-success: #16a34a;
  --toast-accent-error: #dc2626;
  --toast-accent-info: #2563eb;
}

[data-theme="dark"] {
  --bg-primary: #0d0d0d;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #252525;
  --text-primary: #f5f5f5;
  --text-secondary: #a0a0a0;
  --text-tertiary: #707070;
  --border-color: #2a2a2a;
  --border-light: #1f1f1f;
  --accent-color: #f5f5f5;
  --accent-secondary: #d0d0d0;
  --button-bg: #f5f5f5;
  --button-text: #0d0d0d;
  --toast-bg: rgba(24, 24, 26, 0.94);
  --toast-text: #f4f4f5;
  --toast-muted: #a1a1aa;
  --toast-border: rgba(255, 255, 255, 0.06);
  --toast-shadow: 0 4px 28px rgba(0, 0, 0, 0.45);
  --toast-accent-success: #4ade80;
  --toast-accent-error: #f87171;
  --toast-accent-info: #93c5fd;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.4s ease, color 0.4s ease;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 2.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background-color: rgba(250, 250, 250, 0.95);
}

[data-theme="dark"] .header {
  background-color: rgba(13, 13, 13, 0.95);
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -1px;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.logo span {
  color: var(--accent-secondary);
  font-weight: 300;
  letter-spacing: 0.5px;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  line-height: 1;
}

.site-logo-text {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.site-logo-dot {
  color: var(--accent-color);
  font-weight: 800;
}

.site-logo-suffix {
  color: var(--accent-color);
  font-weight: 700;
}

/* Search bar — desktop only */
.search-bar--desktop-only {
  flex: 1;
  max-width: 450px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar--desktop-only input {
  width: 100%;
  padding: 1rem 3.5rem 1rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
  font-weight: 400;
}

.search-bar--desktop-only input::placeholder {
  color: var(--text-tertiary);
}

.search-bar--desktop-only input:focus {
  border-color: var(--accent-color);
  background-color: var(--bg-primary);
}

.search-bar--desktop-only .search-icon {
  position: absolute;
  right: 1.25rem;
  color: var(--text-tertiary);
  transition: color 0.3s ease;
  pointer-events: none;
}

.search-bar--desktop-only input:focus + .search-icon {
  color: var(--accent-color);
}

@media (max-width: 768px) {
  .search-bar--desktop-only {
    display: none !important;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-middle {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.header-link {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.3s ease;
  letter-spacing: 0.5px;
}

.header-link--icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.15rem;
}

.header-link-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.header-link:hover {
  color: var(--accent-secondary);
}

.header-auth-link--hidden {
  display: none !important;
}

.header-cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding-right: 0.65rem;
  margin-right: 0.15rem;
}

.cart-count-badge {
  position: absolute;
  top: -0.45rem;
  right: -0.15rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
  color: #ffffff;
  background-color: var(--error);
  border-radius: 999px;
  border: 2px solid var(--bg-primary);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 2;
}

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 0.625rem 1rem;
  z-index: 200;
  box-sizing: border-box;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.7rem;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
  text-align: center;
}

.bottom-nav-item:hover {
  color: var(--text-primary);
}

.bottom-nav-item.is-active {
  color: var(--text-primary);
}

.bottom-nav-item.is-active svg {
  fill: var(--text-primary);
  stroke: var(--text-primary);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.bottom-nav-item--support {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.bottom-nav-item--support:hover {
  color: var(--text-primary);
}

.bottom-nav-item--cart {
  position: relative;
}

.cart-count-badge--bottom {
  top: -0.15rem;
  right: auto;
  left: 50%;
  transform: translate(14px, -50%);
}

.theme-toggle,
.admin-theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.theme-toggle:hover,
.admin-theme-toggle:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--accent-color);
}

.sun-icon, .moon-icon {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sun-icon {
  display: block;
}

.moon-icon {
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: none;
}

[data-theme="dark"] .moon-icon {
  display: block;
}

.footer {
  margin-top: auto;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.site-footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 3rem 2rem 1.5rem;
}

.site-footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 2.5rem;
}

.site-footer-brand .site-logo-text {
  font-size: 1.4rem;
  display: inline-block;
  margin-bottom: 0.65rem;
}

.site-footer-tagline {
  font-size: 0.82rem;
  line-height: 1.55;
  max-width: 320px;
  color: var(--text-tertiary);
  margin: 0;
}

.site-footer-col {
  display: flex;
  flex-direction: column;
  padding-top: 0.3rem;
}

.site-footer-col h3 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 0.85rem;
}

.site-footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.site-footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

.site-footer-bottom {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

@media (min-width: 769px) {
  .header-container {
    flex-wrap: nowrap;
  }

  .header-middle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.25rem;
    min-width: 0;
  }

  .header-middle .search-bar--desktop-only {
    flex: 1;
    max-width: 560px;
    margin-right: auto;
  }

  .header-actions {
    flex-shrink: 0;
    margin-left: 0;
  }
}

@media (min-width: 1600px) {
  .header {
    padding: 1.5rem 3rem;
  }

  .site-logo-text {
    font-size: 1.85rem;
  }

  .header-middle .search-bar--desktop-only {
    max-width: 640px;
  }

  .site-footer-inner {
    padding: 3.5rem 3rem 2rem;
  }

  .site-footer-grid {
    grid-template-columns: 1.4fr 1fr;
    gap: 3rem;
  }

  .site-footer-tagline {
    max-width: 400px;
    font-size: 0.88rem;
  }

  .site-footer-links a {
    font-size: 0.9rem;
  }
}

@media (max-width: 1024px) {
  .header-container {
    gap: 1.5rem;
  }

  .header-middle {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
  }

  .header-container {
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
  }

  .site-logo-text {
    font-size: 1.35rem;
  }

  .header-middle {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
  }

  .header-actions {
    width: auto;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .theme-toggle {
    padding: 0.5rem;
  }

  .theme-toggle svg {
    width: 17px;
    height: 17px;
  }
}

@media (max-width: 480px) {
  .site-logo-text {
    font-size: 1.2rem;
  }

  .header-actions {
    gap: 0.35rem;
  }
}

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

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.page-loader--hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.page-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.page-loader-text {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  animation: loader-pulse 1.2s ease-in-out infinite;
}

[data-theme="dark"] .page-loader-text {
  color: var(--text-primary);
}

.page-loader-dot {
  display: inline-block;
  animation: loader-dot 1.2s ease-in-out infinite;
}

.page-loader-dot:nth-child(2) { animation-delay: 0.2s; }
.page-loader-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes loader-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.97); }
}

@keyframes loader-dot {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

body.modal-open {
  overflow: hidden;
}

.toast-host {
  position: fixed;
  top: 5rem;
  right: 1rem;
  left: auto;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 2rem));
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.7rem 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--toast-border);
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: var(--toast-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.toast--show {
  opacity: 1;
  transform: translateY(0);
}

.toast--hide {
  opacity: 0;
  transform: translateY(4px);
}

.toast::before {
  content: '';
  flex-shrink: 0;
  width: 3px;
  align-self: stretch;
  min-height: 1.75rem;
  border-radius: 3px;
  background: var(--toast-accent-info);
}

.toast--success::before {
  background: var(--toast-accent-success);
}

.toast--error::before {
  background: var(--toast-accent-error);
}

.toast--info::before {
  background: var(--toast-accent-info);
}

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--toast-muted);
}

.toast--success .toast-icon {
  color: var(--toast-accent-success);
}

.toast--error .toast-icon {
  color: var(--toast-accent-error);
}

.toast--info .toast-icon {
  color: var(--toast-accent-info);
}

.toast-message {
  flex: 1;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--toast-text);
  letter-spacing: 0.01em;
}

.toast-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--toast-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.toast-close:hover {
  background: var(--bg-tertiary);
  color: var(--toast-text);
}

@media (max-width: 768px) {
  .toast-host {
    top: auto;
    bottom: 5.5rem;
    right: 0.75rem;
    left: 0.75rem;
    align-items: stretch;
    max-width: none;
  }

  .toast {
    transform: translateY(8px);
  }

  .toast--show {
    transform: translateY(0);
  }

  .toast--hide {
    transform: translateY(6px);
  }
}

@media (max-width: 900px) {
  .site-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }

  .site-footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }

  .bottom-nav-item {
    font-size: 0.62rem;
    gap: 0.2rem;
  }

  .bottom-nav-item svg {
    width: 22px;
    height: 22px;
  }

  .page-home #app,
  .page-sub #app {
    padding-bottom: 5rem;
  }

  .page-home .site-footer,
  .page-sub .site-footer {
    margin-bottom: 0;
  }

  .header-actions .header-link,
  .header-actions .header-cart-link {
    display: none !important;
  }

  .page-sub .header-actions {
    justify-content: flex-end;
  }

  .site-footer {
    width: 100%;
    overflow: hidden;
  }

  .site-footer-inner {
    padding: 2rem 1rem 1.25rem;
    width: 100%;
    box-sizing: border-box;
  }

  .site-footer-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .site-footer-brand {
    text-align: left;
    width: 100%;
    box-sizing: border-box;
  }

  .site-footer-col {
    padding: 0;
    width: 100%;
  }

  .site-footer-links {
    width: 100%;
  }

  .site-footer-links li {
    width: 100%;
  }

  .site-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    text-align: left;
    width: 100%;
    margin-top: 2rem;
  }

  .site-footer-col h3 {
    margin-bottom: 0.65rem;
  }

  .site-footer-brand .site-logo-text {
    font-size: 1.25rem;
  }

  .site-footer-tagline {
    max-width: none;
    text-align: left;
  }

  .page-home #app,
  .page-sub #app {
    padding-bottom: 5.5rem;
  }

  .page-home .site-footer,
  .page-sub .site-footer {
    margin-bottom: 0;
  }
}

/* Fərdiləşdirilə bilən məhsul badge */
.product-custom-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  line-height: 1;
}

.product-custom-badge svg {
  flex-shrink: 0;
}

.product-custom-badge--card {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
  padding: 0.45rem;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.product-custom-badge--card svg {
  width: 13px;
  height: 13px;
  color: var(--text-primary);
}

.product-custom-badge--detail {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
}

.product-custom-badge[hidden],
#productCustomBadge[hidden] {
  display: none !important;
}

/* Skeleton shimmer */
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton--circle {
  border-radius: 50%;
}

.skeleton--block {
  display: block;
  width: 100%;
}

.product-detail-skeleton[hidden],
.cart-skeleton[hidden] {
  display: none !important;
}

/* Product detail skeleton */
.product-detail-skeleton {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: start;
}

.product-detail-skeleton__image {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 16px;
}

.product-detail-skeleton__info {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.product-detail-skeleton__title {
  height: 28px;
  width: 85%;
}

.product-detail-skeleton__material {
  height: 16px;
  width: 40%;
}

.product-detail-skeleton__price {
  height: 32px;
  width: 50%;
  margin-top: 0.5rem;
}

.product-detail-skeleton__desc {
  height: 60px;
  width: 100%;
  margin-top: 0.5rem;
}

.product-detail-skeleton__btn {
  height: 48px;
  width: 100%;
  margin-top: 0.75rem;
  border-radius: 12px;
}

/* Cart skeleton */
.cart-skeleton {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.cart-skeleton__item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--bg-primary);
}

.cart-skeleton__image {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 10px;
}

.cart-skeleton__info {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cart-skeleton__name {
  height: 20px;
  width: 75%;
}

.cart-skeleton__meta {
  height: 14px;
  width: 50%;
}

.cart-skeleton__price {
  height: 22px;
  width: 35%;
}

.cart-skeleton__qty {
  height: 36px;
  width: 100px;
  border-radius: 8px;
  margin-top: 0.25rem;
}

.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;
}
