* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f5f5f5;
}

.container {
  background-color: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
  color: #333;
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.subtitle {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 25px;
  line-height: 1.4;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #555;
  font-size: 0.95rem;
}

input[type="number"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

/* Drag and drop area */
.drop-area {
  border: 3px dashed #4caf50;
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #f9f9f9;
  position: relative;
}

.drop-area.dragover {
  background-color: #e8f5e9;
  border-color: #2e7d32;
  transform: scale(1.02);
}

.drop-area:hover {
  background-color: #f0f0f0;
  border-color: #45a049;
}

.drop-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  color: #4caf50;
}

.drop-text {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 5px;
}

.drop-subtext {
  font-size: 0.9rem;
  color: #666;
}

#image {
  display: none;
}

.dimension-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

button {
  width: 100%;
  padding: 14px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: background-color 0.3s;
  touch-action: manipulation;
}

button:hover {
  background-color: #45a049;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: none;
}

#status {
  margin-top: 20px;
  padding: 12px;
  border-radius: 5px;
  display: none;
  font-size: 0.95rem;
}

.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Image previews */
.images-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 30px;
  gap: 20px;
}

.image-preview {
  text-align: center;
}

.image-preview h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: #333;
}

.image-wrapper {
  position: relative;
  border: 1px solid #ddd;
  border-radius: 5px;
  overflow: hidden;
  background-color: #f9f9f9;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 5px;
}

.image-info {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #666;
}

.image-info-label {
  font-weight: bold;
  color: #333;
}

/* Loading animation - shimmer effect */
.loading-shimmer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Pulse animation for loading state */
.loading-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Loading container styles */
.loading-container {
  text-align: center;
  padding: 40px;
}

.loading-icon {
  font-size: 3rem;
  color: #4caf50;
  margin-bottom: 10px;
}

.loading-text {
  color: #666;
}

.download-btn-container {
  margin-top: 20px;
  text-align: center;
}

footer {
  text-align: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  color: #666;
  font-size: 0.9rem;
}

footer a {
  color: #4caf50;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.mode-toggle {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.mode-toggle button {
  flex: 1;
  padding: 10px;
  background-color: #f0f0f0;
  color: #333;
  border: 2px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
}

.mode-toggle button.active {
  background-color: #4caf50;
  color: white;
  border-color: #4caf50;
}

.mode-toggle button:hover:not(.active) {
  background-color: #e0e0e0;
}

.dimension-mode {
  display: none;
}

.dimension-mode.active {
  display: block;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .images-container {
    grid-template-columns: 1fr;
  }

  .dimension-inputs {
    grid-template-columns: 1fr;
  }

  .image-preview h3 {
    font-size: 1.1rem;
  }

  .image-info {
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 15px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .drop-area {
    padding: 30px 20px;
  }

  .drop-icon {
    font-size: 2.5rem;
  }

  .drop-text {
    font-size: 1rem;
  }

  input[type="number"] {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  button {
    padding: 16px; /* Larger tap target for mobile */
  }
}

/* Landscape mobile */
@media (max-width: 900px) and (orientation: landscape) {
  body {
    padding: 15px;
  }

  .container {
    padding: 20px;
  }
}

/* Tablets */
@media (min-width: 601px) and (max-width: 900px) {
  body {
    padding: 30px 20px;
  }
}
