/* Global Variables */
:root {
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --primary-color: #007aff;
  --text-color: #1d1d1f;
  --secondary-text: #86868b;
  --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --card-radius: 24px;
  --transition-speed: 0.3s;
  --ios-easing: cubic-bezier(0.4, 0, 0.2, 1);
  --ios-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ios-switch-width: 51px;
  --ios-switch-height: 31px;
}

/* Body & Layout */
body {
  margin: 0;
  background: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 0;
  padding-bottom: 110px;
  color: var(--text-color);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
  overflow-x: hidden;
}

.page {
  transition: opacity 0.4s var(--ios-easing), transform 0.4s var(--ios-easing);
  will-change: opacity, transform;
}

/* Liquid Glass Card */
.card,
.remont-card,
#remont .remont-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--card-radius);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.1),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.5);
  padding: 24px;
  max-width: 600px;
  margin: 20px auto;
  animation: floatIn 0.8s var(--ios-easing);
  transition: transform 0.3s var(--ios-spring), box-shadow 0.3s var(--ios-easing), background 0.3s var(--ios-easing);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12);
}

/* Global Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Typography */
h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #000;
  margin-top: 0;
}

/* Static Bottom Navigation (Instagram Style) */
/* Floating Bottom Navigation (Monobank Style) */
.bottom-nav {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 400px;
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 32px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
  z-index: 2000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  overflow: hidden;
  /* Fixes corner issues */
}

/* Hide scrollbar but keep functionality */
.bottom-nav::-webkit-scrollbar {
  display: none;
}

.bottom-nav {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Hide labels */
.nav-item span {
  display: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  scroll-snap-align: start;
  position: relative;
}

/* Dot indicator removed */

.nav-item:active {
  transform: scale(0.9);
}

.nav-item i {
  font-size: 20px;
  color: #8e8e93;
  transition: all 0.4s var(--ios-spring);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  position: relative;
  z-index: 2;
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 44px;
  height: 44px;
  background: #ff3b30;
  border-radius: 50%;
  opacity: 0;
  transition: all 0.4s var(--ios-spring);
  z-index: 1;
}

.nav-item.active i {
  color: #fff;
}

.nav-item.active::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.nav-item span {
  display: none;
}

/* Apple Trade In Styles */
.apple-tradein-wrapper {
  width: 100%;
  max-width: 980px;
  margin: 20px auto;
  padding: 0 16px;
}

.tradein-header {
  text-align: center;
  margin-bottom: 24px;
  animation: floatIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tradein-header h1 {
  font-size: 32px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 8px 0;
  color: #1d1d1f;
}

.tradein-header .subtitle {
  font-size: 16px;
  line-height: 1.4;
  font-weight: 400;
  color: #1d1d1f;
  max-width: 600px;
  margin: 0 auto;
}

/* Series Card */
.series {
  background: #fff;
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01), 0 6px 12px rgba(0, 0, 0, 0.04);
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: transform 0.3s var(--ios-spring), box-shadow 0.3s var(--ios-easing), background 0.3s var(--ios-easing);
  position: relative;
  z-index: 1;
}

.series:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.03), 0 10px 20px rgba(0, 0, 0, 0.08);
  z-index: 2;
}

.series-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.series-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.series-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.series-title {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
}

.series-subtitle {
  font-size: 14px;
  color: #86868b;
  font-weight: 400;
}

.series i {
  font-size: 16px;
  color: #0071e3;
  /* Apple Blue */
  transition: transform 0.3s ease;
}

.series.expanded i.fa-chevron-down {
  transform: rotate(180deg);
}

/* Sub Models Container */
.sub-models {
  display: none;
  margin-top: -20px;
  /* Pull up to connect visually or just sit below */
  margin-bottom: 24px;
  padding-top: 12px;
  /* Space for the overlap */
  animation: slideDown 0.5s var(--ios-spring);
}

/* Model Item */
.model {
  background: #fff;
  padding: 14px 20px;
  border-bottom: 1px solid #e5e5e5;
  font-size: 16px;
  font-weight: 500;
  color: #1d1d1f;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s ease;
  margin: 0 auto;
  max-width: 960px;
  /* Slightly narrower than series card */
}

.model:first-child {
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  margin-top: 8px;
}

.model:last-child {
  border-bottom: none;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

.model:hover {
  background: #f5f5f7;
}

.model i {
  color: #86868b;
  font-size: 14px;
  transition: transform 0.3s ease;
}

.model.expanded i.fa-chevron-down {
  transform: rotate(180deg);
}

.sub-models {
  display: none;
  background: #fff;
  animation: slideDown 0.3s ease;
}

.details {
  display: none;
  padding: 12px;
  background: #f5f5f7;
  font-size: 14px;
  animation: fadeIn 0.3s ease;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* When details are shown, use grid layout */
.details[style*="display: block"],
.details[style*="display: grid"] {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.details>.price-row {
  grid-column: 1 / -1;
  width: 100%;
}

/* Fix for Pencil Block Visibility */
#pencil .details {
  display: block;
  margin-bottom: 12px;
  padding: 16px;
  background: rgba(240, 242, 245, 0.6);
  border-radius: 16px;
  border: none;
}

.price-row {
  width: 100%;
  /* Force full width */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  margin-bottom: 2px;
}

.price-row:last-of-type {
  border-bottom: none;
  margin-bottom: 6px;
}

.price-row span:last-child {
  font-weight: 400;
  color: #3a3a3c;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Inputs & Buttons */
input[type="number"],
select {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  transition: all 0.3s var(--ios-easing);
  box-sizing: border-box;
  margin-bottom: 16px;
  appearance: none;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.button-group button {
  flex: 1 1 auto;
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--primary-color);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s var(--ios-spring);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.button-group button:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.button-group button.active {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* Tables (Remont & AirPods) */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 10px;
}

th {
  text-align: left;
  padding: 12px 16px;
  color: var(--secondary-text);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

td {
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 16px;
  color: var(--text-color);
}

tr:last-child td {
  border-bottom: none;
}

tr {
  transition: background 0.2s var(--ios-easing);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.3);
}

/* Animations */
@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Defects Styling */
/* Defects Styling for Grid */
.defect,
.defect2,
.defect3,
.defect4,
.defect5 {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 12px;
  background: #fff;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: #1d1d1f;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  line-height: 1.2;
  position: relative;
  overflow: hidden;
}

/* Center last defect if odd number */
.defect5:last-child {
  grid-column: 1 / -1;
  width: 50%;
  justify-self: center;
}

.d-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
  /* Take remaining space */
}

.d-label {
  font-size: 11px;
  color: #86868b;
  font-weight: 500;
}

.d-price {
  font-size: 13px;
  color: #1d1d1f;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Icons for Defects */
.defect::before,
.defect2::before,
.defect3::before,
.defect4::before,
.defect5::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 18px;
  /* Larger icon */
  margin-bottom: 0;
  margin-right: 0;
  /* Gap handled by flex gap */
  display: block;
  flex-shrink: 0;
}

/* Battery */
.defect::before {
  content: "\f242";
  color: #ff9500;
}

/* Camera/Dust */
.defect2::before {
  content: "\f030";
  color: #8e8e93;
}

/* Buyout/Money */
.defect3::before {
  content: "\f53a";
  color: #34c759;
}

/* Screen/Display */
.defect4::before {
  content: "\f3fa";
  color: #007aff;
}

/* Scratches/Damage */
.defect5::before {
  content: "\f0ad";
  color: #ff3b30;
}

/* Hide the old colored dots if they exist */
.defect::after,
.defect2::after,
.defect3::after,
.defect4::after,
.defect5::after {
  display: none;
}

/* Orange */

.price-highlight {
  color: #1d1d1f;
  font-weight: 600;
}

.memory-highlight {
  color: #0071e3;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid rgba(0, 113, 227, 0.2);
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 113, 227, 0.05);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Verification Block Styling (iOS Settings Style) */
#iphone_check .card {
  padding: 16px;
}

#iphone_check ul {
  list-style: none;
  padding: 0;
  margin: 0;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  overflow: hidden;
}

#iphone_check li {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background 0.2s;
}

#iphone_check li:last-child {
  border-bottom: none;
}

#iphone_check li:hover {
  background: rgba(255, 255, 255, 0.4);
}

#iphone_check label {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.3;
}

/* iOS Switch Style Checkbox */
#iphone_check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: var(--ios-switch-width);
  height: var(--ios-switch-height);
  background: #e9e9ea;
  border-radius: 30px;
  position: relative;
  cursor: pointer;
  outline: none;
  margin-right: 10px;
  flex-shrink: 0;
  transition: background 0.3s;
  transform: scale(0.8);
  transform-origin: left center;
  border: none;
  /* Remove default border from input[type=number] rule overlap */
  padding: 0;
  /* Reset padding */
  margin-bottom: 0;
  /* Reset margin */
}

#iphone_check input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

#iphone_check input[type="checkbox"]:checked {
  background: #34c759;
}

#iphone_check input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

/* Responsive */
@media (max-width: 600px) {
  .card {
    margin: 10px;
    padding: 20px;
    border-radius: 20px;
  }

  .liquid-bottom-nav {
    width: 90%;
    bottom: 20px;
    padding: 10px;
  }

  h2 {
    font-size: 24px;
  }

  /* Adjust table font size for mobile */
  td,
  th {
    padding: 12px 10px;
    font-size: 14px;
  }

  /* Adjust switch size slightly for mobile if needed, but standard is good for touch */
}

@media (max-width: 340px) {
  .nav-item span {
    font-size: 9px;
  }
}