/* Reset y configuración base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:not(:defined) > * {
  display: none;
}

html {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  overflow-x: hidden;
}

/* Header */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 1rem 0;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  text-align: center;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.header p {
  font-size: 1.1rem;
  color: #666;
  font-weight: 400;
}

/* Model Selector */
.model-selector {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.model-selector label {
  font-weight: 600;
  color: white;
  font-size: 1.1rem;
}

.model-selector select {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 250px;
}

.model-selector select:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Controls Panel */
.controls-panel {
  max-width: 1200px;
  margin: 1rem auto;
  padding: 0 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.control-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.control-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.control-btn:active {
  transform: translateY(0);
}

/* AR Container */
.ar-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
  position: relative;
}

model-viewer {
  width: 100%;
  height: 70vh;
  min-height: 500px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  position: relative;
}

/* Progress Bar */
.progress-bar {
  display: block;
  width: 300px;
  height: 8px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate3d(-50%, -50%, 0);
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.9);
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
}

.progress-bar.hide {
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.update-bar {
  background: linear-gradient(90deg, #667eea, #764ba2);
  width: 0%;
  height: 100%;
  border-radius: 20px;
  transition: width 0.3s ease;
}

/* Loading Message */
.loading-message {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  background: rgba(0, 0, 0, 0.8);
  padding: 2rem;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  background: rgba(220, 53, 69, 0.9);
  padding: 2rem;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.error-message.hide {
  display: none;
}

#retry-btn {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  background: white;
  color: #dc3545;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#retry-btn:hover {
  background: #f8f9fa;
  transform: translateY(-2px);
}

/* AR Button */
#ar-button {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 25px;
  padding: 1rem 2rem;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 2rem;
}

#ar-button:hover {
  transform: translateX(-50%) translateY(-3px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}

#ar-button:active {
  transform: translateX(-50%) translateY(-1px);
}

.ar-icon {
  font-size: 1.2rem;
}

/* AR Prompt */
#ar-prompt {
  position: absolute;
  left: 50%;
  bottom: 80px;
  animation: elongate 2s infinite ease-in-out alternate;
  display: none;
}

model-viewer[ar-status="session-started"] > #ar-prompt {
  display: block;
}

#ar-prompt > img {
  animation: circle 4s linear infinite;
  border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

@keyframes circle {
  from { transform: translateX(-50%) rotate(0deg) translateX(50px) rotate(0deg); }
  to   { transform: translateX(-50%) rotate(360deg) translateX(50px) rotate(-360deg); }
}

@keyframes elongate {
  from { transform: translateX(100px); }
  to   { transform: translateX(-100px); }
}

/* Info Panel */
.info-panel {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.info-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.info-content h3 {
  color: #333;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
}

.info-content ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.info-content li {
  padding: 1rem;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.info-content li:hover {
  background: rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

/* Footer */
.footer {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  text-align: center;
  padding: 2rem;
  margin-top: 3rem;
  backdrop-filter: blur(10px);
}

.footer p {
  font-weight: 400;
  opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }
  
  .header p {
    font-size: 1rem;
  }
  
  .model-selector {
    flex-direction: column;
    align-items: stretch;
  }
  
  .model-selector select {
    min-width: auto;
  }
  
  .controls-panel {
    flex-direction: column;
  }
  
  .control-btn {
    width: 100%;
  }
  
  model-viewer {
    height: 60vh;
    min-height: 400px;
  }
  
  .info-content ul {
    grid-template-columns: 1fr;
  }
  
  .progress-bar {
    width: 250px;
  }
}

@media (max-width: 480px) {
  .header-content,
  .model-selector,
  .controls-panel,
  .ar-container,
  .info-panel {
    padding: 0 1rem;
  }
  
  .header h1 {
    font-size: 1.8rem;
  }
  
  model-viewer {
    height: 50vh;
    min-height: 350px;
  }
  
  .progress-bar {
    width: 200px;
  }
  
  #ar-button {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  }
  
  .info-content {
    background: rgba(255, 255, 255, 0.1);
    color: white;
  }
  
  .info-content h3 {
    color: white;
  }
  
  .info-content li {
    background: rgba(255, 255, 255, 0.1);
    color: white;
  }
  
  .info-content li:hover {
    background: rgba(255, 255, 255, 0.2);
  }
}