:root {
  --background: hsl(0, 0%, 98%);
  --foreground: hsl(240, 10%, 3.9%);
  --card: hsl(0, 0%, 100%);
  --card-foreground: hsl(240, 10%, 3.9%);
  --primary: hsl(204, 80%, 50%);
  --primary-foreground: hsl(0, 0%, 98%);
  --secondary: hsl(240, 4.8%, 95.9%);
  --secondary-foreground: hsl(240, 5.9%, 10%);
  --muted: hsl(240, 4.8%, 95.9%);
  --muted-foreground: hsl(240, 3.8%, 46.1%);
  --accent: hsl(204, 80%, 95%);
  --accent-foreground: hsl(204, 80%, 30%);
  --destructive: hsl(0, 84.2%, 60.2%);
  --destructive-foreground: hsl(0, 0%, 98%);
  --border: hsl(240, 5.9%, 90%);
  --input: hsl(240, 5.9%, 90%);
  --ring: hsl(204, 80%, 50%);
  --radius: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: hsl(240, 10%, 3.9%);
    --foreground: hsl(0, 0%, 98%);
    --card: hsl(240, 10%, 3.9%);
    --card-foreground: hsl(0, 0%, 98%);
    --primary: hsl(204, 80%, 50%);
    --primary-foreground: hsl(0, 0%, 98%);
    --secondary: hsl(240, 3.7%, 15.9%);
    --secondary-foreground: hsl(0, 0%, 98%);
    --muted: hsl(240, 3.7%, 15.9%);
    --muted-foreground: hsl(240, 5%, 64.9%);
    --accent: hsl(204, 80%, 25%);
    --accent-foreground: hsl(0, 0%, 98%);
    --border: hsl(240, 3.7%, 15.9%);
    --input: hsl(240, 3.7%, 15.9%);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 3rem;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  background-color: var(--accent);
  color: var(--accent-foreground);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

@media (min-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }
}

p {
  color: var(--muted-foreground);
  max-width: 36rem;
  margin: 0 auto;
}

/* Upload Area */
.upload-container {
  position: relative;
  width: 100%;
  max-width: 24rem;
  margin: 0 auto 1.5rem;
  height: 10rem;
  border: 2px dashed var(--muted-foreground);
  border-opacity: 0.3;
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-container:hover {
  border-color: var(--primary);
  border-opacity: 0.5;
}

.upload-container.active {
  border-color: var(--primary);
  border-opacity: 0.7;
  background-color: var(--accent);
  background-opacity: 0.5;
}

.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.upload-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
}

.upload-icon {
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

.upload-text {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.upload-subtext {
  font-size: 0.75rem;
}

.preview-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.image-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.remove-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background-color: var(--background);
  background-opacity: 0.8;
  backdrop-filter: blur(4px);
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Button */
.button-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.analyze-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--primary);
  color: var(--primary-foreground);
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.analyze-button:hover:not(:disabled) {
  opacity: 0.9;
}

.analyze-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loader */
.loader-container {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(var(--background), 0.8);
  backdrop-filter: blur(4px);
  z-index: 50;
  animation: fadeIn 0.3s ease;
}

.loader {
  position: relative;
  width: 4rem;
  height: 4rem;
}

.loader-ring {
  position: absolute;
  border-radius: 50%;
}

.loader-ring.outer {
  inset: 0;
  border-top: 2px solid var(--primary);
  animation: spin 1s linear infinite;
}

.loader-ring.middle {
  inset: 0.25rem;
  border-right: 2px solid var(--primary);
  opacity: 0.7;
  animation: spin 1s linear infinite reverse;
}

.loader-ring.inner {
  inset: 0.5rem;
  border-bottom: 2px solid var(--primary);
  opacity: 0.5;
  animation: spin 1.5s linear infinite;
}

.loader-text {
  margin-top: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  animation: pulse 2s infinite ease-in-out;
}

/* Result */
.result-container {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto 2rem;
  border: 1px solid var(--border);
  background-color: var(--card);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  animation: fadeUp 0.5s ease;
}

.result-title {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1.5rem;
}

.result-image-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.result-image {
  max-width: 100%;
  max-height: 16rem;
  object-fit: cover;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.divider {
  height: 1px;
  background-color: var(--border);
  margin: 1.5rem 0;
}

.analysis-content {
  color: var(--foreground);
}

.analysis-section {
  margin: 1rem 0;
  animation: fadeUp 0.5s ease;
  animation-fill-mode: both;
}

.analysis-section:nth-child(2) { animation-delay: 0.1s; }
.analysis-section:nth-child(3) { animation-delay: 0.2s; }
.analysis-section:nth-child(4) { animation-delay: 0.3s; }
.analysis-section:nth-child(5) { animation-delay: 0.4s; }

.analysis-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.analysis-text {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted-foreground);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeUp {
  from { 
    opacity: 0; 
    transform: translateY(10px);
  }
  to { 
    opacity: 1; 
    transform: translateY(0);
  }
}

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

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