/* ============================================
   Kengmakon Designer App — Global Styles
   ============================================ */

:root {
  /* Colors */
  --bg-primary: #0b1026;
  --bg-secondary: #141a3a;
  --bg-input: #1a2148;
  --text-primary: #ffffff;
  --text-secondary: #8b92b0;
  --text-placeholder: #4a5278;
  --accent: #ffffff;
  --accent-hover: #e8e8e8;
  --border-color: #252d54;
  --gradient-top: #161d42;
  --gradient-bottom: #0b1026;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display',
    'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Spacing */
  --phone-width: 393px;
  --phone-height: 852px;
  --phone-radius: 55px;
  --bg-card: #161d42;
  --bg-nav: #0d1230;
  --nav-height: 64px;
  --safe-area-top: 59px;
  --safe-area-bottom: 34px;
}

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

body {
  font-family: var(--font-family);
  background: #1a1a2e;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   iPhone 16 Pro Frame
   ============================================ */

.phone-frame {
  position: relative;
  width: var(--phone-width);
  height: var(--phone-height);
  border-radius: var(--phone-radius);
  background: #000;
  padding: 8px;
  box-shadow:
    0 0 0 2px #2a2a3e,
    0 0 0 4px #1a1a2e,
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(59, 65, 120, 0.15);
}

.phone-frame__screen {
  width: 100%;
  height: 100%;
  border-radius: 47px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, var(--gradient-top) 0%, var(--gradient-bottom) 100%);
}

/* Status bar */
.phone-frame__status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px 0;
  height: var(--safe-area-top);
  position: relative;
  z-index: 10;
}

.phone-frame__time {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

.phone-frame__notch {
  width: 126px;
  height: 36px;
  background: #000;
  border-radius: 20px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.phone-frame__indicators {
  display: flex;
  align-items: center;
  gap: 6px;
}

.phone-frame__indicators svg {
  fill: var(--text-primary);
}

/* Home indicator */
.phone-frame__home-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  z-index: 10;
}

/* ============================================
   Screen Content — Scrollable Area
   ============================================ */

.screen-content {
  height: calc(100% - var(--safe-area-top) - var(--safe-area-bottom));
  overflow-y: auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
}

.screen-content::-webkit-scrollbar {
  display: none;
}

/* ============================================
   Login Page
   ============================================ */

.login {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

/* Logo */
.login__logo-wrapper {
  margin-top: 32px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.login__logo {
  width: 160px;
  height: auto;
}

/* Brand text */
.login__brand {
  text-align: center;
  margin-bottom: 36px;
}

.login__brand-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 6px;
  text-transform: uppercase;
}

.login__brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 5px;
  margin-top: 6px;
}

/* Heading */
.login__heading {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 32px;
  text-align: center;
}

/* Form */
.login__form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.login__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding-left: 4px;
}

.login__input {
  width: 100%;
  height: 52px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0 18px;
  font-size: 15px;
  color: var(--text-primary);
  font-family: var(--font-family);
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.login__input::placeholder {
  color: var(--text-placeholder);
}

.login__input:focus {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

/* Password field with toggle */
.login__input-wrapper {
  position: relative;
}

.login__input-wrapper .login__input {
  padding-right: 50px;
}

.login__password-toggle {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login__password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease;
}

.login__password-toggle:hover svg {
  stroke: var(--text-primary);
}

/* Submit button */
.login__actions {
  margin-top: auto;
  padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.login__submit {
  width: 100%;
  height: 54px;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  letter-spacing: 0.5px;
}

.login__submit:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.15);
}

.login__submit:active {
  transform: scale(0.98);
}

/* ============================================
   Bottom Navigation
   ============================================ */

.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-area-bottom));
  padding-bottom: var(--safe-area-bottom);
  background: var(--bg-nav);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 20;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.bottom-nav__item svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease;
}

.bottom-nav__item span {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.bottom-nav__item--active svg {
  stroke: var(--text-primary);
}

.bottom-nav__item--active span {
  color: var(--text-primary);
}

/* ============================================
   Screen Content with Bottom Nav
   ============================================ */

.screen-content--has-nav {
  height: calc(100% - var(--safe-area-top) - var(--nav-height) - var(--safe-area-bottom));
  padding: 0;
}

/* ============================================
   Catalog Page
   ============================================ */

/* Search bar */
.search-bar {
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, var(--gradient-top) 0%, transparent 100%);
}

.search-bar__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 0 14px;
}

.search-bar__inner svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.search-bar__input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-family);
}

.search-bar__input::placeholder {
  color: var(--text-placeholder);
}

/* Section */
.catalog-section {
  margin-bottom: 24px;
}

.catalog-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  margin-bottom: 14px;
}

.catalog-section__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.catalog-section__link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.catalog-section__link:hover {
  color: var(--text-primary);
}

/* Collections — horizontal scroll */
.collections {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 0 20px 4px;
  scroll-snap-type: x mandatory;
}

.collections::-webkit-scrollbar {
  display: none;
}

.collection-card {
  flex-shrink: 0;
  width: 200px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  scroll-snap-align: start;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.collection-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.collection-card__image {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: var(--bg-input);
}

.collection-card__body {
  padding: 12px 14px;
}

.collection-card__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.collection-card__meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.collection-card__style {
  font-size: 11px;
  color: var(--text-placeholder);
  margin-top: 2px;
}

/* Categories */
.categories {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 20px;
}

.categories::-webkit-scrollbar {
  display: none;
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
  min-width: 72px;
}

.category-item__icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.category-item:hover .category-item__icon {
  background: var(--bg-input);
  border-color: rgba(255, 255, 255, 0.15);
}

.category-item__icon svg {
  width: 26px;
  height: 26px;
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-item__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px;
}

.product-card {
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.product-card__image {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  background: var(--bg-input);
}

.product-card__body {
  padding: 10px 12px;
}

.product-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card__price {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.product-card__category {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============================================
   Filter Tabs (icon-based)
   ============================================ */

.filter-tabs {
  display: flex;
  gap: 14px;
  padding: 14px 20px;
  margin-bottom: 8px;
  overflow-x: auto;
  min-height: 100px;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.category-item--active .category-item__icon {
  border-color: var(--text-primary);
  border-width: 2px;
}

.category-item--active .category-item__label {
  color: var(--text-primary);
  font-weight: 600;
}

/* ============================================
   Discount Card (extends product-card)
   ============================================ */

.product-card__image-wrapper {
  position: relative;
}

.product-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  background: #e04355;
}

.product-card__old-price {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: line-through;
  margin-bottom: 2px;
}

/* ============================================
   Mobile — full screen, no frame
   ============================================ */

@media (max-width: 430px) {
  body {
    background: var(--bg-primary);
    min-height: 100dvh;
  }

  .phone-frame {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    background: none;
  }

  .phone-frame__screen {
    border-radius: 0;
  }

  .phone-frame__notch,
  .phone-frame__status-bar {
    display: none;
  }

  .phone-frame__home-indicator {
    display: none;
  }

  .screen-content {
    height: 100%;
    padding-top: 12px;
  }

  .screen-content--has-nav {
    height: calc(100% - var(--nav-height));
    padding-bottom: 0;
  }

  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

