/* 공통 스타일 (라이트/다크 공통) */
body {
  font-family: 'Segoe UI', 'Malgun Gothic', sans-serif;
  text-align: center;
  margin: 0;
  padding: 2rem 1rem;
  transition: background-color 0.3s, color 0.3s;
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  transition: color 0.3s;
}

p {
  font-size: 1rem;
  margin: 0.5rem 0;
}

input[type="file"] {
  margin-top: 1.2rem;
  padding: 1rem;
  border: 2px dashed;
  border-radius: 1rem;
  background-color: #ffffff;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s;
}

/* 결과 이미지 + 텍스트 */
#result-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.7s ease-out forwards;
}

#preview {
  margin-bottom: 1rem;
  max-width: 90%;
  border-radius: 1rem;
  border: 4px solid;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: border-color 0.3s;
}

#result {
  font-size: 1.4rem;
  font-weight: bold;
  padding: 1rem;
  border-radius: 0.8rem;
  border: 2px solid;
  text-align: center;
  max-width: 90%;
  animation: fadeIn 0.5s ease-in;
}

/* 병해 리스트 */
#disease-list {
  text-align: left;
  display: inline-block;
  margin: 1rem auto;
  font-size: 1.1rem;
  line-height: 1.6;
}

/* 병해 예시 카드 */
.disease-examples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

.disease-card {
  background-color: #ffffff;
  border: 2px solid;
  padding: 0.5rem;
  border-radius: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  text-align: center;
  width: 140px;
  transition: transform 0.2s;
}

.disease-card:hover {
  transform: scale(1.05);
}

.disease-card img {
  width: 100%;
  border-radius: 0.5rem;
}

.disease-card p {
  margin-top: 0.5rem;
  font-weight: bold;
}

/* 고지 문구 */
.disclaimer {
  font-size: 0.95rem;
  padding: 1rem;
  border-radius: 0.5rem;
  border-left: 5px solid;
  max-width: 500px;
  margin: 2rem auto 0;
  line-height: 1.6;
  animation: fadeIn 1s ease-in;
}

/* 라이트 모드 색상 */
body {
  background-color: #f6fff2;
  color: #2c3e50;
}

input[type="file"] {
  border-color: #a2d5a2;
}

#preview {
  border-color: #c8f2c8;
}

#result {
  background-color: #eaffea;
  border-color: #66bb6a;
  color: #145a32;
}

.disease-card {
  border-color: #c8e6c9;
}

.disease-card p {
  color: #2e7d32;
}

.disclaimer {
  color: #8e44ad;
  background-color: #fdf4ff;
  border-color: #ba68c8;
}

/* 다크 모드 설정 */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1e1e1e;
    color: #eeeeee;
  }

  h1 {
    color: #81c784;
  }

  input[type="file"] {
    background-color: #2e2e2e;
    border-color: #66bb6a;
    color: #fff;
  }

  #preview {
    border-color: #66bb6a;
  }

  #result {
    background-color: #2e7d32;
    border-color: #81c784;
    color: #ffffff;
  }

  .disease-card {
    background-color: #2c2c2c;
    border-color: #81c784;
  }

  .disease-card p {
    color: #a5d6a7;
  }

  .disclaimer {
    background-color: #3a2f4b;
    color: #e1bee7;
    border-color: #ab47bc;
  }
}

/* 애니메이션 정의 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* 모바일 대응 */
@media screen and (max-width: 480px) {
  h1 {
    font-size: 1.6rem;
  }

  input[type="file"] {
    width: 100%;
    font-size: 0.95rem;
  }

  #preview {
    width: 100%;
  }

  #result {
    font-size: 1.2rem;
    padding: 0.8rem;
  }

  .disease-card {
    width: 45%;
  }

  #disease-list {
    font-size: 1rem;
  }
}


#language-select {
  margin-bottom: 1rem;
}

#language-select button {
  background-color: #ffffff;
  border: 1px solid #ccc;
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  margin: 0 0.3rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

#language-select button:hover {
  background-color: #f0f0f0;
}

#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1em auto;
  color: var(--text-color);
  font-weight: bold;
  animation: fadein 0.3s ease;
}

.spinner {
  border: 6px solid #ddd;
  border-top: 6px solid #4caf50;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 0.5em;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
