/* Body & Base */
body {
  font-family: 'Segoe UI', sans-serif;
  padding: 2em;
  background-color: #121212;
  color: #f5f5f5;
  transition: background 0.3s;
}

/* Title Styling */
#mainTitle {
  color: #ff9800;
  font-size: 1.8em;
  margin: 0;
  padding-bottom: 0.2em;
  border-bottom: 2px solid #ff9800;
}

/* Toggle Button */
#viewToggle {
  background: #ff9800;
  border: none;
  color: #121212;
  padding: 0.3em 0.7em;
  font-size: 0.95em;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

#viewToggle:hover {
  background: #ffa726;
  transform: scale(1.05);
}

/* Total Progress Bar */
#overallProgressContainer {
  margin-bottom: 1.5em;
}

#overallStats {
  margin-top: 0.5em;
  font-size: 0.95em;
  color: #ffcc80;
}

/* Total Summary Box */
.total-summary {
  margin-top: 2em;
  padding: 1em;
  background: #2a2a2a;
  border-radius: 8px;
  font-weight: bold;
  color: #ffcc80;
  box-shadow: 0 2px 6px rgba(255, 152, 0, 0.2);
}

/* Subject Card */
.subject {
  background: #1e1e1e;
  padding: 1em;
  border-radius: 10px;
  box-shadow: 0 3px 6px rgba(255, 152, 0, 0.2);
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  margin-bottom: 2em; /* more gap in list view */
}

.subject:hover {
  background: #2a2a2a;
}

/* Subject Title */
.subject-title {
  font-weight: bold;
  font-size: 1.1em;
  color: #ffca28;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Remaining Time */
.remaining {
  font-size: 0.9em;
  color: #ffcc80;
}

/* Lecture Item */
.lecture-item {
  padding: 0.4em;
  display: flex;
  align-items: center;
  gap: 0.5em;
  background: #2a2a2a;
  margin: 0.3em 0;
  border-radius: 6px;
  color: #f5f5f5;
}

.lecture-item label {
  flex: 1;
  font-size: 0.95em;
}

/* Checkbox */
input[type="checkbox"] {
  transform: scale(1.2);
  accent-color: #ffb300;
}

/* Progress Bar */
.progress-bar {
  background: #333;
  border-radius: 8px;
  overflow: hidden;
  height: 24px;
  position: relative;
}

.progress {
  background: linear-gradient(to right, #ff9800, #ffc107);
  height: 100%;
  width: 0%;
  transition: width 0.3s;
}

.progress-percent {
  position: absolute;
  width: 100%;
  text-align: center;
  color: #fffde7;
  font-size: 0.85em;
  line-height: 24px;
}

/* Grid View Container */
.grid-view #subjectsContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1em;
}

/* Grid View Subject Cards as Square */
.grid-view .subject {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* Hide lectures in grid */
.grid-view .lectures {
  display: none !important;
}


.progress-bar {
  height: 20px;
  background: #ddd;
  border-radius: 5px;
  position: relative;
  overflow: hidden;
}

.progress {
  height: 100%;
  background-color: #4caf50;
  transition: width 0.3s ease;
}

.progress-percent {
  position: absolute;
  width: 100%;
  text-align: center;
  line-height: 20px;
  font-weight: bold;
  color: #fff;
}

.control-element {
  padding: 0.5em;
  border: none;
  border-radius: 5px;
  background: #2a2a2a;
  color: #ffca28;
  font-weight: bold;
  transition: background 0.2s;
}

.control-element:focus {
  outline: 2px solid #ffca28;
}

.danger {
  background: #e53935;
  color: white;
}

@media (max-width: 768px) {
  #subjectsContainer {
    grid-template-columns: 1fr !important;
  }

  .control-element {
    width: 100%;
    margin-top: 0.5em;
  }

  .subject-title {
    font-size: 1em;
  }

  .progress-percent {
    font-size: 0.75em;
  }
}

.remark-input {
  width: 50%;
  margin-top: 0.3em;
  padding: 0.3em;
  font-size: 0.85em;
  border: none;
  border-radius: 4px;
  background: #1c1c1c;
  color: #ffeb3b;
  outline: none;
}
.subject-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.lecture-remaining-count {
  font-size: 0.9em;
  color: #888;
}

/* In grid view, push the count to the next line */
body.grid-view .subject-title {
  flex-direction: column;
  align-items: flex-start;
}
