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

html {
  height: 100%;
  overflow: hidden; /* Prevent page-level scrolling */
}

body {
  font-family: Arial, sans-serif;
  background: transparent;
  color: #333;
  height: 100vh;
  overflow: hidden; /* Prevent body scrolling */
  /* Add safe area padding for iPhone notch and status bar */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Allow scrolling for specific pages */
.homepage {
  overflow-y: auto;
  height: 100vh;
}

.admin-dashboard {
  overflow-y: auto;
  height: 100vh;
}

/* Fraunces font classes */
.fraunces-title {
  font-family: "Fraunces", serif;
  font-optical-sizing: auto;
  font-weight: 700;
  font-style: normal;
  font-variation-settings:
    "SOFT" 0,
    "WONK" 0;
}

.fraunces-subtitle {
  font-family: "Fraunces", serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-style: normal;
  font-variation-settings:
    "SOFT" 0,
    "WONK" 0;
}

.fraunces-heading {
  font-family: "Fraunces", serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-style: normal;
  font-variation-settings:
    "SOFT" 0,
    "WONK" 0;
}

/* Crop Modal Styles */
.crop-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: none;
  z-index: 1000;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  padding-left: calc(20px + env(safe-area-inset-left));
  padding-right: calc(20px + env(safe-area-inset-right));
}

.crop-modal.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.crop-container {
  position: relative;
  max-width: 90%;
  max-height: 80%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crop-image {
  max-width: 100%;
  max-height: 70vh;
  display: block;
}

.crop-area {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  cursor: move;
  z-index: 999;
}


.crop-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: #fff;
  border: 3px solid #333;
  border-radius: 50%;
  transition: transform 0.2s, background-color 0.2s;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.crop-handle:hover {
  transform: scale(1.3);
  background-color: #4CAF50;
}

.crop-handle.nw {
  top: -10px;
  left: -10px;
  cursor: nw-resize;
}

.crop-handle.n {
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  cursor: n-resize;
}

.crop-handle.ne {
  top: -10px;
  right: -10px;
  cursor: ne-resize;
}

.crop-handle.w {
  top: 50%;
  left: -10px;
  transform: translateY(-50%);
  cursor: w-resize;
}

.crop-handle.e {
  top: 50%;
  right: -10px;
  transform: translateY(-50%);
  cursor: e-resize;
}

.crop-handle.sw {
  bottom: -10px;
  left: -10px;
  cursor: sw-resize;
}

.crop-handle.s {
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  cursor: s-resize;
}

.crop-handle.se {
  bottom: -10px;
  right: -10px;
  cursor: se-resize;
}

.crop-buttons {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  z-index: 1001;
  position: relative;
}

.crop-button {
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.crop-button:hover {
  opacity: 0.9;
}

.crop-done {
  background-color: #4CAF50;
  color: white;
}

.crop-cancel {
  background-color: #666;
  color: white;
}

/* iOS status bar styling */
@supports (-webkit-touch-callout: none) {
  body {
    background: transparent; /* Let scrolling background show through */
  }
}

.container {
  display: flex;
  height: 100vh;
  width: 100%;
}

.preview-section {
  flex: 1;
  background-color: #4CAF50;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.customize-section {
  flex: 1;
  background-color: white;
  padding: 30px;
  overflow-y: auto;
}

.frame-preview {
  position: relative;
  display: inline-block;
  transform-origin: center;
}

.frame-container {
  position: relative;
  display: inline-block;
  overflow: hidden;
}

.image-wrapper {
  position: absolute;
  overflow: hidden;
  z-index: 3;
}

.uploaded-image {
  display: block;
  position: relative;
}

.matte-layer {
  position: absolute;
  background-color: #808080;
  z-index: 2;
}

.frame-layer {
  position: absolute;
  background-color: black;
  z-index: 1;
}

.pencil-scale {
  position: absolute;
  z-index: 10;
}

.control-group {
  margin-bottom: 25px;
}

.control-group h3 {
  margin-bottom: 10px;
  color: #333;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.slider-container label {
  min-width: 60px;
  flex-shrink: 0;
}

.slider-container:last-child {
  margin-bottom: 0;
}

.slider {
  flex: 1;
  -webkit-appearance: none;
  height: 5px;
  background: #ddd;
  outline: none;
  border-radius: 5px;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #4CAF50;
  cursor: pointer;
  border-radius: 50%;
}

.size-input {
  width: 80px;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.size-input:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 1px 3px 0 rgba(76, 175, 80, 0.15), 0 4px 6px 0 rgba(76, 175, 80, 0.15);
}

#matSize {
  width: 40px;
  text-align: center;
  display: inline-block;
}

#matSizeControl {
  margin-bottom: 10px;
}

.radio-group {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 0;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.color-option {
  width: 60px;
  height: 60px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  border-radius: 4px;
}

.color-option:hover {
  border-color: #4CAF50;
}

.color-option.selected {
  border-color: #4CAF50;
  border-width: 3px;
}

.no-matte {
  grid-column: span 4;
  text-align: center;
  color: #4CAF50;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px;
}

.matte-name {
  text-align: center;
  margin-top: 10px;
  font-weight: bold;
  color: #666;
}

.glass-option, .glazing-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.glazing-option-group {
  padding: 12px;
  border-radius: 6px;
  background-color: #f9f9f9;
  border: 1px solid #e0e0e0;
}

.glazing-option-group.clickable {
  /* No cursor pointer - appears non-interactive */
  transition: all 0.2s ease;
}

.glazing-options label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.glazing-info, .glass-info, .mat-info {
  font-size: 12px;
  color: #666;
  margin-top: 0px;
  margin-left: 25px;
  margin-bottom: 3px;
}

.price-display {
  background-color: #f0f0f0;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
}

.final-size {
  font-size: 18px;
  margin-bottom: 10px;
}

.price {
  font-size: 24px;
  font-weight: bold;
  color: #4CAF50;
}

.checkout-button {
  width: 100%;
  padding: 15px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  margin-top: 20px;
  transition: background-color 0.3s;
}

.checkout-button:hover {
  background-color: #45a049;
}

.homepage {
  min-height: 100vh;
  min-height: 100dvh; /* Use dynamic viewport height for iOS */
  background: transparent;
  padding: 20px;
  padding-bottom: calc(60px + env(safe-area-inset-bottom)); /* iOS safe area support */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(40px + env(safe-area-inset-top));
}

.homepage-container {
  max-width: 800px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin: 0 auto;
}

.homepage-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}

.homepage-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.main-card {
  text-align: center;
}

.card-header h1 {
  font-size: 36px;
  color: #333;
  margin-bottom: 10px;
  font-weight: bold;
}

.card-header h2 {
  font-size: 24px;
  color: #4CAF50;
  margin-bottom: 8px;
  font-weight: 600;
}

.card-header h3 {
  font-size: 20px;
  color: #666;
  margin-bottom: 8px;
  font-weight: 500;
}

.tagline {
  font-size: 16px;
  color: #888;
  margin-bottom: 30px;
  font-style: italic;
}

.service-highlight {
  margin-bottom: 30px;
}

.service-highlight h4 {
  font-size: 22px;
  color: #333;
  margin-bottom: 10px;
  font-weight: 600;
}

.pricing-info {
  font-size: 18px;
  color: #4CAF50;
  font-weight: 500;
  margin-bottom: 20px;
}

.upload-button {
  width: 100%;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 24px 24px;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
  margin: 0 auto;
  display: block;
}

.upload-button:hover {
  background-color: #45a049;
}

.drop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(76, 175, 80, 0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.drop-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drop-message {
  color: white;
  font-size: 48px;
  font-weight: 700;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  font-family: "Fraunces", serif;
}

.tracking-card, .about-card {
  text-align: left;
}

.tracking-card h3, .about-card h3 {
  font-size: 24px;
  color: #333;
  margin-bottom: 15px;
  font-weight: 600;
}

.tracking-card p {
  color: #666;
  margin-bottom: 20px;
  font-size: 16px;
}

.tracking-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tracking-input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.tracking-input:focus {
  outline: none;
  border-color: #4CAF50;
}

.track-button {
  padding: 12px 24px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s;
}

.track-button:hover {
  background-color: #45a049;
}

.about-content p {
  margin-bottom: 16px;
  line-height: 1.6;
  color: #555;
  font-size: 16px;
}

.about-content a {
  color: #4CAF50;
  text-decoration: none;
  font-weight: 500;
}

.about-content a:hover {
  text-decoration: underline;
}

.admin-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: #f5f5f5;
}

.login-form {
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  width: 350px;
}

.login-form h2 {
  margin-bottom: 20px;
  text-align: center;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: #666;
}

.form-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.error-message {
  color: red;
  margin-bottom: 15px;
  text-align: center;
}

.admin-dashboard {
  padding: 30px;
  background-color: #f5f5f5;
}

.order-list {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.order-item {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  display: flex;
  gap: 20px;
  align-items: center;
}

.order-thumbnail {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
}

.order-details {
  flex: 1;
}

.order-tracking {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.tracking-input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.save-tracking {
  padding: 8px 16px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.page-link {
  padding: 8px 12px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
}

.page-link.active {
  background-color: #4CAF50;
  color: white;
  border-color: #4CAF50;
}

.tracking-page {
  display: flex;
  height: 100vh;
}

.tracking-info {
  flex: 1;
  background-color: white;
  padding: 30px;
  overflow-y: auto;
}

.progress-tracker {
  margin-bottom: 40px;
}

.progress-line {
  display: table;
  width: 100%;
  table-layout: fixed;
  margin: 40px 0;
}

.progress-step {
  display: table-cell;
  text-align: center;
  vertical-align: top;
  position: relative;
  z-index: 2;
}

.progress-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e0e0e0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  margin: 0 auto;
}

.progress-circle.completed {
  background-color: #4CAF50;
}

.progress-circle.active {
  background-color: #FFA500;
}

.progress-label {
  margin-top: 10px;
  font-size: 14px;
  display: block;
}

.tracking-details {
  margin-top: 10px;
  font-size: 14px;
  color: #666;
}

.tracking-number {
  color: #333;
  font-size: 16px;
  font-weight: 500;
  margin: 20px 0;
  padding: 15px;
  background-color: #f5f5f5;
  border-radius: 8px;
  text-align: center;
}

.order-summary-container {
  margin-top: 30px;
  margin-bottom: 20px;
}

.support-hint {
  margin-top: 15px;
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

.support-hint a {
  color: #4CAF50;
  text-decoration: none;
}

.support-hint a:hover {
  text-decoration: underline;
}

.final-price-disclaimer {
  text-align: center;
  margin-bottom: 15px;
  color: #333;
  font-size: 14px;
}

.order-summary {
  background-color: #f9f9f9;
  padding: 20px;
  border-radius: 6px 6px 0 0;
  border: 1px solid #e0e0e0;
  border-bottom: none;
}

.order-summary h3 {
  margin-bottom: 15px;
}

.summary-item {
  margin-bottom: 8px;
  color: #666;
}

.pricing-details-section {
  background-color: #ebebeb;
  border-radius: 0 0 6px 6px;
  border: 1px solid #e0e0e0;
  border-top: none;
}

.pricing-toggle {
  padding: 15px 20px;
  cursor: pointer;
  user-select: none;
}

.pricing-toggle:hover {
  background-color: #e0e0e0;
}

.pricing-toggle-text {
  color: #4CAF50;
  font-weight: 500;
  font-size: 14px;
}

.pricing-details-content {
  padding: 0 20px 15px 20px;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.pricing-details-content.collapsed {
  max-height: 0;
  padding: 0 20px;
}

.pricing-details-content.expanded {
  max-height: 300px;
  padding: 15px 20px 15px 20px;
}


.pricing-details-content p {
  margin: 8px 0;
  color: #555;
  font-size: 14px;
}

.pricing-note {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
}

.pricing-note p {
  color: #777;
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 768px) {
  html, body {
    height: auto;
  }
  
  .homepage {
    padding: 15px;
    align-items: flex-start;
    min-height: auto;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(80px + env(safe-area-inset-bottom)); /* Extra space on mobile */
  }
  
  .homepage-container {
    gap: 20px;
    max-width: 100%;
  }
  
  .homepage-card {
    padding: 20px;
  }
  
  .card-header h1 {
    font-size: 28px;
  }
  
  .card-header h2 {
    font-size: 20px;
  }
  
  .card-header h3 {
    font-size: 18px;
  }
  
  .service-highlight h4 {
    font-size: 20px;
  }
  
  .pricing-info {
    font-size: 16px;
  }
  
  .upload-button {
    font-size: 20px;
    padding: 20px 20px;
  }
  
  .drop-message {
    font-size: 32px;
    padding: 20px;
  }
  
  .tracking-form {
    flex-direction: column;
  }
  
  .tracking-input {
    min-width: auto;
    width: 100%;
  }
  
  .track-button {
    width: 100%;
  }
  
  .about-content p {
    font-size: 15px;
  }
  
  /* Keep existing mobile styles for other pages */
  .container {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  
  .preview-section {
    height: 50vh;
    height: 50dvh;
    overflow: hidden;
    flex-shrink: 0;
  }
  
  .customize-section {
    height: 50vh;
    height: 50dvh;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }
  
  .tracking-page {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  
  .tracking-info {
    height: 50vh;
    height: 50dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
}


/* Mat Selector Styling */
.mat-option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.mat-color-container {
  margin-top: 15px;
  display: flex;
  justify-content: center;
}

.color-table {
  border-collapse: separate;
  border-spacing: 10px;
  margin: 0 auto;
}

.color-table td {
  padding: 0;
  text-align: center;
}

.color-option {
  width: 50px;
  height: 50px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  margin: 0 auto;
  display: block;
}

.color-option.selected {
  border-color: #4CAF50;
  transform: scale(1.1);
}

.special-option {
  width: 50px;
  height: 50px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  text-align: center;
  transition: all 0.2s;
  background: transparent;
  color: #333;
  margin: 0 auto;
}

.special-option.selected {
  border-color: #4CAF50;
  transform: scale(1.1);
}

.custom-color-option.selected {
  color: white;
}

.mat-name {
  margin-top: 10px;
  font-size: 14px;
  color: #666;
  text-align: center;
}

.custom-color-disclaimer {
  margin-top: 5px;
  font-size: 12px;
  color: #888;
  font-style: italic;
  text-align: center;
}

#customColorPicker {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  width: 40px;
  height: 40px;
}

.custom-color-option {
  position: relative;
}

/* Purchase page styling */
#card-element {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  margin-bottom: 10px;
  min-height: 40px;
}

#card-errors {
  color: #e74c3c;
  font-size: 14px;
  margin-top: 5px;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-footer {
  font-size: 12px;
  color: #666;
  text-align: center;
  font-style: italic;
  display: none;
}

#card-errors:empty::after {
  content: "Payments are securely processed by Stripe";
  font-size: 12px;
  color: #666;
  font-style: italic;
}

.form-group {
  margin-bottom: 15px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: #333;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus {
  outline: none;
  border-color: #4CAF50;
}

/* Order Info Components */
.info-section {
  background-color: #f9f9f9;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid #e0e0e0;
}

.info-section h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #333;
}

.info-content p {
  margin: 8px 0;
  color: #555;
}

.info-edit-form {
  margin-top: 15px;
}

.edit-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 15px;
  transition: background-color 0.3s;
}

.edit-button:hover {
  background-color: #45a049;
}

.edit-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.edit-buttons {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.save-button, .verify-button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.save-button:hover, .verify-button:hover {
  background-color: #45a049;
}

.cancel-button {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.cancel-button:hover {
  background-color: #da190b;
}

.edit-disabled-message {
  color: #666;
  font-style: italic;
  margin-top: 10px;
}

/* Verification Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 15px;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.resend-text {
  margin-top: 15px;
  text-align: center;
  font-size: 14px;
  color: #666;
}

.resend-text a {
  color: #4CAF50;
  text-decoration: none;
}

.resend-text a:hover {
  text-decoration: underline;
}

#verificationCode {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 18px;
  text-align: center;
  letter-spacing: 5px;
  font-family: monospace;
}

.form-group input[type="tel"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

.form-group input[type="tel"]:focus {
  outline: none;
  border-color: #4CAF50;
}

/* Page Header Styles */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-header h2 {
  margin: 0;
}

.back-button {
  background: white;
  color: #6B7C93;
  border: 1px solid #E6EBF1;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.15s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.back-button:hover {
  border-color: #4CAF50;
  color: #4CAF50;
  background: #F1F8E9;
}

/* Stripe-like Checkout Styles */
.express-checkout-section {
  margin-bottom: 24px;
}

.express-checkout-title {
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  color: #424770;
  margin-bottom: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.express-payment-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.express-payment-element {
  height: 40px;
  border-radius: 6px;
}

.checkout-divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  position: relative;
}

.divider-line {
  flex: 1;
  height: 1px;
  background-color: #E6EBF1;
}

.divider-text {
  padding: 0 16px;
  color: #6B7C93;
  font-size: 14px;
  font-weight: 500;
  background-color: white;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.standard-checkout-section {
  margin-bottom: 24px;
}

.standard-checkout-title {
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  color: #424770;
  margin-bottom: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  margin-bottom: 6px;
  color: #424770;
  font-size: 14px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.form-field input[type="text"],
.form-field input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #E6EBF1;
  border-radius: 6px;
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #FCFDFF;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field input[type="text"]:focus,
.form-field input[type="email"]:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 1px 3px 0 rgba(76, 175, 80, 0.15), 0 4px 6px 0 rgba(76, 175, 80, 0.15);
}

.card-element {
  padding: 10px 12px;
  border: 1px solid #E6EBF1;
  border-radius: 6px;
  background-color: #FCFDFF;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-element:focus-within {
  border-color: #4CAF50;
  box-shadow: 0 1px 3px 0 rgba(76, 175, 80, 0.15), 0 4px 6px 0 rgba(76, 175, 80, 0.15);
}

.form-row {
  display: flex;
  gap: 15px;
}

.form-row .form-field {
  flex: 1;
}

.card-errors {
  color: #DF1B41;
  font-size: 14px;
  margin-top: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segue UI", Roboto, sans-serif;
}

.pay-button {
  width: 100%;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin-top: 16px;
}

.pay-button:hover {
  background-color: #45a049;
}

.pay-button:active {
  background-color: #3d8b40;
}

.pay-button:disabled {
  background-color: #E6EBF1;
  color: #6B7C93;
  cursor: not-allowed;
  transform: none;
}

/* Address autocomplete dropdown */
.address-dropdown {
  border: 1px solid #E6EBF1 !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
  background: white !important;
  z-index: 1000 !important;
}

.address-dropdown:empty {
  display: none !important;
}

/* Payment State Styles */
.payment-state {
  margin-top: 24px;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.payment-status-container {
  text-align: center;
  padding: 32px 24px;
  background: #F6F9FC;
  border-radius: 12px;
  border: 1px solid #E6EBF1;
}

.status-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
}

.status-icon.processing {
  background: #FEF3C7;
  color: #F59E0B;
}

.status-icon.success {
  background: #D1FAE5;
  color: #10B981;
}

.status-icon.error {
  background: #FEE2E2;
  color: #EF4444;
}

.status-title {
  font-size: 20px;
  font-weight: 600;
  color: #424770;
  margin-bottom: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.status-message {
  color: #6B7C93;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.order-summary-inline {
  background: white;
  border: 1px solid #E6EBF1;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  text-align: left;
}

.order-summary-inline h4 {
  margin: 0 0 8px 0;
  color: #424770;
  font-size: 14px;
  font-weight: 600;
}

.order-summary-inline p {
  margin: 4px 0;
  color: #6B7C93;
  font-size: 13px;
}

.error-actions {
  margin-top: 20px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #FDE68A;
  border-top: 2px solid #F59E0B;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  .express-checkout-title,
  .standard-checkout-title {
    font-size: 15px;
  }
  
  .form-field input[type="text"],
  .form-field input[type="email"] {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  .pay-button {
    font-size: 16px;
    padding: 14px 16px;
  }
  
  .address-dropdown {
    border-radius: 4px !important;
  }
  
  .payment-status-container {
    padding: 24px 16px;
  }
  
  .status-icon {
    width: 56px;
    height: 56px;
    font-size: 20px;
  }
  
  .status-title {
    font-size: 18px;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .page-header h2 {
    font-size: 20px;
  }
}

/* Custom Frame Controls */
.custom-frame-controls {
  display: flex;
  align-items: stretch;
  margin-top: 15px;
  gap: 10px;
}

.catalog-button {
  flex: 1;
  background: #4CAF50;
  border: none;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.catalog-button:hover {
  background: #45a049;
}

.frame-item-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  background: white;
  transition: border-color 0.3s ease;
  min-width: 0;
}

.frame-item-input:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* Specialized Moulding Catalog Modal */
.moulding-catalog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  z-index: 50000;
  overflow: hidden;
}

.moulding-catalog-container {
  width: 100vw;
  height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.catalog-view {
  width: 100%;
  height: 100vh;
  position: relative;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
  flex-shrink: 0;
}

.catalog-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #333;
}

.catalog-close-btn {
  background: none;
  border: none;
  font-size: 36px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.catalog-close-btn:hover {
  background: #e9ecef;
  color: #333;
}

.catalog-back-btn {
  background: #6c757d;
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.catalog-back-btn:hover {
  background: #5a6268;
}

.catalog-select-btn {
  background: #4CAF50;
  border: none;
  color: white;
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.catalog-select-btn:hover {
  background: #45a049;
}

.catalog-content {
  position: absolute;
  top: 80px; /* Height of header */
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 30px;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.catalog-loading {
  text-align: center;
  padding: 40px 20px;
  font-size: 18px;
  color: #666;
  flex-shrink: 0;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  width: 100%;
}

.catalog-item {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.catalog-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: #4CAF50;
}

.catalog-item-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.catalog-item-info {
  padding: 16px;
}

.catalog-item-name {
  font-weight: 600;
  font-size: 15px;
  color: #333;
  margin-bottom: 6px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.catalog-item-number {
  font-size: 13px;
  color: #666;
  font-weight: 500;
}


.catalog-detail-wrapper {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.catalog-detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  height: 100%;
}

.catalog-detail-info {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 12px;
  height: fit-content;
  position: fixed;
  left: max(30px, calc(50vw - 400px + 30px)); /* Position relative to centered wrapper */
  top: 50%;
  transform: translateY(-50%);
  width: 320px;
  z-index: 10;
}

.catalog-detail-title {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 15px;
}

.catalog-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e0e0e0;
}

.catalog-info-row:last-child {
  border-bottom: none;
}

.catalog-info-label {
  font-weight: 600;
  color: #555;
  font-size: 15px;
}

.catalog-info-value {
  color: #333;
  font-weight: 500;
  font-size: 15px;
}

.catalog-gallery-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin-left: 390px; /* Make room for fixed info panel */
}

.catalog-gallery-title {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.catalog-gallery {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  padding: 5px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.catalog-gallery-image {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  border-radius: 12px;
  border: 2px solid #e9ecef;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background: white;
}

.catalog-gallery-image:hover {
  transform: translateY(-4px);
  border-color: #4CAF50;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Large screen adjustments */
@media (min-width: 1400px) {
  .catalog-detail-info {
    left: calc(50vw - 370px); /* Better positioning for very wide screens */
  }
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .catalog-header {
    padding: 15px 20px;
  }
  
  .catalog-title {
    font-size: 20px;
  }
  
  .catalog-content {
    padding: 20px;
  }
  
  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }
  
  .catalog-item-image {
    height: 130px;
  }
  
  .catalog-detail-layout {
    grid-template-columns: 1fr;
    gap: 25px;
  }
  
  .catalog-detail-info {
    order: 1;
    position: static;
    transform: none;
    align-self: auto;
    width: auto;
    left: auto;
    top: auto;
  }
  
  .catalog-gallery-section {
    order: 2;
    margin-left: 0;
  }
  
  .catalog-detail-layout {
    grid-template-columns: 1fr;
    gap: 25px;
  }
}
}