/* CSS Custom Properties for Responsive Design */
:root {
  /* Breakpoints */
  --bp-small: 480px;
  --bp-tablet: 768px;
  --bp-desktop: 1024px;
  --bp-large: 1280px;

  /* Spacing scale */
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 40px;
  --space-3xl: 50px;

  /* Touch targets */
  --touch-min: 48px;

  /* Container widths */
  --container-max: 1400px;
}

* {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -moz-font-smoothing: antialiased;
  -ms-font-smoothing: antialiased;
  -o-font-smoothing: antialiased;
  font-smoothing: antialiased;
}
ul {
  margin: 0;
  padding: 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Intro", sans-serif;
}
body,
p,
div,
span {
  font-family: "Signika", sans-serif;
}
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
body > div {
  text-align: center;
}

body > div .ng-scope {
  text-align: left;
}
h2 {
  font-family: "Signika", sans-serif;
  font-size: 0.8em;
  color: #b4b4b4;
  font-weight: 200;
  text-transform: uppercase;
  border-bottom: 1px solid #b4b4b4;
  margin-right: 0;
  margin-bottom: 20px;
}

/* Utility Classes - Tailwind-like */
.flex { display: flex !important; }
.flex-col { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.flex-wrap { flex-wrap: wrap !important; }

.gap-1 { gap: 0.3125rem !important; } /* 5px */
.gap-2 { gap: 0.625rem !important; } /* 10px */
.gap-3 { gap: 0.9375rem !important; } /* 15px */
.gap-4 { gap: 1.25rem !important; } /* 20px */
.gap-5 { gap: 1.5625rem !important; } /* 25px */
.gap-6 { gap: 1.875rem !important; } /* 30px */

.items-start { align-items: flex-start !important; }
.items-center { align-items: center !important; }
.items-end { align-items: flex-end !important; }
.items-stretch { align-items: stretch !important; }

.justify-start { justify-content: flex-start !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.justify-between { justify-content: space-between !important; }

.flex-1 { flex: 1 !important; }
.flex-none { flex: none !important; }

.relative { position: relative !important; }
.absolute { position: absolute !important; }

.w-full { width: 100% !important; }
.h-full { height: 100% !important; }

.overflow-hidden { overflow: hidden !important; }
.overflow-visible { overflow: visible !important; }

.row {
  margin: 0 !important;
  overflow: visible;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.col {
  float: none !important;
}

body .container {
  margin: auto;
}
.hidden {
  display: none;
}
.visible {
  display: block;
}
#frame-selector,
#preview,
#final-price {
  width: 100%;
  min-height: 300px;
  position: relative;
}

#details-selector {
  width: 100%;
  min-height: 300px;
}

.frame-models ul li {
  display: block;
  border: 2px solid black;
  font-size: 0.8em;
  padding: 3px 4px 2px 4px;
  cursor: pointer;
  font-family: "Intro", sans-serif;
  flex-grow: 0;
}
.frame-models ul li.selected {
  background: black;
  color: white;
}

/* Category buttons with horizontal scroll */
.category-buttons {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Hide scrollbar Firefox */
}

.category-buttons::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

.category-buttons li {
  flex-shrink: 0;
  scroll-snap-align: start;
  min-width: 140px;
  padding: var(--space-md) var(--space-lg) !important;
}

/* iPad and larger - center category buttons */
@media (min-width: 768px) {
  .category-buttons {
    justify-content: center;
    overflow-x: visible;
    flex-wrap: wrap !important;
  }

  /* Ensure buttons are properly centered on iPad Air */
  .frame-models {
    display: flex;
    justify-content: center;
  }

  .category-buttons li {
    min-width: auto; /* Allow natural button sizing */
  }
}
/* Frame carousel with CSS Grid and native scroll */
.frame-carousel {
  position: relative;
  width: 100%;
  min-height: 230px;
}

.frame-carousel .holder {
  position: relative;
  padding: 0 var(--space-lg);
}

.frame-carousel .frame-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: auto;
  gap: var(--space-sm);
  overflow-x: auto;
  scroll-snap-type: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-md) 0;
  scrollbar-width: thin;
  list-style: none;
  margin: 0;
}

.frame-carousel .frame-list li {
  border: none;
  padding: 3px 4px 2px 4px;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.2s ease;
}

.frame-carousel .frame-list li:active {
  transform: scale(0.95);
}

.frame-carousel .frame-list li img {
  height: 235px;
}

/* Arrow buttons */
.frame-carousel #left-arrow,
.frame-carousel #right-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  border: none;
  color: white;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.frame-carousel #left-arrow:hover,
.frame-carousel #right-arrow:hover {
  background: rgba(0, 0, 0, 0.7);
}

.frame-carousel #left-arrow {
  left: var(--space-sm);
}

.frame-carousel #right-arrow {
  right: var(--space-sm);
}
div#details-selector {
  margin-top: 50px;
  display: flex;
  flex-direction: column;
}
div#final-price > div {
  font-family: 'Signika', sans-serif;
  font-weight: 200;
}
div#final-price button {
  font-family: 'Signika', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: white;
  background: black;
  border: 0;
  padding: 10px;
  width: 200px;
  margin-top: 17px;
  cursor: pointer;
  height: 45px;
  float: right;
}
div#final-price button i {
  float: right;
  font-size: 1.2em;
}
div#final-price > div span#final-price {
  font-size: 3.2em;
}
div#final-price > div span#frame-currency-symbol {
  font-size: 2em;
}
div#preview {
  position: relative;
}
div#preview h2 > i {
  color: #000;
  cursor: pointer;
  margin-left: 10px;
}
div#preview h2 div#photo-helper.translucent {
  opacity: 1;
  left: 160px;
  top: -20px;
}
div#preview h2 div#photo-helper h3 {
  font-size: 0.9em;
}
div#preview h2 div#photo-helper {
  font-family: 'Signika', sans-serif;
  font-weight: 700;
  text-transform: none;
  text-align: center;
  font-size: 0.9em;
  background: #000;
  color: #fff;
  padding: 10px;
  width: 250px;
  -webkit-transition: 0.5s;
  -moz-transition: 0.5s;
  -ms-transition: 0.5s;
  -o-transition: 0.5s;
  transition: 0.5s;
  position: absolute;
  left: 160px;
  top: -200px;
  opacity: 0;
  z-index: 99999;
}
div#preview div#preview-holder {
  padding: 50px;
}
div#preview div#details {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
div#preview div#details div {
  flex: 1 1 45%;
  display: block;
}
div#preview div#details div#dimensions {
  width: 100%;
  text-align: left;
  flex: 0 0 100%;
}
div#preview div#details div#description {
  font-family: 'Signika';
  font-weight: 200;
  font-size: 12px;
}
div#preview div#details div#profile {
  text-align: right;
  vertical-align: middle;
}
div#preview div#details div#profile small {
  display: block;
  font-size: 0.7em;
}
div#preview div#frame-preview {
  width: 100%;
  max-width: 400px;
  height: auto;
  aspect-ratio: 1;
  position: relative;
  margin: auto;
  background: white;
  -webkit-transition: 0.5s;
  -moz-transition: 0.5s;
  -ms-transition: 0.5s;
  -o-transition: 0.5s;
  transition: 0.5s;
  box-shadow: 5px 5px 20px 30px #aaa;
}
div#preview div#frame-preview div#c-lt,
div#preview div#frame-preview div#c-rt,
div#preview div#frame-preview div#c-lb,
div#preview div#frame-preview div#c-rb,
div#preview div#frame-preview div#top,
div#preview div#frame-preview div#left,
div#preview div#frame-preview div#right,
div#preview div#frame-preview div#bottom {
  position: absolute;
  display: block;
  background-position: top left;
  -webkit-transition: 0.5s;
  -moz-transition: 0.5s;
  -ms-transition: 0.5s;
  -o-transition: 0.5s;
  transition: 0.5s;
}
div#preview div#frame-preview div#frame-name {
  position: relative;
  margin: auto;
  width: 100px;
  line-height: 400px;
  text-align: center;
}
div#preview div#frame-preview div#photo-upload {
  background: #e5e5e5;
  position: absolute;
  display: block;
  text-align: center;
  cursor: pointer;
  -webkit-transition: 0.5s;
  -moz-transition: 0.5s;
  -ms-transition: 0.5s;
  -o-transition: 0.5s;
  transition: 0.5s;
  overflow: hidden;
}
div#preview div#frame-preview div#photo-upload.translucent {
  background: #777;
}
div#preview div#frame-preview div#photo-upload div {
  line-height: 100%;
}
div#preview div#frame-preview div#photo-upload img {
  width: 100%;
}
div#preview div#frame-preview div#photo-upload div h3,
#send-a-photo-helper h3 {
  display: block;
  font-size: 0.8em;
  max-width: 150px;
  margin: 20px auto;
}
div#preview div#upload-helper.up-high {
  margin-right: -85px;
  opacity: 1;
}
div#preview div#upload-helper {
  font-size: 0.8em;
  background: #000;
  color: #fff;
  padding: 10px;
  max-width: 150px;
  top: 0;
  right: 50%;
  width: 150px;
  height: 80px;
  margin-right: -200px;
  opacity: 0;
  position: absolute;
  -webkit-transition: 0.2s;
  -moz-transition: 0.2s;
  -ms-transition: 0.2s;
  -o-transition: 0.2s;
  transition: 0.2s;
  text-align: center;
}
/**
 * CUSTOM COMPONENTS
 */

div.em-form-select,
div.em-form-input {
  border: 2px solid black;
  min-height: var(--touch-min);
  height: auto;
  background: white;
  color: black;
  font-family: "Intro", sans-serif;
  font-size: 1em;
  position: relative;
  box-sizing: border-box;
  margin-bottom: 10px;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: var(--space-sm) var(--space-md);
}

@media (min-width: 1024px) {
  div.em-form-select,
  div.em-form-input {
    min-height: 44px; /* Slightly smaller on desktop for density */
  }
}
div.em-form-select div,
div.em-form-input div {
  box-sizing: border-box;
  font-family: "Intro", sans-serif;
}
div.em-form-select .name,
div.em-form-input .name {
  display: flex;
  align-items: center;
  flex: 5;
  gap: 5px;
  line-height: 34px;
  padding-left: 2%;
  letter-spacing: -1px;
}
div.em-form-select .selected-option,
div.em-form-input input[type="text"] {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 3.5;
  min-width: 0;
  text-align: center;
  border: none;
  border-left: 2px solid black;
  font-family: "Signika", sans-serif;
  font-weight: 400;
  line-height: 32px;
  font-size: 1.3em;
  padding: 0;
}
div.em-form-select .options {
  display: block;
  width: 35%;
  position: absolute;
  left: 50%;
  top: 32px;
  background: black;
  color: white;
  font-family: "Signika", sans-serif;
  font-weight: 400;
  line-height: 32px;
  font-size: 1.3em;
  z-index: 99;
}
div.em-form-select .options a {
  display: block;
  width: 100%;
  text-align: center;
  color: white;
  text-decoration: none;
  font-family: "Signika", sans-serif;
  font-weight: 400;
  border: 2px solid black;
  box-sizing: border-box;
}
div.em-form-select .options a:hover {
  background: white;
  color: black;
}
div.em-form-select .selector,
div.em-form-input .sufix {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1.5;
  min-width: 40px;
  background: black;
  color: white;
  text-align: center;
  padding: 0;
  cursor: pointer;
}
div.em-form-input .sufix {
  height: 100%;
  line-height: 32px;
  cursor: default;
}
div.em-form-select .selector i {
  margin-top: -9px;
  height: 39px;
  font-size: 3em;
}
.translucid {
  opacity: 0.5;
  -webkit-filter: blur(2px);
     -moz-filter: blur(2px);
      -ms-filter: blur(2px);
       -o-filter: blur(2px);
          filter: blur(2px);
}
body > div#popOverHolder {
  position: absolute;
  background: hsla(0, 0%, 100%, 0.2);
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  text-align: center;
}
body > div#popOverHolder > .jcrop-holder {
  margin: 100px auto 0;
}
body > div#popOverHolder > .jcrop-holder > img {
  box-shadow: 0 4px 20px -2px #000;
}
.blur {
  -webkit-filter: blur(4px);
     -moz-filter: blur(4px);
      -ms-filter: blur(4px);
       -o-filter: blur(4px);
          filter: blur(4px);
}
.button {
  cursor: pointer;
}
#crop-photo {
  display: none;
  position: absolute;
  bottom: 10px;
  right: 10px;
  cursor: pointer;
}
#em-photo-upload-field:valid ~ #crop-photo {
  display: block;
}
#send-a-photo-helper {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
#em-photo-upload-field:valid + #send-a-photo-helper {
  display: none;
}
i.the-helper {
  cursor: pointer;
}
.the-helper-text {
  position: absolute;
  font-size: 0.8em;
  text-align: center;
  color: #fff;
  background: #000;
  padding: 15px;
  opacity: 0;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 5px;
  z-index: 0;
  pointer-events: none;
  -webkit-transition: 0.3s;
     -moz-transition: 0.3s;
      -ms-transition: 0.3s;
       -o-transition: 0.3s;
          transition: 0.3s;
  -webkit-transform: translateY(-10px);
     -moz-transform: translateY(-10px);
      -ms-transform: translateY(-10px);
       -o-transform: translateY(-10px);
          transform: translateY(-10px);
}
.the-helper-text.show {
  opacity: 1;
  z-index: 2;
  pointer-events: auto;
  -webkit-transform: translateY(0);
     -moz-transform: translateY(0);
      -ms-transform: translateY(0);
       -o-transform: translateY(0);
          transform: translateY(0);
}


/* Flexbox responsive layout */
.app-layout {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-3xl); /* 50px desktop */
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-xl);
}

.app-layout > .col {
  flex: 1;
  min-width: 0;
}

/* Tablet and desktop - responsive column widths */
@media screen and (min-width: 768px) {
  .app-layout > .col {
    min-width: 350px; /* Reduced from 400px for better iPad fit */
    max-width: 600px; /* Prevent overly wide columns */
  }
}

/* Larger screens - allow wider columns */
@media screen and (min-width: 1200px) {
  .app-layout > .col {
    min-width: 400px;
    max-width: 700px;
  }
}

/* Tablet - medium screens (iPad, etc.) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
  .app-layout {
    gap: var(--space-2xl); /* 40px for better breathing room */
    padding: var(--space-lg);
  }

  .container {
    margin: 0 auto;
    padding: 0 20px;
    max-width: 100%;
  }

  /* Balanced layout for frame selector */
  #frame-selector {
    margin: 0 auto;
    max-width: 700px; /* Prevent too wide on tablet */
  }

  /* Keep section headers visible but not overly centered */
  #frame-selector h2,
  #details-selector h2 {
    text-align: left;
    margin-left: 0;
    margin-right: auto;
  }

  /* Center only the interactive elements */
  .frame-models {
    display: flex;
    justify-content: center;
  }

  .frame-carousel .holder {
    padding: 0 var(--space-md);
  }

  #details-selector {
    margin: 0 auto;
    max-width: 700px;
  }
}

/* iPad Air and similar (landscape ~1024-1280px) */
@media screen and (min-width: 1025px) and (max-width: 1280px) {
  .app-layout {
    gap: var(--space-2xl); /* 40px for comfortable spacing */
    padding: var(--space-xl);
  }

  div#preview div#frame-preview {
    max-width: 380px;
  }

  div.em-form-select,
  div.em-form-input {
    font-size: 0.95em;
  }
}

/* Mobile - stacked layout */
@media screen and (max-width: 767px) {
  .app-layout {
    flex-direction: column;
    gap: var(--space-lg); /* 24px mobile */
    padding: var(--space-md);
  }

  .app-layout > .col {
    width: 100%;
    flex: none;
  }

  body {
    overflow-x: hidden;
  }

  body > div > h1 {
    margin-top: 10px;
    margin-bottom: 15px;
  }

  body > div > h1 img {
    max-width: 90%;
    height: auto;
  }

  .container {
    margin: 0 15px;
  }

  h2 {
    font-size: 1em;
    margin-bottom: 15px;
    padding-bottom: 8px;
  }

  /* Frame selector mobile */
  .frame-models ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .frame-models ul li {
    font-size: 0.85em;
    padding: 8px 12px;
  }

  .frame-carousel {
    min-height: 180px;
    margin-bottom: 20px;
  }

  .frame-carousel .holder {
    padding: 0 var(--space-md);
  }

  .frame-carousel .frame-list {
    grid-auto-columns: auto;
    scroll-snap-type: none; /* Disable snap on mobile to prevent bouncing */
    overflow-x: scroll; /* Ensure all frames are accessible */
  }

  .frame-carousel .frame-list li {
    scroll-snap-align: none; /* Remove snap points */
  }

  .frame-carousel .frame-list li img {
    height: 180px;
  }

  /* Larger touch targets for arrows on mobile */
  .frame-carousel #left-arrow,
  .frame-carousel #right-arrow {
    width: var(--touch-min);
    height: var(--touch-min);
  }

  /* Preview mobile */
  div#preview {
    margin-top: 20px;
  }

  div#preview div#preview-holder {
    padding: 15px 5px;
  }

  div#preview div#frame-preview {
    width: 100%;
    max-width: 350px;
    height: auto;
    aspect-ratio: 1;
    margin: 0 auto 20px;
  }

  div#preview div#details {
    margin-top: 20px;
    gap: 15px;
  }

  div#preview div#details div {
    flex: 1 1 100%;
    text-align: center;
  }

  div#preview div#details div#description {
    margin-bottom: 15px;
    font-size: 13px;
    line-height: 1.5;
  }

  div#preview div#details div#profile {
    text-align: center;
  }

  /* Form components mobile - more breathing room */
  div#details-selector {
    margin-top: 30px;
  }

  div.em-form-select,
  div.em-form-input {
    width: 100%;
    min-height: var(--touch-min); /* 48px for WCAG compliance */
    font-size: 0.9em;
    margin-bottom: 12px;
  }

  div.em-form-select .name,
  div.em-form-input .name {
    flex: 1 1 50%;
    font-size: 0.75em; /* Reduced from 0.9em for better fit */
    padding-left: 3%;
  }

  div.em-form-select .selected-option,
  div.em-form-input input[type="text"] {
    font-size: 1.2em;
    line-height: 40px;
  }

  /* Final price mobile */
  div#final-price {
    margin-top: 20px;
    padding: 15px 0;
  }

  div#final-price .row {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  div#final-price > div {
    text-align: center;
    width: 100%;
  }

  div#final-price button {
    width: 100%;
    max-width: 100%;
    float: none;
    margin-top: 15px;
    font-size: 18px;
    height: 50px;
    padding: 12px;
  }

  div#final-price > div span#final-price {
    font-size: 2.8em;
  }

  div#final-price > div span#frame-currency-symbol {
    font-size: 1.8em;
  }

  /* Helper text mobile */
  .the-helper-text {
    font-size: 0.8em;
    padding: 12px;
  }

  /* Tooltip improvements */
  div#preview h2 div#photo-helper {
    width: 200px;
    font-size: 0.85em;
    left: 50%;
    transform: translateX(-50%);
  }

  div#preview h2 div#photo-helper.translucent {
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Small mobile - extra compact */
@media screen and (max-width: 480px) {
  .app-layout {
    gap: var(--space-md); /* 16px small mobile */
    padding: var(--space-sm);
  }

  .app-layout > .col {
    min-width: 100%;
  }

  .container {
    margin: 0 10px;
  }

  h2 {
    font-size: 0.95em;
    margin-bottom: 12px;
  }

  .frame-carousel {
    min-height: 160px;
  }

  .frame-carousel .frame-list li img {
    height: 160px;
  }

  /* Hide arrows on very small screens, rely on touch scroll */
  .frame-carousel #left-arrow,
  .frame-carousel #right-arrow {
    display: none;
  }

  .frame-models ul li {
    font-size: 0.8em;
    padding: 6px 10px;
  }

  div#preview div#frame-preview {
    max-width: 100%;
    max-height: 320px;
  }

  div.em-form-select,
  div.em-form-input {
    min-height: var(--touch-min); /* 48px minimum */
  }

  div.em-form-select .name,
  div.em-form-input .name {
    font-size: 0.7em; /* Reduced from 0.8em for smaller screens */
    letter-spacing: -0.5px;
  }

  div.em-form-select .selected-option,
  div.em-form-input input[type="text"] {
    font-size: 1.1em;
  }

  div#final-price > div span#final-price {
    font-size: 2.4em;
  }

  div#final-price button {
    font-size: 16px;
    height: 48px;
  }
}
