* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  min-height: 100vh;
}

#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  padding: 20px 0 30px;
}

header h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: #888;
  margin-top: 6px;
  font-size: 0.95rem;
}

/* Main Layout */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 30px;
  align-items: start;
}

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Camera Area */
.tryon-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#camera-container {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 4 / 3;
  background: #1a1a2e;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid #2a2a4a;
}

#webcam {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #aaa;
  font-size: 0.9rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#no-face-warning {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 80, 80, 0.85);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.hidden {
  display: none !important;
}

/* Camera Controls */
.camera-controls {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn {
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.btn-secondary {
  background: #2a2a4a;
  color: #ccc;
}

.btn-accent {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: white;
}

/* Product List */
.product-list {
  background: #16162a;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid #2a2a4a;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.product-list h2 {
  font-size: 1.2rem;
  margin-bottom: 18px;
  color: #bbb;
}

.glasses-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Glasses Card */
.glasses-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: #1e1e38;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.glasses-card:hover {
  border-color: #444;
  background: #242448;
}

.glasses-card.active {
  border-color: #667eea;
  background: #1e1e48;
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.15);
}

.glasses-card .preview {
  width: 80px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.glasses-card .preview svg {
  width: 100%;
  height: 100%;
}

.glasses-card .info {
  flex: 1;
  min-width: 0;
}

.glasses-card .info .name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #e0e0e0;
}

.glasses-card .info .style {
  font-size: 0.8rem;
  color: #888;
  margin-top: 2px;
}

.glasses-card .info .price {
  font-size: 0.85rem;
  color: #667eea;
  font-weight: 600;
  margin-top: 4px;
}

/* Remove glasses button */
.glasses-card-none {
  justify-content: center;
  color: #888;
  font-size: 0.9rem;
}

.glasses-card-none.active {
  border-color: #f5576c;
  color: #f5576c;
}

.glasses-card.loading {
  opacity: 0.6;
  pointer-events: none;
}

.glasses-card.loading::after {
  content: 'Loading...';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: #667eea;
}

/* Scrollbar */
.product-list::-webkit-scrollbar {
  width: 6px;
}

.product-list::-webkit-scrollbar-track {
  background: transparent;
}

.product-list::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}
