/* Kidsstore Premium Mobile-First Design System */

:root {
  /* Brand Colors from Electro Theme */
  --color-primary: #f0748d; 
  --color-primary-dark: #dd6b82;
  --color-primary-light: #fbe3e8;
  
  /* Neutral Colors */
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-text-main: #32373c;
  --color-text-muted: #7f8c8d;
  --color-border: #e8ecef;
  --color-danger: #e74c3c;
  
  /* Typography */
  --font-family: 'Noto Sans Georgian', sans-serif;
  
  /* Layout Constants */
  --header-height: 60px;
  --bottom-nav-height: calc(65px + env(safe-area-inset-bottom));
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  --shadow-sm: 0 2px 10px rgba(0,0,0,0.03);
  --shadow-md: 0 8px 30px rgba(240, 116, 141, 0.12);
  --transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.5;
  overflow-x: hidden;
  /* Facebook In-App Browser optimization: prevent overscroll */
  overscroll-behavior-y: none;
}

/* Mobile App Container */
.app-container {
  max-width: 500px;
  margin: 0 auto;
  background: var(--color-bg);
  min-height: 100vh;
  position: relative;
  padding-top: calc(var(--header-height) + 16px);
  padding-bottom: calc(var(--bottom-nav-height) + 24px);
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* Premium Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: var(--shadow-sm);
  z-index: 100;
}

.logo {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.5px;
}
.logo span {
  color: var(--color-text-main);
}

.header-actions button {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  cursor: pointer;
}
.header-actions button:active {
  transform: scale(0.95);
  background: var(--color-primary);
  color: white;
}

/* Search Bar (Live Search UI) */
.search-wrapper {
  padding: 0 16px;
  margin-bottom: 20px;
  position: relative;
  z-index: 90;
}

.search-input-container {
  position: relative;
  width: 100%;
}

.search-input-container i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 1rem;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text-main);
  outline: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

/* Categories / Action Bar */
.categories-bar {
  display: flex;
  padding: 0 16px;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 20px;
}
.categories-bar::-webkit-scrollbar { display: none; }

.category-chip {
  padding: 10px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.category-chip.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 0 16px;
}

.product-card {
  background: var(--color-surface);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  border: 1px solid transparent;
}
.product-card:active {
  transform: scale(0.98);
  border-color: var(--color-primary-light);
}

.product-image {
  position: relative;
  padding-top: 110%;
  background: #fff;
}
.product-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discount-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--color-danger);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  z-index: 2;
}

.product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.8em;
}

.price-container {
  margin-top: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.price-current {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--color-primary);
}

.price-regular {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.btn-add-cart {
  width: 100%;
  padding: 10px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  border: none;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.btn-add-cart i { font-size: 1rem; }

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

/* Filter Popup (Modal) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--color-surface);
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  border-radius: 24px 24px 0 0;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-text-main);
}
.modal-close {
  background: var(--color-bg);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--color-text-muted);
  border: none;
  cursor: pointer;
}

/* WCPF-style Filters inside Modal */
.filter-section {
  margin-bottom: 24px;
}
.filter-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--color-text-main);
}

/* Box List Filter (Sizes/Ages) */
.box-list-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.box-option {
  padding: 8px 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-main);
  transition: var(--transition);
  cursor: pointer;
}
.box-option.selected {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

/* Color List Filter */
.color-list-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.color-option {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.color-option.selected {
  border-color: var(--color-primary);
  transform: scale(1.1);
}
.color-option.selected::after {
  content: '\\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.8rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Filter Actions */
.filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 30px;
}
.btn-outline {
  padding: 14px;
  background: var(--color-bg);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  font-weight: 700;
  border-radius: var(--border-radius-md);
  font-size: 1rem;
  cursor: pointer;
}
.btn-solid {
  padding: 14px;
  background: var(--color-primary);
  color: white;
  border: none;
  font-weight: 700;
  border-radius: var(--border-radius-md);
  font-size: 1rem;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 15px rgba(0,0,0,0.03);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--color-border);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  padding: 8px 12px;
  border-radius: var(--border-radius-md);
}
.nav-item:active {
  background: var(--color-bg);
}
.nav-item.active {
  color: var(--color-primary);
}
.nav-item i {
  font-size: 1.3rem;
  margin-bottom: 2px;
}
.nav-item-wrapper {
  position: relative;
}
.nav-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  background: var(--color-primary);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 12px;
  font-weight: 800;
  border: 2px solid white;
}

.hidden { display: none !important; }
