@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600&family=Lato&display=swap');

body {
	margin: 0;
	font-family: 'Lato', sans-serif;
	display: flex;
	flex-direction: column;
	height: 100vh;
	background-color: #f5f7fa;
	color: #3D3D3D;
}

h1, h2, h3, h4, h5, h6 {
	font-family: 'Montserrat', sans-serif;
	color: #60B339 !important;
}

/* === Progression guidée === */
.quote-progress {
  margin: 0 0 12px 0;
}

.progress-text {
  font-size: 13px;
  color: #555;
  margin-bottom: 5px;
  font-weight: 600;
}

#progress-current {
  color: #60B339;
  font-weight: 800;
}

#progress-remaining {
  color: #777;
  font-weight: 400;
  margin-left: 6px;
}

.progress-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress {
  height: 100%;
  border-radius: 999px;
  background: #60B339;
  width: 0%;
  transition: width 0.3s ease;
}

/* contenaires */
.main-container {
	display: flex;
	flex: 1;
	overflow: hidden;
	width: 100%;
	margin: auto;
}

.left-panel {
	width: 22%;
	min-width: 280px;
	background: #ffffff;
	display: flex;
	flex-direction: column;
	border-right: 1px solid #dee2e6;
}

.central-panel {
	flex: 1;
	padding: 20px;
	overflow-y: auto;
	background: #ffffff;
}

.viewer-panel{
  width: 32%;
  min-width: 360px;
  background: #ffffff;
  border-left: 1px solid #dee2e6;
  padding: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.file-list {
	min-height: 200px;
	max-height: 300px;
	overflow-y: auto;
	border-bottom: 1px solid #dee2e6;
	background: #f8f9fa;
}

.file-list ul {
	list-style: none;
	margin: 0;
	padding: 10px;
}

.file-list li {
	padding: 4px;
	border-bottom: 1px solid #dee2e6;
	cursor: pointer;
}

.file-list li:hover {
	background: #e2e6ea;
}

/* Viewer STL principal */
.viewer {
  flex: 1;
  border: 1px solid #ced4da;
  border-radius: 8px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  font-weight: bold;
  font-size: 1.2em;
  color: #495057;
  position: relative;
  transition: height 0.3s ease;
  height: auto;
  min-height: 420px;
  overflow: hidden;
}

/* Barre d’en-tête du viewer */
.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #E5E5E5;
  border-bottom: 1px solid #adb5bd;
}

.viewer-header h3{
  margin: 0;
  font-size: 1.2em;
  font-family: 'Montserrat', sans-serif;
  color: #2C2C2C !important;
}

/* Contenu STL inséré dynamiquement */
#viewer-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

#viewer-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: #333;
	text-align: center;
	font-size: 1.2em;
	z-index: 10;
	pointer-events: none;
}

/* le style de la dropzone */
#dropzone-overlay {
    display: none;
    position: fixed;
    top: 100px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    z-index: 9999;
    pointer-events: auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

#globalDropzone.custom-dropzone {
    display: flex;
    width: 80%;
    max-width: 600px;
    height: 200px;
    border: 2px dashed white;
    border-radius: 15px;
    background: transparent;
    color: white;
    font-size: 18px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    cursor: pointer;
}

/* gestion des 3 images des methodes */
#images{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 0;
  align-items: center;
  justify-items: center;
}

#images img{
  width: 100%;
  max-width: 140px;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s ease;
  border: 2px solid transparent;
}

#images img:hover{
  transform: scale(1.05);
}

#images img.selected{
  border-color: #198754;
}

#images img.method-help-img{
  max-width: 70px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 999px;
  border: 2px solid #60B339;
  padding: 6px;
  background: #fff;
}

/* liens vers les fichiers */
.uploaded-files-list a {
	color: #60B339 !important;
	text-decoration: underline !important;
	font-weight: bold;
}

.uploaded-files-list a:hover {
	color: #3D3D3D !important;
	text-decoration: none !important;
}

/* gestion de la mise en surbrillance du menu upload */
.upload-step {
  position: relative;
  padding: 10px;
  border-radius: 8px;
  transition: all 0.25s ease;
}

.upload-step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  color: #2C2C2C;
  margin-bottom: 8px;
}

.upload-step-badge {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #60B339;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px rgba(96, 179, 57, 0.18);
}

.upload-step.active {
  border: 2px solid #60B339;
  box-shadow: 0 4px 14px rgba(96, 179, 57, 0.18);
  background: #ffffff;
}

.upload-step.completed .upload-step-title::after {
  content: "✓";
  color: #60B339;
  font-weight: 800;
  margin-left: auto;
}

#menus.no-file-yet .menu {
  opacity: 0.55;
}

#menus.no-file-yet .menu.active {
  background: #E5E5E5;
  border-color: #adb5bd;
  border-width: 1px;
  box-shadow: none;
}

#menus.no-file-yet .menu-content {
  display: none;
}


/* Menus */
.menu {
	margin-bottom: 10px;
	padding: 10px;
	border: 1px solid #adb5bd;
	border-radius: 8px;
	background: #E5E5E5;
	overflow: hidden;
	max-width: 900px;
	transition: all 0.3s ease;
	cursor: pointer;
	position: relative;
}

.model-info {
	background-color: #000000;
	color: #E5E5E5;
	cursor: default;
}

.menu.active {
	max-height: 1500px;
	cursor: default;
	background: #ffffff;
	border-color: #4c8f2f;
	border-width: 2px;
	box-shadow: 0 4px 14px rgba(96, 179, 57, 0.14);
}

.menu.future {
  opacity: 0.78;
}

.menu h3 {
	margin: 0;
	font-size: 1.2em;
	color: #2C2C2C;
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu.model-info h3 {
	color: #FFFFFF;
}

.menu-content {
	margin-top: 10px;
	display: none;
}

.menu.active .menu-content {
	display: block;
	padding-bottom: 12px;
}

.menu img:not(.opt-img):not(.color-preview-img):not(#images img) {
  width: 200px;
  height: 200px;
  margin: 5px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  transition: 0.2s;
}

.menu img.selected {
	border-color: #198754;
}

/* === Menus numérotés === */
.step-badge {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #c7cdd3;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex: 0 0 auto;
  transition: all 0.25s ease;
}

.step-title {
  flex: 1;
}

.menu.active .step-badge {
  width: 36px;
  height: 36px;
  background: #60B339;
  color: #ffffff;
  font-size: 16px;
  box-shadow: 0 0 0 4px rgba(96, 179, 57, 0.18);
}

.menu.completed .step-badge {
  background: #60B339;
  opacity: 0.85;
}

.menu.completed h3::after {
  content: "✓";
  color: #60B339;
  font-weight: 800;
  margin-left: auto;
}

/* Aperçu couleur (menu 5) */
.color-image-container{
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.color-preview-img{
  width: clamp(90px, 18vw, 140px);
  height: auto;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #dee2e6;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  cursor: zoom-in;
}

#color-image-modal{
  z-index: 99999;
}

#color-image-modal .color-modal-content{
  background: transparent;
  box-shadow: none;
  padding: 0;
  width: auto;
  max-height: none;
  overflow: visible;
}

#color-image-modal-img{
  display: block;
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 16px 50px rgba(0,0,0,0.35);
  background: #fff;
}

/* Formulaires et boutons */
select, input[type=range], input[type=number], textarea {
	width: 100%;
	margin-top: 10px;
	padding: 8px;
	border: 1px solid #ced4da;
	border-radius: 5px;
	background: #ffffff;
}

select[multiple] {
	height: auto;
	min-height: 100px;
	background-color: #f9f9f9;
	border-radius: 8px;
	padding: 10px;
	font-size: 14px;
	border: 1px solid #ccc;
	box-sizing: border-box;
	overflow-y: auto;
}

select[multiple] option {
	padding-left: 25px;
	position: relative;
}

button {
	background-color: #60B339;
	color: white;
	border: none;
	padding: 10px;
	font-weight: bold;
	border-radius: 5px;
	cursor: pointer;
	margin-top: 10px;
}

button:hover {
	background-color: white;
	color: #60B339;
	border: 1px solid #60B339;
}

button.loading {
	opacity: 0.6;
	pointer-events: none;
	cursor: not-allowed;
}

.stl-btn {
  color: #FFFFFF !important;
  border: none;
  padding: 10px 16px;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  margin-top: 5px;
}

.stl-btn:hover {
	background-color: #FFFFFF !important;
	color: #60B339 !important;
	border: 1px solid #60B339;
}

/* Tableaux et quantité */
table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 10px;
}

table, th, td {
	border: 1px solid #ced4da;
}

th, td {
	padding: 8px;
	text-align: center;
}

.price-table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 20px;
	font-size: 14px;
}

.price-table th, .price-table td {
	border: 1px solid #dee2e6;
	padding: 8px;
	text-align: center;
}

.price-table th {
	background-color: #f1f3f5;
	font-weight: bold;
}

.price-table tbody tr:nth-child(even) {
	background-color: #f8f9fa;
}

.quantity-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-top: 10px;
}

.quantity-controls button {
	width: 40px;
	height: 40px;
	font-size: 20px;
	text-decoration: none !important;
}

.quantity-controls input {
	width: 60px;
	text-align: center;
}

.sym-devis-qty-locked{
  display:inline-block;
  min-width:2.2em;
  text-align:center;
  font-weight:600;
  padding:.35em .55em;
  border:1px solid #ddd;
  border-radius:6px;
  background:#f7f7f7;
}

/* Blocs d'information */
.constraint-info,
.material-info,
.color-info,
.recap-info,
.quantite-info {
	margin-top: 10px;
	padding: 10px;
	border: 1px solid #ccc;
	border-radius: 5px;
	font-size: 14px;
	color: #333;
	min-height: 40px;
}

.constraint-info,
.material-info,
.color-info {
	margin-bottom: 5px;
	background-color: #f8f9fa;
}

.recap-info,
.quantite-info {
	background-color: #f1f3f5;
	margin-bottom: 20px;
}

/* Contraintes */
.contrainte-row {
	display: flex;
	align-items: center;
	margin-bottom: 10px;
}

.contrainte-row select {
	flex: 1;
}

.contrainte-row button {
	margin-left: 10px;
	padding: 5px 10px;
	font-size: 18px;
	font-weight: bold;
	background-color: #60B339;
	color: #FFFFFF !important;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	text-decoration: none;
}

.contrainte-row button:hover {
	background-color: #3b6f99;
}

/* Sliders */
.slider-container {
	margin-top: 5px;
	text-align: left;
}

.slider-label {
	font-weight: bold;
	display: block;
	margin-bottom: 2px;
}

.slider-value {
	font-weight: bold;
	text-align: center;
	margin-top: 2px;
}

/* Options */
.options-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 10px;
}

#options-container.options-list{
  max-height: 55vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 6px;
}

.options-list label {
	display: flex;
	align-items: center;
	padding: 10px;
	border: 1px solid #ccc;
	border-radius: 6px;
	background-color: #f9f9f9;
	cursor: pointer;
	user-select: none;
}

.options-list label.opt-item{
  align-items: flex-start;
  gap: 10px;
}

.options-list label.opt-item input[type="checkbox"]{
  margin-top: 4px;
}

.options-list input[type="checkbox"] {
	margin-right: 10px;
	transform: scale(1.2);
}

.opt-text{
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.opt-title{
  font-weight: 700;
  color: #2C2C2C;
}

.opt-comment{
  font-size: 0.92em;
  color: #555;
  font-weight: 400;
  line-height: 1.25;
}

.opt-img{
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #dee2e6;
  background: #fff;
  flex: 0 0 auto;
}

/* Spinners / chargements */
#upload-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 1.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.upload-message {
  text-align: center;
}

.spinner {
  margin: 0 auto 10px;
  width: 40px;
  height: 40px;
  border: 6px solid #fff;
  border-top: 6px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.menu-spinner {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 10px;
	gap: 10px;
}

.menu-spinner .mini-spinner {
	width: 30px;
	height: 30px;
	border: 4px solid #ccc;
	border-top: 4px solid #4682B4;
	border-radius: 50%;
	animation: miniSpin 0.8s linear infinite;
}

.spinner-text {
    font-size: 14px;
    color: #4682B4;
    font-weight: 500;
}

.sym-module-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(2px);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.25s ease-out;
}

.sym-module-loading-overlay.sym-module-loading-hidden {
  opacity: 0;
  pointer-events: none;
}

.sym-module-loading-spinner {
  padding: 1.5rem 2rem;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  font-size: 1.1rem;
  font-weight: 500;
  color: #3D3D3D;
  text-align: center;
}

.sym-module-loading-ring {
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 3px solid #e0e0e0;
  border-top-color: #60B339;
  animation: symModuleSpin 0.9s linear infinite;
}

.sym-module-loading-text {
  font-size: 0.95rem;
}

.help-loading{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes miniSpin {
	to { transform: rotate(360deg); }
}

@keyframes symModuleSpin {
  to { transform: rotate(360deg); }
}

/* Modales */
.modal.stl-hidden {
  display: none;
}

.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 12px;
}

.modal-content{
  width: min(680px, 92vw);
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  max-height: min(90vh, 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.modal-content h3 { margin: 0 0 8px 0; }
.modal-sub { margin: 0 0 12px 0; color: #555; }
.modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:10px; }
.btn-outline { background:#fff; color:#60B339; border:1px solid #60B339; }

.duplicate-list { list-style: none; margin: 0; padding: 0;}
.duplicate-list li { border:1px solid #ddd; border-radius:8px; padding:10px; margin-bottom:8px; cursor:pointer; }
.duplicate-list li:hover { background:#f8f9fa; }

/* Viewer modal */
#stl-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

#stl-viewer-modal .modal-content {
  width: min(1200px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  padding: 20px;
}

#stl-viewer-modal h2 {
  margin: 0 0 8px 0;
}

#stl-viewer-modal .muted {
  margin-bottom: 10px;
}

#viewer-modal-content {
  width: 100%;
  height: clamp(60vh, 72vh, 82vh);
  min-height: 360px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

#stl-viewer-modal .close[data-close-modal] {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  color: #333;
  border: none;
  font-size: 26px;
  line-height: 1;
  padding: 0 6px;
  cursor: pointer;
}

/* Bouton ? dans le choix méthode */
.method-help-btn{
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 2px solid #60B339;
  background: #fff;
  color: #60B339;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
}

.method-help-btn:hover{
  background: #60B339;
  color: #fff;
}

/* FAQ dans la modale */
.method-help-faq details{
  border: 1px solid #dee2e6;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  background: #f8f9fa;
}

.method-help-faq summary{
  cursor: pointer;
  font-weight: 700;
  color: #2C2C2C;
  list-style: none;
}

.method-help-faq summary::-webkit-details-marker{ display:none; }

.method-help-faq .faq-answer{
  margin-top: 10px;
  color: #333;
  font-weight: 400;
}

.method-help-faq .muted{
  color: #666;
  font-size: 0.95em;
}

/* Responsive */
@media (max-width: 900px){
  #images{
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    gap: 12px;
    padding: 12px 0;
  }

  #images img{
    max-width: 130px;
  }

  .opt-img{
    width: 120px;
    height: 120px;
  }
}

@media (max-width: 768px) {
  .main-container { flex-direction: column; }

  .left-panel{
    width: 100%;
    min-width: 0;
    height: 30vh;
    border-right: none;
    border-bottom: 1px solid #dee2e6;
  }

  .central-panel{
    order: 2;
    height: auto;
  }

  .viewer-panel{
    order: 3;
    width: 100%;
    min-width: 0;
    border-left: none;
    border-top: 1px solid #dee2e6;
    height: 45vh;
  }

  .viewer{
    min-height: 280px;
  }
}

@media (max-width: 600px){
  #images{
    grid-template-columns: repeat(2, minmax(90px, 1fr));
    gap: 12px;
    padding: 10px 0;
  }

  #images img{
    max-width: 150px;
  }

  #images img.method-help-img{
    max-width: 64px;
  }

  #options-container.options-list{
    max-height: 45vh;
  }

  .options-list input[type="checkbox"]{
    transform: scale(1.05);
    margin-right: 8px;
  }

  .opt-title, .opt-comment{
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .opt-img{
    width: 34px;
    height: 34px;
    border-radius: 6px;
  }

  .modal-content{
    max-height: 85vh;
    max-height: 85dvh;
    padding: 14px;
  }

  #stl-viewer-modal .modal-content {
    width: 96vw;
    max-height: 94vh;
    padding: 14px;
    border-radius: 10px;
  }

  #viewer-modal-content {
    height: 65vh;
    min-height: 300px;
  }
}
