:root {
  --primary: #00B56A;
  --primary-dark: #00724B;
  --primary-light: #33FF99;
  --secondary: #C8A641;
  --secondary-dark: #8C6A1D;
  --accent: #0079C1;
  --accent-dark: #003C70;
  --skin: #F8D6B4;
  --hair: #2C2C2C;
  --shirt: #E6E6E6;
  --black: #000000;
  --white: #FFFFFF;
  --light: #f8f9fa;
  --dark: #212529;
  --gray: #6c757d;
  --light-gray: #e9ecef;
  --success: #33FF99;
  --border-radius: 12px;
  --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  display: flex; justify-content: center; align-items: center;
  min-height: 100vh; color: var(--dark); line-height: 1.6;
  overflow: auto; padding: 20px 0;
}

.container {
  background: white; padding: 2.5rem; border-radius: var(--border-radius);
  box-shadow: var(--box-shadow); max-width: 1000px; width: 100%;
  position: relative; overflow: visible; margin: 0 auto;
}

.container::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 5px;
  background: linear-gradient(to right, var(--primary), var(--secondary));
}

.header { text-align: center; margin-bottom: 1.5rem; position: relative; }

.header-controls { display: flex; justify-content: center; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }

.product-selector, .language-selector { display: flex; align-items: center; gap: 0.5rem; }

.product-dropdown, .language-dropdown {
  padding: 0.5rem 1rem; border: 2px solid var(--light-gray); border-radius: var(--border-radius);
  background: white; font-size: 0.9rem; cursor: pointer; transition: var(--transition); max-width: 200px;
}

.product-dropdown:focus, .language-dropdown:focus { outline: none; border-color: var(--primary); }

.flag { font-size: 1.2rem; }

h1 { font-size: 1.8rem; margin-bottom: 0.5rem; color: var(--dark); font-weight: 700; }

.subtitle { color: var(--gray); font-size: 0.95rem; margin-bottom: 0.75rem; }

.header-description {
  background: #fff;
  border: 2px solid var(--light-gray);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  color: var(--dark);
  transition: var(--transition);
}

.header-description:hover {
  background: linear-gradient(135deg, var(--primary), var(--black));
  color: #fff;
  border-color: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.content-wrapper { display: flex; gap: 2rem; }

.form-section { flex: 1; }

.preview-section { flex: 1; display: flex; flex-direction: column; align-items: center; }

.specs {
  background: var(--light); padding: 1.2rem; border-radius: var(--border-radius);
  margin-bottom: 1.5rem; border-left: 4px solid var(--primary);
}

.specs p { margin-bottom: 0.5rem; display: flex; align-items: center; }

.specs p:last-child { margin-bottom: 0; }

.specs p::before { content: '\2713'; color: var(--primary); font-weight: bold; margin-right: 0.5rem; }

/* Descripci�n y beneficios */
.product-description {
  background: #fff;
  border: 2px solid var(--light-gray);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  color: var(--dark);
}

.product-benefits {
  background: var(--light);
  border-left: 4px solid var(--primary);
  border-radius: var(--border-radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
}

.product-benefits h4 {
  margin: 0 0 0.6rem 0;
  color: var(--dark);
  font-size: 1rem;
}

.product-benefits ul { list-style: none; padding: 0; margin: 0; }

.product-benefits li { display: flex; align-items: center; margin: 0.35rem 0; color: var(--dark); }

.product-benefits li::before {
  content: '\2713';
  color: var(--primary);
  font-weight: 700;
  margin-right: 0.5rem;
}

.design-question {
  margin-bottom: 1.5rem; padding: 1.2rem; background: rgba(0, 181, 106, 0.05);
  border-radius: var(--border-radius); border: 1px solid rgba(0, 181, 106, 0.2);
}

.design-question label { display: block; margin-bottom: 0.8rem; font-weight: 600; color: var(--dark); }

.radio-group { display: flex; gap: 1rem; }

.radio-option { display: flex; align-items: center; cursor: pointer; }

.radio-option input[type="radio"] { margin-right: 0.5rem; cursor: pointer; }

.radio-option span { display: inline; }

/* Estilo especial para logo y redes sociales */
.radio-group.vertical-labels { display: flex; gap: 2rem; align-items: flex-start; }

.radio-group.vertical-labels .radio-option { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 0.3rem;
  text-align: center;
}

.radio-group.vertical-labels .radio-option input[type="radio"] { margin: 0; }

.radio-group.vertical-labels .radio-option span { display: block; }

.design-service {
  margin-top: 1rem; padding: 1rem; background: rgba(200, 166, 65, 0.1);
  border-radius: var(--border-radius); border: 1px solid rgba(200, 166, 65, 0.3);
  display: none;
}

.design-service.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.design-service h3 { color: var(--secondary-dark); margin-bottom: 0.5rem; font-size: 1rem; }

.design-service p { font-size: 0.9rem; color: var(--gray); margin-bottom: 0.5rem; }

/* Card-specific design options */
.design-options { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px dashed var(--light-gray); }

.design-options h4 { margin: 0 0 0.5rem 0; font-size: 0.95rem; color: var(--dark); }

.design-mode-group { display: flex; gap: 1rem; margin-bottom: 0.5rem; flex-wrap: wrap; }

.design-mode-group label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }

.templates-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6rem; margin-top: 0.5rem; }

.template-item { border: 2px solid var(--light-gray); border-radius: 8px; overflow: hidden; background: #fff; cursor: pointer; transition: var(--transition); }

.template-item:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,0.12); border-color: var(--primary); }

.template-item.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,181,106,0.15); }

.template-faces { position: relative; width: 100%; aspect-ratio: 2306 / 1727; display: block; }

.template-faces img { width: 100%; height: 100%; object-fit: contain; background: #f3f4f6; display: block; }

/* Template editor for dynamic business card */
.template-editor { margin-top: 0.75rem; padding: 1rem; background: rgba(0, 181, 106, 0.05); border: 1px solid rgba(0, 181, 106, 0.2); border-radius: var(--border-radius); }

.template-editor h4 { margin: 0 0 0.5rem 0; font-size: 0.95rem; color: var(--dark); }

.template-editor .row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }

.template-editor label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }

.template-editor input[type="text"], .template-editor input[type="file"], .template-editor textarea { width: 100%; padding: 0.5rem 0.6rem; border: 2px solid var(--light-gray); border-radius: 8px; box-sizing: border-box; font-family: inherit; }

.template-editor input[type="color"] { width: 100%; height: 36px; padding: 0; border: none; background: transparent; box-sizing: border-box; }

.template-editor .reset-color-btn {
  display: none;
  margin-top: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  width: 100%;
}

.template-editor .reset-color-btn:hover { background: #5a6268; }

.template-editor .view-live-btn {
  display: none; /* default hidden, shown on mobile */
  margin-top: 0.6rem;
  padding: 0.7rem 1.1rem;
  background: linear-gradient(135deg, var(--primary), var(--black));
  color: #fff;
  border: none;
  border-radius: 24px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  width: fit-content;
}

.template-editor .view-live-btn:hover { filter: brightness(1.05); }

@media (max-width: 768px) { .template-editor .view-live-btn { display: block; } }

.flyer-container.highlight { animation: highlightPulse 1.2s ease 1; }

@keyframes highlightPulse { 0% { box-shadow: 0 0 0 0 rgba(0,181,106,0.6); } 100% { box-shadow: 0 0 0 14px rgba(0,181,106,0); } }

@media (max-width: 576px) {
  .template-editor .row { grid-template-columns: 1fr; }
}

.upload-section { margin-bottom: 1.5rem; }

.upload-section label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--dark); }

.file-input-container { position: relative; display: flex; align-items: center; }

.file-input-container input[type="file"] {
  width: 100%; padding: 0.75rem 1rem; border: 2px dashed var(--light-gray);
  border-radius: var(--border-radius); background: var(--light); font-size: 0.9rem; transition: var(--transition); cursor: pointer;
}

.file-input-container input[type="file"]:hover { border-color: var(--primary); background: rgba(0, 181, 106, 0.05); }

.file-input-container input[type="file"]::file-selector-button {
  background: var(--primary); color: white; border: none; padding: 0.5rem 1rem;
  border-radius: 6px; margin-right: 1rem; cursor: pointer; transition: var(--transition); font-weight: 600;
}

.file-input-container input[type="file"]::file-selector-button:hover { background: var(--primary-dark); }

.file-input-container input[type="file"][disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  border-color: var(--light-gray);
  background: #f3f4f6;
}

.file-input-container input[type="file"][disabled]::file-selector-button {
  background: #9aa4af;
  cursor: not-allowed;
}

.quantities { margin-bottom: 1.5rem; }

.quantities label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--dark); }

.quantities select {
  width: 100%; padding: 0.75rem 1rem; border: 2px solid var(--light-gray);
  border-radius: var(--border-radius); font-size: 1rem; background: white; transition: var(--transition); cursor: pointer;
}

.quantities select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 181, 106, 0.2); }

.price-display {
  text-align: center; margin-bottom: 1.5rem; padding: 1.2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; border-radius: var(--border-radius); font-size: 1.4rem; font-weight: 700;
  box-shadow: 0 5px 15px rgba(0, 181, 106, 0.3);
}

.price-breakdown { margin-top: 0.5rem; font-size: 0.9rem; font-weight: normal; opacity: 0.9; }

.btn-order {
  display: block; width: 100%; padding: 1rem; font-size: 1.1rem;
  background: var(--accent); color: white; border: none; border-radius: var(--border-radius);
  cursor: pointer; transition: var(--transition); font-weight: 600; letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(0, 121, 193, 0.3);
}

.btn-order:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 121, 193, 0.4); }

.btn-order:active:not(:disabled) { transform: translateY(0); }

.btn-order:disabled { background: var(--gray); cursor: not-allowed; transform: none; box-shadow: none; }

.file-status { font-size: 0.85rem; margin-top: 0.3rem; display: flex; align-items: center; color: var(--gray); }

.file-status.success { color: var(--primary); }

.file-status.error { color: #dc3545; }

.file-status::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.5rem; background-color: var(--gray); }

.file-status.success::before { background-color: var(--primary); }

.file-status.error::before { background-color: #dc3545; }

.recommended-size { font-size: 0.82rem; color: var(--gray); margin-top: 0.25rem; }

/* Mockup 3D */
.flyer-mockup { margin-top: 1.5rem; text-align: center; position: relative; z-index: 1; }

.flyer-mockup h3 { margin-bottom: 1rem; color: var(--dark); position: relative; z-index: 10; }

.flyer-container {
  position: relative; margin: 0 auto; perspective: 1200px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none; touch-action: none; z-index: 2;
}

.flyer-container.flyer-product { width: 280px; height: 365px; }

.flyer-container.magnet-product { width: 360px; height: 270px; }

.flyer-container.card-product { width: 324px; height: 180px; }

.flyer-3d { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.1s linear; cursor: grab; }

.flyer-3d:active { cursor: grabbing; }

.flyer-face {
  position: absolute; width: 100%; height: 100%; backface-visibility: hidden;
  border-radius: 8px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}

.flyer-front { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); transform: translateZ(1px); }

.flyer-back { background: linear-gradient(135deg, var(--primary-light), var(--primary)); transform: rotateY(180deg) translateZ(1px); }

.magnet-back { background: var(--black); transform: rotateY(180deg) translateZ(1px); }

.flyer-image { width: 100%; height: 100%; object-fit: cover; display: none; }

.flyer-placeholder { text-align: center; padding: 1rem; color: white; font-weight: bold; }

.flyer-placeholder i { font-size: 3rem; margin-bottom: 1rem; display: block; }

.magnet-back .flyer-placeholder i { display: none; }

.flyer-controls { margin-top: 1rem; display: flex; justify-content: center; gap: 0.8rem; flex-wrap: wrap; position: relative; z-index: 10; }

.flyer-btn { padding: 0.5rem 0.8rem; background: var(--primary); color: white; border: none; border-radius: 4px; cursor: pointer; transition: var(--transition); font-size: 0.85rem; white-space: nowrap; }

.flyer-btn:hover { background: var(--primary-dark); }

.flyer-dimensions { margin-top: 0.5rem; font-size: 0.9rem; color: var(--gray); position: relative; z-index: 10; }

.rotation-info { margin-top: 0.5rem; font-size: 0.8rem; color: var(--gray); opacity: 0.7; position: relative; z-index: 10; }

.face-indicator { margin-top: 0.5rem; font-size: 0.9rem; color: var(--primary); font-weight: 600; min-height: 1.5rem; position: relative; z-index: 10; }

.preview-protection { position: relative; width: 100%; padding: 20px 0; }

.badge-360 { position: absolute; top: -35px; left: 8px; background: rgba(0,0,0,0.55); color: #fff; font-size: 0.75rem; padding: 4px 8px; border-radius: 20px; display: flex; align-items: center; gap: 6px; z-index: 20; pointer-events: none; backdrop-filter: blur(2px); }

.badge-360 svg { width: 16px; height: 16px; display: block; }

.mini-badge-360 { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,0.55); color: #fff; font-size: 0.7rem; padding: 3px 6px; border-radius: 16px; display: flex; align-items: center; gap: 4px; z-index: 5; pointer-events: none; backdrop-filter: blur(2px); }

.mini-badge-360 svg { width: 14px; height: 14px; display: block; }

.preview-protection::before {
  content: '';
  position: absolute;
  top: -50px;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(to bottom, transparent, white);
  pointer-events: none;
  z-index: 5;
}

.preview-protection::after {
  content: '';
  position: absolute;
  bottom: -50px;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(to top, transparent, white);
  pointer-events: none;
  z-index: 5;
}

/* Header cart icon */
.cart-icon-header {
  position: fixed; top: 20px; right: 20px; background: var(--primary);
  color: #fff; border: none; padding: 0.75rem; border-radius: 50%;
  cursor: pointer; transition: var(--transition); z-index: 100;
  width: 50px; height: 50px; display: flex; align-items: center; justify-content: center;
}
.cart-icon-header:hover { background: var(--primary-dark); transform: scale(1.05); box-shadow: 0 4px 15px rgba(0,181,106,0.3); }
.cart-badge { position: absolute; top: -6px; right: -6px; background: #ff3b30; color: #fff; border-radius: 999px; padding: 2px 6px; font-size: 12px; display: none; }

/* Cart sidebar */
.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; z-index: 100; }
.cart-overlay.active { display: block; }
.cart-sidebar { position: fixed; top: 0; right: -420px; width: 360px; max-width: 90%; height: 100vh; background: #fff; box-shadow: -4px 0 24px rgba(0,0,0,0.12); transition: right .3s ease; z-index: 101; display: flex; flex-direction: column; }
.cart-sidebar.open { right: 0; }
.cart-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--light-gray); }
.cart-close { background: transparent; border: none; font-size: 1.6rem; cursor: pointer; color: var(--gray); }
.cart-items { flex: 1; overflow-y: auto; padding: 0.75rem 1rem; }
.cart-item { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem; border: 1px solid var(--light-gray); border-radius: 10px; margin-bottom: 0.75rem; }
.cart-item-title { font-weight: 700; color: var(--dark); }
.cart-item-details { font-size: 0.85rem; color: var(--gray); }
.cart-item-price { font-weight: 700; color: var(--dark); }
.cart-item-remove { background: var(--light-gray); border: none; color: var(--dark); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; }
.cart-item-remove:hover { background: #e0e3e7; }
.cart-empty { text-align: center; color: var(--gray); padding: 2rem 0; }
.cart-total { padding: 1rem 1.25rem; border-top: 1px solid var(--light-gray); }
.cart-total-row { display: flex; align-items: center; justify-content: space-between; font-weight: 700; }

/* Add to cart button in form */
.btn-cart { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 0.9rem 1rem; border-radius: var(--border-radius); border: none; cursor: pointer; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; font-weight: 700; box-shadow: 0 10px 20px rgba(0,0,0,0.08); transition: var(--transition); margin-bottom: 0.8rem; }
.btn-cart:disabled { opacity: 0.6; cursor: not-allowed; filter: grayscale(0.2); }
.btn-cart:not(:disabled):hover { filter: brightness(1.05); transform: translateY(-1px); }

/* Add to cart toast */
.add-to-cart-success { position: fixed; top: 20px; right: 20px; background: var(--success); color: #000; padding: 0.9rem 1rem; border-radius: var(--border-radius); box-shadow: var(--box-shadow); z-index: 1001; transform: translateX(420px); transition: transform 0.3s ease; font-weight: 700; }
.add-to-cart-success.show { transform: translateX(0); }

@media (max-width: 768px){
  .cart-sidebar { width: 100%; right: -100%; }
}

.examples-slider { margin-top: 2rem; width: 100%; }

.examples-title { text-align: center; margin-bottom: 1rem; font-size: 1.1rem; color: var(--dark); font-weight: 600; }

.examples-hint { text-align: center; margin-top: -0.5rem; margin-bottom: 0.8rem; font-size: 0.85rem; color: var(--gray); opacity: 0.9; }

.examples-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; padding: 0 1rem; }

.example-item { aspect-ratio: 1; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); transition: var(--transition); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }

.example-item:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); }

.example-image { width: 100%; height: 100%; object-fit: cover; }

.example-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 0.8rem; text-align: center; padding: 0.5rem; }

.mini-3d-hint { font-size: 0.7rem; color: var(--gray); text-align: center; padding: 0; margin: 0 0 0.3rem 0; line-height: 1.3; opacity: 0.85; font-weight: 500; }

.example-rating { grid-column: 1 / -1; background: white; padding: 0.8rem; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); margin-top: 0.5rem; }

.example-rating-name { font-size: 0.8rem; font-weight: 600; color: var(--dark); margin-bottom: 0.3rem; }

.example-rating-stars { color: #FFB800; font-size: 0.9rem; margin-bottom: 0.3rem; }

.example-rating-text { font-size: 0.75rem; color: var(--gray); line-height: 1.4; font-style: italic; }

/* Flip button for static examples */
.example-flip-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 10;
  color: var(--primary);
  font-size: 18px;
  font-weight: bold;
}

.example-flip-btn:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

.example-flip-btn:active {
  transform: scale(0.95);
}

.example-flip-container {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.example-flip-container.flipped {
  transform: rotateY(180deg);
}

.example-flip-face {
  width: 100%;
  height: 100%;
  position: absolute;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #000;
}

.example-flip-face.back {
  transform: rotateY(180deg);
}

.example-flip-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* Mini 3D mockups for examples */
.mini-container {
  margin: 0 auto; perspective: 800px; position: relative; user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; touch-action: none; background: #fff; border-radius: 8px;
}

.mini-container.flyer-product { width: 140px; height: 182px; }

.mini-container.magnet-product { width: 200px; height: 150px; }

.mini-container.card-product { width: 180px; height: 100px; }

.mini-3d { width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.1s linear; cursor: grab; }

.mini-3d:active { cursor: grabbing; }

.mini-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 6px; overflow: hidden; box-shadow: 0 6px 15px rgba(0,0,0,0.12); }

.mini-front { transform: translateZ(1px); background: #f3f4f6; display: flex; align-items: center; justify-content: center; }

.mini-back { transform: rotateY(180deg) translateZ(1px); background: #e5e7eb; display: flex; align-items: center; justify-content: center; }

.mini-image { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 15000; align-items: center; justify-content: center; }

.modal-content { background: white; padding: 2rem; border-radius: var(--border-radius); width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }

.modal-title { font-size: 1.5rem; font-weight: 600; }

.close-modal { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray); }

.form-group { margin-bottom: 1rem; }

.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; }

.form-group input, .form-group select { width: 100%; padding: 0.75rem; border: 2px solid var(--light-gray); border-radius: var(--border-radius); font-size: 1rem; }

.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); }

.checkbox-group { display: flex; align-items: center; gap: 0.5rem; margin: 1rem 0; }

.checkbox-group input { width: auto; }

.invoice-section { display: none; margin-top: 1.5rem; padding: 1.5rem; background: var(--light); border-radius: var(--border-radius); }

.invoice-section.active { display: block; }

.same-address-btn { background: var(--primary); color: white; border: none; padding: 0.5rem 1rem; border-radius: var(--border-radius); cursor: pointer; margin-bottom: 1rem; }

.modal-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }

.modal-btn { flex: 1; padding: 0.75rem; border: none; border-radius: var(--border-radius); cursor: pointer; font-weight: 600; }

.modal-btn.primary { background: var(--primary); color: white; }

.modal-btn.secondary { background: var(--light-gray); color: var(--dark); }

/* Controls panel next to preview */
.preview-side-controls { width: 100%; margin-top: 1rem; }

/* Cart Styles */
.cart-container {
  display: flex;
  align-items: center;
  margin-left: 1rem;
}

.cart-button {
  position: relative;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 181, 106, 0.3);
}

.cart-button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 181, 106, 0.4);
}

.cart-icon {
  font-size: 1.2rem;
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--secondary);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  min-width: 20px;
  padding: 0 2px;
}

.cart-count:empty {
  display: none;
}

/* Action Buttons Container */
.action-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.btn-add-to-cart {
  flex: 1;
  background: var(--secondary);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-add-to-cart:hover {
  background: var(--secondary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
}

.btn-add-to-cart:disabled {
  background: var(--light-gray);
  color: var(--gray);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-add-to-cart .cart-icon {
  font-size: 1rem;
}

/* Cart Modal Styles */
.cart-modal .modal-content {
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.cart-content {
  padding: 0;
  overflow: hidden;
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--light-gray);
  background: var(--light);
}

.cart-header h2 {
  margin: 0;
  color: var(--dark);
  font-size: 1.5rem;
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  min-height: 200px;
  max-height: 400px;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--light-gray);
  border-radius: var(--border-radius);
  background: white;
  transition: var(--transition);
}

.cart-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cart-item-image {
  width: 60px;
  height: 60px;
  background: var(--light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.cart-item-details {
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.cart-item-name {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 0.25rem;
}

.cart-item-description {
  font-size: 0.9rem;
  color: var(--gray);
  margin-bottom: 0.25rem;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.quantity-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--light-gray);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: var(--transition);
}

.quantity-btn:hover {
  background: var(--light);
  border-color: var(--primary);
}

.quantity-input {
  width: 50px;
  text-align: center;
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  padding: 0.25rem;
}

.cart-item-price {
  font-weight: 600;
  color: var(--primary);
  font-size: 1.1rem;
  flex-shrink: 0; /* Prevent price from shrinking */
  margin-right: 0.5rem; /* Small gap between price and X */
}

.cart-item-remove {
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 4px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0; /* Prevent button from shrinking */
}

.cart-item-remove:hover {
  background: var(--secondary-dark);
}

.cart-empty {
  text-align: center;
  padding: 2rem;
  color: var(--gray);
}

.empty-cart-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.cart-footer {
  border-top: 1px solid var(--light-gray);
  padding: 1.5rem;
  background: var(--light);
}

.cart-summary {
  margin-bottom: 1rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-row.total {
  font-weight: bold;
  font-size: 1.2rem;
  color: var(--primary);
  border-top: 2px solid var(--primary);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.cart-actions {
  display: flex;
  gap: 1rem;
}

.cart-actions button {
  flex: 1;
  padding: 1rem;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

@media (max-width: 768px) {
  .content-wrapper { flex-direction: column; }
  .preview-section { order: -1; }
  body { padding: 1rem; }
  .header-controls { justify-content: center; margin-bottom: 1rem; }
  .examples-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; padding: 0 0.5rem; }
  .modal-content { width: 95%; padding: 1.5rem; }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .cart-button {
    width: 45px;
    height: 45px;
  }
  
  .cart-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .cart-item-details {
    width: 100%;
  }
  
  .cart-actions {
    flex-direction: column;
  }
}

@media (max-width: 576px) {
  .container { padding: 1.5rem; margin: 0; }
  h1 { font-size: 1.5rem; }
  .price-display { font-size: 1.2rem; padding: 1rem; }
  .flyer-container.flyer-product { width: 230px; height: 300px; }
  .flyer-container.magnet-product { width: 300px; height: 225px; }
  .flyer-container.card-product { width: 270px; height: 150px; }
  .flyer-controls { gap: 0.5rem; }
  .flyer-btn { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
  .examples-grid { grid-template-columns: 1fr; gap: 1rem; }
  .template-editor .row { grid-template-columns: 1fr; }
}

/* Zoom Button and Modal */
.zoom-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition);
  z-index: 5;
  opacity: 0;
  pointer-events: none;
}

.example-item:hover .zoom-btn,
.example-flip-container:hover + .zoom-btn {
  opacity: 1;
  pointer-events: auto;
}

.zoom-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.zoom-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.zoom-modal.active {
  display: flex;
}

.zoom-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-modal-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.zoom-modal-content .mini-container {
  transform: scale(2.5);
  pointer-events: auto;
}

.zoom-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: white;
  color: var(--dark);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: bold;
  transition: var(--transition);
  z-index: 10001;
}

.zoom-close:hover {
  background: var(--primary);
  color: white;
  transform: rotate(90deg);
}

.zoom-modal-controls {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
  z-index: 10001;
}

.zoom-modal-controls button {
  background: white;
  color: var(--dark);
  border: none;
  border-radius: var(--border-radius);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.zoom-modal-controls button:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
}

/* ========== WHATSAPP FLOAT BUTTON - BUBBLE ABOVE ========== */
#whatsappFloat {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  z-index: 99999 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 10px !important;
  pointer-events: auto !important;
}

#whatsappBubble {
  background: white !important;
  border: 2px solid #25D366 !important;
  border-radius: 20px !important;
  padding: 12px 16px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
  position: relative !important;
  max-width: 200px !important;
  display: none !important;
  margin: 0 !important;
  text-align: center !important;
}

#whatsappBubble.show {
  display: block !important;
}

#whatsappBubble::after {
  content: '' !important;
  position: absolute !important;
  bottom: -8px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 0 !important;
  height: 0 !important;
  border-left: 8px solid transparent !important;
  border-right: 8px solid transparent !important;
  border-top: 8px solid white !important;
  border-bottom: none !important;
}

.whatsapp-btn {
  width: 60px !important;
  height: 60px !important;
  background: #25D366 !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4) !important;
  color: white !important;
  text-decoration: none !important;
  transition: all 0.3s ease !important;
  animation: whatsappPulse 2s infinite !important;
  cursor: pointer !important;
  border: none !important;
  margin: 0 !important;
}

.whatsapp-btn:hover {
  background: #128C7E !important;
  transform: scale(1.1) !important;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6) !important;
}

.whatsapp-btn svg {
  width: 28px !important;
  height: 28px !important;
  fill: white !important;
}

#whatsappBubbleText {
  color: #333 !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  margin: 0 !important;
  padding: 0 !important;
}

#bubbleClose {
  position: absolute !important;
  top: -5px !important;
  right: 5px !important;
  background: #ff4757 !important;
  color: white !important;
  border: none !important;
  border-radius: 50% !important;
  width: 20px !important;
  height: 20px !important;
  font-size: 12px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

@keyframes whatsappPulse {
  0% {
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
  }
  50% {
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.8), 0 0 0 10px rgba(37, 211, 102, 0.1);
  }
  100% {
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
  }
}

/* Mobile version */
@media (max-width: 768px) {
  #whatsappFloat {
    bottom: 15px !important;
    right: 15px !important;
  }
  
  .whatsapp-btn {
    width: 55px !important;
    height: 55px !important;
  }
  
  .whatsapp-btn svg {
    width: 24px !important;
    height: 24px !important;
  }
  
  #whatsappBubble {
    max-width: 160px !important;
    padding: 10px 12px !important;
  }
  
  #whatsappBubbleText {
    font-size: 13px !important;
  }
}

/* ===== STRIPE PAYMENT MODAL ===== */
#paymentModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  /* Ensure payment modal is above any other modal (shipping/zoom) */
  z-index: 20000;
  justify-content: center;
  align-items: center;
}

#paymentModal.active {
  display: flex;
}

#paymentModal .modal-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

#paymentModal h2 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 24px;
}

#card-element {
  background: white;
}

#card-errors {
  font-size: 14px;
  min-height: 20px;
}

#submitPayment:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

