* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 0px;
  color: #333;
}

.container {
  max-width: 400px;
  margin: 0 auto;
  background: white;
  border-radius: 0px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  min-height: 100vh;
  overflow-y: auto;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  text-align: center;
  position: relative;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.step-indicator {
  font-size: 0.9rem;
  opacity: 0.9;
}

.content {
  padding: 30px 20px;
  text-align: center;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 40px;
}

.step-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
}

.step-subtitle {
  color: #666;
  margin-bottom: 30px;
  line-height: 1.4;
}

.camera-container {
  position: relative;
  margin-bottom: 20px;
  border-radius: 15px;
  overflow: hidden;
  background: #f5f5f5;
}

#video,
#video2 {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: none;
  border-radius: 15px;
}

.preview-image {
  width: 100%;
  height: 250px;
  object-fit: contain;
  border-radius: 15px;
  display: none;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
}

.camera-placeholder {
  width: 100%;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border: 2px dashed #ddd;
  border-radius: 15px;
  color: #999;
  font-size: 1.1rem;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}

.btn {
  padding: 15px 20px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: #f8f9fa;
  color: #333;
  border: 2px solid #e9ecef;
  width: 100%;
}

.btn-secondary:hover {
  background: #e9ecef;
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
  color: white;
  width: 100%;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(86, 171, 47, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 65, 108, 0.3);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

#fileInput {
  display: none;
}

.camera-controls {
  display: none;
  gap: 15px;
  margin-top: 15px;
}

.camera-controls.active {
  display: flex;
}

.success-message {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
  color: white;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 20px;
  font-weight: 600;
}

.error-message {
  background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
  color: white;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 20px;
  font-weight: 600;
}

.processing-message {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.image-preview-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}

.image-preview-item {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #e9ecef;
}

.image-preview-item h3 {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 10px;
}

.image-preview-item img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
  border: 1px solid #e9ecef;
}

.saved-images {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid #e9ecef;
}

.saved-images h3 {
  font-size: 1rem;
  color: #333;
  margin-bottom: 10px;
}

.saved-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.saved-item {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.saved-item:hover {
  border-color: #667eea;
}

.saved-item.selected {
  border-color: #56ab2f;
  box-shadow: 0 0 10px rgba(86, 171, 47, 0.3);
}

.saved-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.saved-item .delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 65, 108, 0.9);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.download-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(86, 171, 47, 0.9);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.download-btn:hover {
  background: rgba(86, 171, 47, 1);
  transform: scale(1.1);
}

/* Mobile-first responsive design */
@media (min-width: 768px) {
  body {
    padding: 20px;
  }
  .container {
    max-width: 500px;
    border-radius: 20px;
    min-height: 600px;
    overflow-y: visible;
  }

  .welcome-container {
    border-radius: 20px;
    padding: 40px 30px;
    min-height: auto;
    width: auto;
    padding-top: 40px; /* Reset to original */
    padding-bottom: 30px; /* Reset to original */
  }

  .welcome-screen {
    padding: 20px;
  }

  .credits-container {
    border-radius: 20px;
    padding: 30px;
    min-height: auto;
    padding-top: 30px; /* Reset to original */
    padding-bottom: 30px; /* Reset to original */
    overflow-y: visible; /* Reset overflow for larger screens */
  }

  .credits-screen {
    padding: 20px;
  }

  .content {
    padding: 40px 30px;
    padding-top: 40px; /* Reset to original */
    min-height: 500px; /* Reset to original */
  }

  #video,
  #video2,
  .preview-image,
  .camera-placeholder {
    height: 300px;
  }

  .button-group {
    flex-direction: row;
  }

  .btn {
    flex: 1;
  }

  .camera-controls {
    justify-content: center;
  }

  .saved-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .container {
    margin-top: 0;
  }
}

/* Loading animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Icons using CSS */
.icon-camera::before {
  content: "📷";
  font-size: 1.2rem;
}

.icon-upload::before {
  content: "📁";
  font-size: 1.2rem;
}

.icon-capture::before {
  content: "📸";
  font-size: 1.2rem;
}

.icon-next::before {
  content: "➡️";
  font-size: 1rem;
}

.icon-restart::before {
  content: "🔄";
  font-size: 1rem;
}

.icon-api::before {
  content: "🚀";
  font-size: 1rem;
}

.icon-download::before {
  content: "⬇️";
  font-size: 1rem;
}

.icon-retry::before {
  content: "🔄";
  font-size: 1rem;
}

/* Credits Info Button on Welcome Screen */
.credits-info-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(102, 126, 234, 0.3);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.credits-info-btn:hover {
  transform: scale(1.1);
  background: white;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

/* Back Navigation Button for Steps */
.back-nav-btn {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #333;
  margin-top: 20px;
  width: 100%;
}

.back-nav-btn:hover {
  background: #e9ecef;
  transform: translateX(-3px);
}

.step {
  display: flex;
  flex-direction: column;
}

/***********welcome*******/
.welcome-screen {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px;
  text-align: center;
}

.welcome-container {
  max-width: 400px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0px;
  padding: 40px 20px;
  width: 100%;
  min-height: 100vh;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  color: #333;
  backdrop-filter: blur(10px);
  padding-top: 50px;
  padding-bottom: 40px;
}

.welcome-logo {
  font-size: 3rem;
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}

.welcome-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 30px;
  line-height: 1.5;
}

.welcome-features {
  list-style: none;
  margin-bottom: 40px;
  text-align: left;
}

.welcome-features li {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  font-size: 1rem;
  color: #555;
}

/* .welcome-features li::before {
  content: "✨";
  font-size: 1.2rem;
  margin-right: 12px;
} */

.welcome-btn-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.get-started-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 18px 40px;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  min-width: 200px;
  width: 100%;
}

.get-started-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.get-started-btn:active {
  transform: translateY(-1px);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.welcome-screen.fade-out {
  opacity: 0;
  transform: scale(0.95);
  transition: all 0.5s ease;
}

.help-btn-wrapper {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.second-welcome-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 18px 0px;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  flex: 1;
  min-width: 0;
}

/* Hide main container initially */
.container.hidden {
  display: none;
}

/* Responsive adjustments for welcome screen */
@media (max-width: 480px) {
  .welcome-container {
    padding: 30px 20px;
    margin: 10px;
  }

  .welcome-logo {
    font-size: 2rem;
  }

  .welcome-title {
    font-size: 1.7rem;
  }

  .welcome-subtitle {
    font-size: 1rem;
  }
}

/*****************Credits****************************/
/* Credits Screen Styles */
.credits-screen {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px;
}

.credits-screen.hidden {
  display: none;
}

.credits-container {
  max-width: 500px;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 0px;
  padding: 30px 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  min-height: 100vh;
  display: flex; /* Added */
  flex-direction: column; /* Added */
  justify-content: center; /* Added to center content */
  padding-top: 50px; /* Added extra top padding for phone notch */
  padding-bottom: 40px; /* Added bottom padding for balance */
  overflow-y: auto;
}

.credits-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 10px;
}

.credits-header h1 {
  font-size: 1.8rem;
  color: #333;
  margin: 0;
}

.back-btn {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #333;
}

.back-btn:hover {
  background: #e9ecef;
  transform: translateX(-3px);
}

.credits-balance {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.balance-label {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 10px;
}

.balance-amount {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.balance-subtitle {
  font-size: 0.85rem;
  opacity: 0.8;
}

.credits-info {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 15px;
}

.info-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 10px;
  flex-shrink: 0;
}

.info-title {
  font-weight: 600;
  color: #333;
  font-size: 0.95rem;
}

.info-desc {
  font-size: 0.85rem;
  color: #666;
}

.credits-packages h3 {
  font-size: 1.2rem;
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.package-card {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
}

.package-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border-color: #667eea;
}

.package-card.popular {
  border-color: #56ab2f;
  background: linear-gradient(135deg, #f8fff4 0%, #ffffff 100%);
}

.popular-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.package-credits {
  font-size: 1.3rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
}

.package-price {
  font-size: 1.1rem;
  color: #667eea;
  font-weight: 600;
  margin-bottom: 15px;
}

.package-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.package-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.insufficient-msg {
  background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
  color: white;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .package-grid {
    grid-template-columns: 1fr;
  }

  .credits-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
}

.credits-header-buttons {
  display: flex;
  gap: 10px;
}

.logo-wrapper {
  --size: 100px;
  height: var(--size);
  width: var(--size);
  overflow: hidden;
  object-fit: contain;
}

.logo-wrapper img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

/**********************MODAL*********/

/* Modal overlay */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  transition: opacity 0.3s ease;
  opacity: 0;
}

/* Modal active state */
.modal.show {
  display: block;
  opacity: 1;
  animation: fadeIn 0.3s ease forwards;
}

/* Modal content box */
.modal-content {
  background: #fff;
  margin: 10% auto;
  padding: 20px;
  border-radius: 12px;
  max-width: 420px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: slideUp 0.3s ease;
}

/* Close button */
.close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 28px;
  cursor: pointer;
  color: #333;
  transition: color 0.2s;
}
.close-btn:hover {
  color: #007bff;
}

/* Modal sections */
.modal-section {
  margin-top: 16px;
}

.modal-section h3 {
  margin-bottom: 8px;
  font-size: 18px;
  color: #333;
}

/* YouTube button */
.yt-btn {
  padding: 10px 18px;
  background: #ff0000;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}
.yt-btn:hover {
  background: #cc0000;
}

/* Email link */
.email-link {
  color: #007bff;
  text-decoration: none;
}
.email-link:hover {
  text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Mobile friendly */
@media (max-width: 480px) {
  .modal-content {
    margin: 20% 16px;
    padding: 16px;
  }
}

.mode-selection {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 30px;
}

.mode-btn {
  flex: 1;
  min-width: 200px;
  padding: 20px 30px;
  font-size: 18px;
  font-weight: 600;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.fashion-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.fashion-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.decor-btn {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.decor-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
}

.mode-btn span {
  font-size: 24px;
}

.placement-input {
  margin: 20px 0;
  padding: 15px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.placement-input h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #333;
}

.placement-input input {
  width: 100%;
  padding: 12px;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 8px;
  color: #333;
  font-size: 14px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.placement-input input::placeholder {
  color: #999;
}

.placement-input input:focus {
  outline: none;
  border-color: #667eea;
  background: #fff;
}

.placement-input small {
  display: block;
  margin-top: 8px;
  color: #666;
  font-size: 12px;
}
