/* Core layout */
.converter-card {
  max-width: 1100px;
  margin: 50px auto;
  background: rgba(12, 28, 45, 0.85);
  border-radius: 2rem;
  padding: 2rem;
  color: #e4f0ff;
  font-family: 'Inter', sans-serif;
  transition: 0.3s ease all;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(45, 98, 149, 0.3);
}

.deep-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.title-block h1 {
  background: linear-gradient(145deg, #c0e0ff, #70c8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0;
  font-size: 2.2rem;
  font-weight: 700;
}

.badge {
  background: #0e324d;
  padding: 6px 14px;
  border-radius: 1rem;
  border: 1px solid #2d8ad0;
  color: #bbe2ff;
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
}

.pay-tag {
  background: linear-gradient(135deg, #1e4a6e, #0f2c40);
  padding: 12px 24px;
  border-radius: 3rem;
  border: 1px solid #3d8fd1;
  font-weight: 600;
  box-shadow: 0 5px 15px rgba(0,160,255,0.2);
}

.pay-tag span:last-child {
  color: #90ffc0;
  font-size: 1.3rem;
  margin-left: 8px;
}

.grid-main {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin-top: 2rem;
}

/* Upload & preview */
.control-panel, .preview-panel {
  flex: 1 1 300px;
}

.section-label {
  text-transform: uppercase;
  font-size: 0.75rem;
  color: #8eb9f0;
  margin-bottom: 0.6rem;
  letter-spacing: 1px;
}

.drop-zone {
  background: #102536;
  border: 2px dashed #2d6295;
  border-radius: 1rem;
  text-align: center;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.drop-zone:hover { 
  background: #173c5e;
  border-color: #4da8ff;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0,100,255,0.2);
}

.drop-zone.dragover {
  background: #1d4a73;
  border-color: #70c8ff;
  transform: scale(1.02);
}

.file-label {
  background: #236f9e;
  color: white;
  padding: 0.8rem 1.4rem;
  border-radius: 40px;
  display: inline-block;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
  border: 1px solid #4da8ff;
}

.file-label:hover {
  background: #2d8ad0;
  transform: scale(1.05);
}

.file-name {
  margin-top: 0.8rem;
  color: #9ec9ff;
  font-size: 0.9rem;
  word-break: break-all;
  max-width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #236f9e, #1e5a85);
  color: #fff;
  border: none;
  padding: 14px 24px;
  border-radius: 40px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  width: 100%;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  border: 1px solid #4da8ff;
  box-shadow: 0 5px 15px rgba(0,100,255,0.2);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2d8ad0, #236f9e);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,160,255,0.3);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.image-preview-box {
  background: #0b1c2e;
  padding: 1rem;
  border-radius: 1.2rem;
  text-align: center;
  margin-bottom: 1rem;
  border: 1px solid #2d6295;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#previewImg {
  max-width: 100%;
  max-height: 300px;
  border-radius: 1rem;
  object-fit: contain;
}

.stl-preview-console {
  background: #0a1727;
  border-radius: 1rem;
  color: #a7c6f3;
  padding: 1rem;
  min-height: 120px;
  white-space: pre-wrap;
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  overflow-y: auto;
  border: 1px solid #2d4a6a;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background: #1a3f5a;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 15px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #70c8ff, #a0e0ff);
  width: 0%;
  transition: width 0.3s ease;
  animation: loading 2s infinite ease-in-out;
}

@keyframes loading {
  0% { width: 0%; opacity: 0.7; }
  50% { width: 70%; opacity: 1; }
  100% { width: 100%; opacity: 0.7; }
}

/* Animated Progress Dots */
.progress-anim {
  margin-top: 1.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  height: 40px;
}

.progress-anim span {
  width: 10px;
  height: 10px;
  background: #70c8ff;
  border-radius: 50%;
  animation: pulse 1.2s infinite ease-in-out;
}

.progress-anim span:nth-child(2) { animation-delay: 0.2s; }
.progress-anim span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.3); background: #a0e0ff; }
}

/* wavy background while uploading */
.uploading {
  background: linear-gradient(90deg, #143355 0%, #276aa0 50%, #143355 100%);
  background-size: 300% 300%;
  animation: wave 2.5s infinite linear;
  position: relative;
  overflow: hidden;
}

.uploading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: shine 1.5s infinite;
}

@keyframes shine {
  to { left: 100%; }
}

@keyframes wave {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

/* success flash */
.flash-success { 
  animation: flashGreen 1s ease-out; 
}

@keyframes flashGreen {
  0% { box-shadow: 0 0 0 rgba(0,255,128,0); }
  50% { box-shadow: 0 0 25px 10px rgba(0,255,128,0.45); }
  100% { box-shadow: 0 0 0 rgba(0,255,128,0); }
}

/* Error message styling */
.error-message {
  color: #ff8888;
  background: rgba(255,0,0,0.1);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ff5555;
  margin-top: 10px;
}

/* Success message styling */
.success-message {
  color: #90ffad;
  background: rgba(0,255,128,0.1);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #00ff80;
  margin-top: 10px;
}

/* Download button */
.download-btn {
  background: linear-gradient(135deg, #00aa55, #008844);
  color: white;
  padding: 12px 24px;
  border-radius: 40px;
  text-decoration: none;
  display: inline-block;
  margin-top: 12px;
  font-weight: 600;
  transition: 0.2s;
  border: 1px solid #00ff80;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,255,128,0.3);
  background: linear-gradient(135deg, #00cc66, #00aa55);
}

/* Responsive design */
@media (max-width: 768px) {
  .converter-card {
    margin: 20px;
    padding: 1.5rem;
  }
  
  .title-block h1 {
    font-size: 1.8rem;
  }
  
  .grid-main {
    flex-direction: column;
  }
}