@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
  --primary-color: #3498db;
  --background-color: #f4f7f6;
  --container-bg-color: #ffffff;
  --text-color: #333;
  --light-gray-color: #ecf0f1;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --completed-color: #2ecc71;
  --in-progress-color: #f1c40f;
  --not-started-color: #e74c3c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Pretendard', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

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

header {
  background-color: var(--primary-color);
  color: white;
  padding: 1.2rem;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow: 0 2px 4px var(--shadow-color);
}

main {
  padding: 1.5rem;
}

.container {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

#student-list-container, #student-details-container {
  background-color: var(--container-bg-color);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px var(--shadow-color);
}

#student-list-container { 
  flex-basis: 30%;
  align-self: flex-start; 
}

#student-details-container {
  flex-basis: 70%;
  min-height: 400px;
}

h2, h3 {
  margin-bottom: 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--light-gray-color);
  font-size: 1.25rem;
}

#student-list {
  list-style-type: none;
}

.student-item {
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
}

.student-item:hover {
  background-color: #f0f7ff;
}

.student-item.active {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.workbook-list {
  list-style-type: none;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.workbook-list li {
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 0.95rem;
  background-color: var(--light-gray-color);
  color: #666;
}

.workbook-list li.active {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 6px rgba(52, 152, 219, 0.2);
}

.chapter-list-container ul {
  list-style-type: none;
}

.chapter-list-container li {
  padding: 0.8rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.6rem;
  font-weight: 500;
  position: relative;
  padding-left: 2.5rem;
  background-color: #fff;
  border: 1px solid #f0f0f0;
}

.chapter-list-container li::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.status-completed { background-color: #f1fcf6; border-color: #d1f2e1; }
.status-completed::before { background-color: var(--completed-color); }

.status-in-progress { background-color: #fffdf2; border-color: #fef5d1; }
.status-in-progress::before { background-color: var(--in-progress-color); }

.status-not-started { background-color: #fff5f5; border-color: #fed7d7; }
.status-not-started::before { background-color: var(--not-started-color); }

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--light-gray-color);
  padding-bottom: 0.8rem;
}

.details-header h2 {
  margin-bottom: 0;
  border-bottom: none;
}

.calendar-btn {
  background-color: white;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
}

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

.upload-btn {
  background-color: var(--completed-color);
  color: white;
  border: none;
  padding: 0.8rem 1.8rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  transition: all 0.2s;
  box-shadow: 0 4px 6px rgba(46, 204, 113, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.upload-btn:hover {
  background-color: #27ae60;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(46, 204, 113, 0.3);
}

.upload-btn:active {
  transform: translateY(0);
}

.upload-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  overflow-y: auto;
}

.modal-content {
  background-color: white;
  margin: 2rem auto;
  padding: 1.5rem;
  border-radius: 16px;
  width: 95%;
  max-width: 550px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(-20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid #eee;
}

#modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary-color);
}

.close {
  font-size: 32px;
  font-weight: 300;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.close:hover { color: #333; }

.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  background-color: #f0f4f8;
  padding: 0.8rem 1rem;
  border-radius: 10px;
}

#calendar-month-year {
  margin-bottom: 0;
  border-bottom: none;
  font-size: 1.15rem;
  font-weight: 800;
  color: #444;
}

.nav-btn {
  background-color: white;
  border: 1px solid #ddd;
  color: var(--primary-color);
  font-size: 1.1rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

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

/* Calendar Table Styles */
.calendar-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  margin-bottom: 1.5rem;
}

.calendar-table th {
  padding: 0.5rem;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
  font-weight: 600;
}

.calendar-table td {
  width: 14.28%;
  aspect-ratio: 1 / 1;
  text-align: center;
  vertical-align: middle;
  border-radius: 10px;
  border: 1px solid #f0f0f0;
  background-color: #fff;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  font-size: 1rem;
}

.calendar-table td:hover:not(:empty) {
  background-color: #f0f7ff;
  border-color: #cce3f5;
}

.calendar-table td.selected {
  background-color: #e3f2fd;
  border-color: var(--primary-color);
}

.calendar-table td.has-photos .date-num {
  color: var(--primary-color);
  font-weight: 900;
}

.calendar-table td.selected.has-photos .date-num {
  color: var(--primary-color);
}

.date-num {
  font-weight: 700;
  color: #444;
}

#selected-date-info {
  background-color: #f9f9f9;
  padding: 1.2rem;
  border-radius: 12px;
  text-align: center;
  border: 1px solid #eee;
}

.info-msg {
  color: #777;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 1rem;
}

.img-wrapper {
  position: relative;
  width: 100%;
}

.gallery-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  transition: all 0.2s;
  border: 2px solid white;
}

.del-img-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 24px;
  height: 24px;
  background-color: var(--not-started-color);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}

.del-img-btn:hover {
  transform: scale(1.2);
  background-color: #c0392b;
}

.gallery-img:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.no-photo {
  grid-column: 1 / -1;
  color: #bbb;
  font-size: 0.9rem;
  padding: 1rem 0;
}

/* Status Legend Styles */
.status-legend {
  margin-top: 2.5rem;
  padding: 1.2rem;
  background-color: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #eee;
  font-size: 0.9rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.8rem;
  color: #555;
  line-height: 1.4;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-completed { background-color: var(--completed-color); }
.dot-in-progress { background-color: var(--in-progress-color); }
.dot-not-started { background-color: var(--not-started-color); }

/* Mobile Responsiveness Enhanced */
@media (max-width: 768px) {
  header {
    padding: 1rem;
    font-size: 1.2rem;
  }

  main {
    padding: 1rem;
  }

  .container {
    flex-direction: column;
    gap: 1rem;
  }

  #student-list-container, #student-details-container {
    flex-basis: 100%;
    padding: 1rem;
    border-radius: 10px;
  }

  #student-details-container {
    min-height: auto;
  }

  .details-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .calendar-btn {
    width: 100%;
    text-align: center;
    padding: 0.8rem;
  }

  .workbook-list li {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .modal-content {
    margin: 1rem auto;
    width: 95%;
    padding: 1rem;
    border-radius: 12px;
  }

  .calendar-table td {
    height: auto;
    padding: 12px 0;
    font-size: 1rem;
  }

  .photo-gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .gallery-img {
    border-radius: 6px;
  }
  
  .upload-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
  }
}

@media (max-width: 380px) {
  .photo-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}
