@font-face {
  font-family: 'NanumSquareNeo';
  src: url('fonts/NanumSquareNeo-bRg.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'NanumSquareNeo-B';
  src: url('fonts/NanumSquareNeo-cBd.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: 'NanumSquareNeo-EB';
  src: url('fonts/NanumSquareNeo-dEb.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

:root {
  --primary-color: #84b179;
  --secondary-color: white;
  --accent-color: #a2cb8b;
  --text-color: #333;
  --border-radius: 12px;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'NanumSquareNeo', sans-serif;
}

body {
  background-color: #e8f5bd;
  color: var(--text-color);
  line-height: 1.6;
}

/* Header Styles */
.main-header {
  background: #f6f0d7;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-img {
  height: 60px;
  width: auto;
}

.logo h1 {
  font-size: 1.5rem;
  color: var(--primary-color);
  font-family: 'NanumSquareNeo-EB', sans-serif;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang-select {
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  background-color: white;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: 'NanumSquareNeo', sans-serif;
}

.lang-select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.btn-text {
  background: white;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  font-family: 'NanumSquareNeo-EB', sans-serif;
  transition: all 0.2s;
}

.btn-text:hover {
  background: var(--primary-color);
  color: white;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: transform 0.2s;
}

.btn-icon:hover {
  transform: rotate(30deg);
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  width: 90%;
  max-width: 400px;
}

.modal-content h3 {
  margin-bottom: 1rem;
  font-family: 'NanumSquareNeo-B', sans-serif;
}

#api-key-input {
  width: 100%;
  padding: 0.8rem;
  margin: 1rem 0;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.modal-btns {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Layout */
.main-layout {
  max-width: 1200px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
  margin-top: 2rem;
}

.content-area {
  min-width: 0; /* flex/grid item overflow fix */
}

.hero-section {
  font-size: 1rem;
  margin-left: 2rem;
  margin-bottom: 2rem;
  text-align: left;
}

/* Sidebar / My Page */
.sidebar h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.auth-container {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #f6f0d7;
}

.auth-msg {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 1rem;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 0.7rem;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-google:hover {
  background-color: #f8f9fa;
}

.btn-google img {
  width: 20px;
  height: 20px;
}

.logout {
  width: 100%;
  margin-top: 1rem;
  background-color: #f8f9fa !important;
  color: #888 !important;
  border-color: #eee !important;
}

.logout:hover {
  background-color: #ffebee !important;
  color: #d32f2f !important;
  border-color: #ffcdd2 !important;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar {
  width: 60px;
  height: 60px;
  background: #f6f0d7;
  border-radius: 50%;
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info .name {
  font-weight: bold;
  font-size: 1.3rem;
}

.info .email {
  font-size: 0.85rem;
  color: #888;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-item {
  background: var(--secondary-color);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}

.stat-item span:first-child {
  display: block;
  font-size: 0.75rem;
  color: #666;
}

.stat-item .count {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.recent-files h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.recent-files ul {
  list-style: none;
}

.history-item {
  background: white;
  padding: 0.8rem;
  border-radius: 8px;
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #eee;
}

.history-item:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.history-name {
  font-weight: bold;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-date {
  font-size: 0.75rem;
  color: #999;
}

.btn-delete {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  padding: 4px;
  font-size: 1.2rem;
  line-height: 1;
  transition: color 0.2s;
}

.btn-delete:hover {
  color: #ff4d4f;
}

.empty-msg {
  color: #999;
  font-size: 0.9rem;
  font-style: italic;
}

/* Container adjustment */
.container {
  max-width: 1150px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
/* (Header styles handled above) */

.card {
  background: #f6f0d7;
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 2rem;
}

.card h2 {
  font-family: 'NanumSquareNeo-B', sans-serif;
  margin-bottom: 1.5rem;
}

/* Drop Zone Styles */
.drop-zone {
  border: 2px dashed #ccc;
  border-radius: var(--border-radius);
  padding: 5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: var(--secondary-color);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--primary-color);
  background-color: #eef5ff;
}

.file-info {
  margin-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

/* Button Styles */
.btn {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: opacity 0.2s;
}

.btn.primary {
  background-color: var(--primary-color);
  color: white;
}

.btn.secondary {
  background-color: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn:hover {
  opacity: 0.9;
}

.action-area {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  padding-bottom: 2rem;
}

.quiz-action-area {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

/* Tabs */
.tab-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-btn {
  padding: 0.8rem 1.5rem;
  border: none;
  background: #ddd;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-weight: bold;
}

.tab-btn.active {
  background: white;
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Quiz Styles */
#quiz-list {
  margin-top: 1rem;
}

.quiz-item {
  background: #f9f9f9;
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 5px solid var(--primary-color);
  margin-bottom: 1.5rem;
}

.quiz-item p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.quiz-option {
  display: flex;
  align-items: center;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
}

.quiz-option:hover {
  background: #f0f7ff;
}

.quiz-option input {
  margin-right: 1rem;
  transform: scale(1.2);
}

.quiz-option.correct {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.quiz-option.wrong {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

/* Utilities */
.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}

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

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

  .sidebar {
    order: 2;
  }
}

.status-section {
  text-align: center;
  padding: 2rem;
}

/* Markdown styling */
.markdown-body {
  font-size: 1.1rem;
  color: #444;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  display: block;
  width: fit-content;
  background: linear-gradient(180deg, transparent 50%, #fff2ac 50%);
  padding: 0 4px;
  margin-top: 1.2rem;
  margin-bottom: 0.8rem;
  font-family: 'NanumSquareNeo-B', sans-serif;
  font-weight: bold;
  color: #333;
}

.markdown-body h1 {
  font-size: 1.8rem;
}
.markdown-body h2 {
  font-size: 1.6rem;
}
.markdown-body h3 {
  font-size: 1.4rem;
}
.markdown-body h4 {
  font-size: 1.2rem;
}

.markdown-body strong {
  background: linear-gradient(180deg, transparent 70%, #fcd601 70%);
  padding: 0 2px;
  font-family: 'NanumSquareNeo-B', sans-serif;
}

.markdown-body ul,
.markdown-body ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}
