/* Custom cake builder page — styles not already covered by home.css shared header/hero/footer. */

.cake-hero-section { padding: 40px 0 90px 0; }

.builder-main { padding: 40px 0 100px 0; }
.builder-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; align-items: start; }

.builder-form-area { display: flex; flex-direction: column; gap: 30px; }
.builder-step-card {
  background: var(--bg-card); border-radius: var(--radius-lg); padding: 35px;
  box-shadow: var(--shadow-soft); border: 2px solid var(--border-light);
  position: relative; overflow: hidden;
}
.step-badge {
  position: absolute; top: 0; right: 40px; background: var(--primary); color: #FFF;
  font-weight: 800; font-size: 1.2rem; padding: 10px 20px;
  border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; font-family: 'Lalezar', cursive;
}
.step-title { font-size: 1.4rem; font-weight: 800; color: var(--text-dark); margin: 20px 0 24px 0; display: flex; align-items: center; gap: 10px;}

.visual-radio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.visual-radio-label { cursor: pointer; display: block; }
.visual-radio-input { display: none; }
.visual-radio-card {
  border: 2px solid var(--border-light); border-radius: var(--radius-md); padding: 20px 15px;
  text-align: center; transition: var(--transition); background: var(--bg-page); height: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.visual-radio-card:hover { border-color: var(--primary-border); transform: translateY(-3px); }
.visual-radio-input:checked + .visual-radio-card {
  border-color: var(--primary); background: var(--primary-light); box-shadow: 0 8px 20px rgba(155, 197, 130, 0.2);
}
.v-card-img { width: 70px; height: 70px; object-fit: cover; border-radius: 50%; border: 3px solid #FFF; box-shadow: 0 4px 10px rgba(0,0,0,0.08); background: #FFF;}
.v-card-title { font-weight: 800; font-size: 1.05rem; color: var(--text-dark); }
.v-card-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.visual-radio-input:checked + .visual-radio-card .v-card-title { color: var(--primary-hover); }
.visual-radio-price { font-size: 0.78rem; color: var(--primary-hover); font-weight: 700; }
.visual-radio-empty { color: var(--text-muted); font-size: 0.9rem; }

.range-container { padding: 20px 10px; }
.range-labels { display: flex; justify-content: space-between; margin-bottom: 15px; font-weight: 700; color: var(--text-dark); }
.range-labels span { font-size: 1.1rem; }
.weight-display { font-size: 1.4rem; color: var(--primary-hover); font-weight: 800; text-align: center; margin-bottom: 20px; font-family: 'Lalezar', cursive;}

input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; margin: 10px 0; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 12px; cursor: pointer; background: var(--border-light); border-radius: 10px; }
input[type=range]::-webkit-slider-thumb {
  height: 32px; width: 32px; border-radius: 50%; background: #FFF; border: 4px solid var(--primary);
  cursor: pointer; -webkit-appearance: none; margin-top: -10px; box-shadow: 0 4px 10px rgba(0,0,0,0.15); transition: transform 0.1s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type=range]::-moz-range-progress { background: var(--primary); border-radius: 10px; height: 12px;}

.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.form-label { font-weight: 700; font-size: 0.95rem; color: var(--text-dark); display: flex; align-items: center; gap: 8px;}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 14px 18px; border: 2px solid var(--border-light); border-radius: var(--radius-md);
  font-family: inherit; font-size: 1rem; color: var(--text-dark); background: var(--bg-page); transition: var(--transition); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); background: #FFF; box-shadow: 0 0 0 4px rgba(155, 197, 130, 0.15); }
.form-textarea { resize: vertical; min-height: 120px; }
.form-error { color: #c0392b; font-size: 0.82rem; }

.file-drop-area {
  border: 2px dashed var(--primary-border); border-radius: var(--radius-md); background: var(--bg-hero);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: var(--transition); position: relative;
}
.file-drop-area:hover, .file-drop-area.dragover { background: var(--primary-light); border-color: var(--primary); }
.file-drop-icon { width: 50px; height: 50px; color: var(--primary-hover); margin-bottom: 12px; }
.file-drop-text { font-weight: 700; font-size: 1.1rem; color: var(--text-dark); margin-bottom: 6px;}
.file-drop-sub { font-size: 0.85rem; color: var(--text-muted); }
.file-input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.summary-sidebar { position: sticky; top: 110px; }
.summary-card {
  background: var(--text-dark); color: #FFF; border-radius: var(--radius-lg); padding: 35px 30px;
  box-shadow: 0 20px 40px rgba(42, 59, 36, 0.2); position: relative; overflow: hidden;
}
.summary-card::before { content: ''; position: absolute; top: -50px; left: -50px; width: 150px; height: 150px; background: rgba(255,255,255,0.05); border-radius: 50%; }

.summary-title { font-family: 'Lalezar', cursive; font-size: 2rem; margin-bottom: 24px; color: var(--primary-light); position: relative; z-index: 1;}

.summary-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 30px; position: relative; z-index: 1;}
.summary-item { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px dashed rgba(255,255,255,0.1); font-size: 0.95rem;}
.summary-item-label { color: #B4C5AA; font-weight: 500; display: flex; align-items: center; gap: 8px;}
.summary-item-val { font-weight: 700; color: #FFF; text-align: left;}

.summary-total {
  background: rgba(255,255,255,0.1); border-radius: var(--radius-md); padding: 20px;
  text-align: center; margin-bottom: 24px; position: relative; z-index: 1; border: 1px solid rgba(255,255,255,0.1);
}
.total-label { font-size: 0.95rem; color: #B4C5AA; margin-bottom: 8px; }
.total-price { font-size: 2.2rem; font-weight: 800; color: var(--primary); font-family: 'Lalezar', cursive; line-height: 1;}
.total-price span { font-size: 1.2rem; font-family: 'Vazirmatn'; font-weight: 600; margin-right: 4px; color: #FFF;}

.btn-submit-order {
  width: 100%; background: var(--primary); color: var(--text-dark); font-weight: 800; font-size: 1.1rem;
  padding: 16px; border-radius: var(--radius-pill); box-shadow: 0 8px 20px rgba(155, 197, 130, 0.2);
  display: flex; align-items: center; justify-content: center; gap: 10px; transition: var(--transition); position: relative; z-index: 1;
}
.btn-submit-order:hover { background: #FFF; transform: translateY(-3px); box-shadow: 0 12px 25px rgba(255, 255, 255, 0.2); }
.btn-submit-order:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

@media (max-width: 1024px) {
  .builder-grid { grid-template-columns: 1.2fr 1fr; gap: 24px; }
  .visual-radio-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .builder-grid { grid-template-columns: 1fr; }
  .summary-sidebar { position: fixed; bottom: 0; left: 0; right: 0; top: auto; z-index: 90; }
  .summary-card { border-radius: 0; border-top-left-radius: 30px; border-top-right-radius: 30px; padding: 20px; box-shadow: 0 -10px 30px rgba(0,0,0,0.2); }
  .summary-title, .summary-list { display: none; }
  .summary-total { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; padding: 10px; background: transparent; border: none; text-align: right;}
  .total-price { font-size: 1.6rem; }

  .builder-main { padding-bottom: 220px; }
  .builder-step-card { padding: 24px 20px; }
  .step-badge { right: 20px; padding: 6px 16px; font-size: 1rem; }
}

/* --- Ready-made design gallery picker --- */
.gallery-or-divider {
  display: flex; align-items: center; gap: 12px; color: var(--text-muted);
  font-size: 0.85rem; font-weight: 700; margin: 4px 0;
}
.gallery-or-divider::before, .gallery-or-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-light);
}

.btn-open-cake-gallery {
  width: 100%; background: var(--bg-hero); color: var(--text-dark); font-weight: 800; font-size: 1rem;
  padding: 14px 18px; border-radius: var(--radius-md); border: 2px dashed var(--primary-border);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; transition: var(--transition); font-family: inherit;
}
.btn-open-cake-gallery:hover { background: var(--primary-light); border-color: var(--primary); transform: translateY(-2px); }
.btn-open-cake-gallery i { color: var(--primary-hover); font-size: 1.2rem; }

/* Selected gallery design chip — base rule has NO display so [hidden] keeps working. */
.cake-gallery-selected[hidden] { display: none; }
.cake-gallery-selected:not([hidden]) {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  background: var(--primary-light); border: 2px solid var(--primary-border);
  border-radius: var(--radius-md); padding: 10px 14px;
}
.cake-gallery-selected img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 12px;
  border: 2px solid #FFF; box-shadow: 0 4px 10px rgba(0,0,0,0.12); flex-shrink: 0;
}
.cake-gallery-selected-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cake-gallery-selected-info b { color: var(--text-dark); font-size: 0.95rem; }
.cake-gallery-selected-info small { color: var(--text-muted); font-size: 0.78rem; }
#gallerySelectedRemove {
  width: 34px; height: 34px; border-radius: 50%; border: none; background: #FFF; color: #c0392b;
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1); transition: var(--transition);
}
#gallerySelectedRemove:hover { background: #c0392b; color: #FFF; }

/* Gallery modal — [hidden]-safe display pattern. */
.cake-gallery-modal[hidden] { display: none; }
.cake-gallery-modal:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 200; }
.cake-gallery-backdrop { position: absolute; inset: 0; background: rgba(42, 59, 36, 0.55); backdrop-filter: blur(3px); }
.cake-gallery-panel {
  position: relative; background: var(--bg-page); border-radius: var(--radius-lg);
  max-width: 860px; width: calc(100% - 32px); max-height: 86vh; margin: 6vh auto 0;
  padding: 24px; box-shadow: 0 30px 60px rgba(42, 59, 36, 0.35);
  display: flex; flex-direction: column; border: 2px solid var(--border-light);
}
.cake-gallery-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cake-gallery-head h3 { font-size: 1.25rem; font-weight: 800; color: var(--text-dark); display: flex; align-items: center; gap: 10px; }
.cake-gallery-head h3 i { color: var(--primary-hover); }
.cake-gallery-close {
  width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--bg-hero); color: var(--text-dark);
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; transition: var(--transition);
}
.cake-gallery-close:hover { background: var(--primary); color: var(--text-dark); }
.cake-gallery-hint { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 14px; }

.cake-gallery-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cake-gallery-tab {
  border: 2px solid var(--border-light); background: var(--bg-card); color: var(--text-body);
  font-family: inherit; font-weight: 700; font-size: 0.88rem; padding: 8px 16px;
  border-radius: var(--radius-pill); cursor: pointer; transition: var(--transition);
}
.cake-gallery-tab:hover { border-color: var(--primary-border); }
.cake-gallery-tab.active { background: var(--primary); border-color: var(--primary); color: var(--text-dark); box-shadow: 0 6px 14px rgba(155, 197, 130, 0.3); }

.cake-gallery-body { overflow-y: auto; flex: 1; padding: 2px; }
.cake-gallery-grid[hidden] { display: none; }
.cake-gallery-grid:not([hidden]) { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.cake-gallery-item {
  border: 2px solid var(--border-light); border-radius: var(--radius-md); background: var(--bg-card);
  padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  font-family: inherit; transition: var(--transition); text-align: center;
}
.cake-gallery-item:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: 0 10px 22px rgba(155, 197, 130, 0.25); }
.cake-gallery-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; display: block; }
.cake-gallery-item span { font-size: 0.82rem; font-weight: 700; color: var(--text-dark); }
.cake-gallery-empty { color: var(--text-muted); font-size: 0.9rem; text-align: center; padding: 30px 0; grid-column: 1 / -1; }

@media (max-width: 640px) {
  .cake-gallery-panel { margin: 0; width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; border: none; padding: 16px; }
  .cake-gallery-grid:not([hidden]) { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
