/* === GLOBAL STYLE === */
body {
  font-family: "Poppins", "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #75928d, #999caa);
  color: #333;
  margin: 0;
  padding: 0;
  line-height: 1.5;
  overflow-x: hidden;
}

/* === CONTAINER === */
.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: -webkit-fill-available; /* Perbaikan untuk browser mobile */
  overflow: hidden;
}

/* === HEADER === */
.top-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 15px;
}

/* BARIS 1: Judul + user + logout */
.header-row {
  display: flex;
  justify-content: center; /* Judul di tengah */
  align-items: center;
  position: relative;
}

/* Judul */
.header-row h1 {
  font-size: 1.7em;
  color: #2c3e50;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  margin: 0;
}

/* USER + LOGOUT AREA */
.user-area-container {
  position: absolute;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Username badge */
.user-label {
  font-weight: bold;
  font-size: 14px;
  background: rgba(128, 211, 153, 0.647);
  padding: 6px 12px;
  border-radius: 6px;
  color: #2c3e50;
}

/* Tombol Logout */
.logout-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: #e74c3c;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

.logout-btn:hover {
  background: #c0392b;
}

/* === NAVIGATION & SEARCH === */
.week-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 1.0em;
  color: #242323;
  position: relative;
}

/* Tombol nav */
.week-nav button {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.3s;
}

.week-nav button:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.search-wrapper {
  position: absolute;
  right: 15px;
}

.search-container {
  position: relative;
  width: 220px;
}

#searchInput {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  outline: none;
  transition: all 0.3s ease;
}

#searchInput:focus {
  background: white;
  box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
  border-color: #3498db;
}

.suggestions-box {
  position: absolute;
  top: 110%;
  right: 0;
  width: 280px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 2000;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  border: 1px solid #eee;
}

.suggestion-item {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  text-align: left;
  transition: background 0.2s;
}

.suggestion-item:hover {
  background-color: #f0f7ff;
}

/* === GRID TAHUNAN (6 KOLOM) === */
.schedule-grid {
  display: grid;
  /* Diubah menjadi 6 kolom untuk 6 bulan per semester */
  grid-template-columns: repeat(6, 1fr); 
  gap: 8px;
  margin-top: 10px;
  flex: 1;
  padding: 0 10px;
  overflow-x: auto; /* Memungkinkan scroll horizontal jika layar sangat sempit */
}

/* === DAY/MONTH COLUMN === */
.day-column {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  padding: 8px;
  height: calc(100vh - 200px); /* Penyesuaian tinggi agar muat di jendela */
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  min-width: 160px; /* Mencegah kolom menjadi terlalu gepeng */
}

.day-column.today {
  background: linear-gradient(180deg, #fff6df, #ffedc2);
  border: 1px solid #f2d48a;
  box-shadow: 0 0 10px rgba(168, 201, 235, 0.4);
  transform: scale(1.01);
}

.day-header {
  font-weight: bold;
  color: #34495e;
  font-size: 0.95em;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 5px;
  text-align: center;
}

/* === TASK LIST & ITEMS === */
.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.task-item {
  margin-bottom: 6px;
  padding: 8px;
  border-left: 3px solid #3498db;
  border-radius: 6px;
  font-size: 0.85em;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;   
  align-items: center;
  background-color: #fff;
  position: relative;
  word-wrap: break-word;
}

.task-main {
  display: flex;
  align-items: center;
  flex: 1;
  margin-right: 5px;
}

.task-text {
    flex: 1;
}

.task-item:hover {
  transform: translateY(-2px);
  background-color: #fcfcfc;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.task-item.completed {
  text-decoration: line-through;
  opacity: 0.6;
  border-left-color: #27ae60;
}

.task-actions {
  display: none;
  gap: 4px;
}

.task-item:hover .task-actions {
  display: flex;
}

.move-btn, .delete-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: white;
  font-size: 11px;
}

.move-btn { background: #3498db; }
.delete-btn { background: #e74c3c; }

/* === ADD TASK SECTION === */
.add-task-section {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  backdrop-filter: blur(5px);
  background: rgba(255, 255, 255, 0.2);
}

.add-task-section input,
.add-task-section select,
.add-task-section button {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
}

.add-task-section button {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
  font-weight: bold;
  cursor: pointer;
  border: none;
}

/* === MODAL & LOGIN === */
.login-page {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  display: flex; justify-content: center; align-items: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 9999;
}

.login-card {
  width: 320px;
  padding: 30px;
  border-radius: 15px;
  background: white;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  text-align: center;
}

.login-input {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-sizing: border-box;
}

.modal {
  display: none;
  position: fixed;
  z-index: 3000;
  left: 0; top: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
}

.modal-content {
  background: white;
  margin: 10% auto;
  padding: 25px;
  border-radius: 12px;
  width: 340px;
  text-align: center;
}

/* Drag & Drop Styles */
.task-item.dragging {
  opacity: 0.5;
  border: 2px dashed #3498db;
}

.drop-hint {
  background: rgba(52, 152, 219, 0.1);
  border: 2px dashed #3498db;
  height: 40px;
  border-radius: 6px;
  margin-bottom: 5px;
}

.edit-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #3498db;
    border-radius: 4px;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* Pelangi Otomatis */
.task-item:nth-child(7n + 1) { background: linear-gradient(90deg, rgba(255,99,132,.08), rgba(255,99,132,.15)); }
.task-item:nth-child(7n + 2) { background: linear-gradient(90deg, rgba(255,159,64,.08), rgba(255,159,64,.15)); }
.task-item:nth-child(7n + 3) { background: linear-gradient(90deg, rgba(255,205,86,.08), rgba(255,205,86,.15)); }
.task-item:nth-child(7n + 4) { background: linear-gradient(90deg, rgba(75,192,192,.08), rgba(75,192,192,.15)); }
.task-item:nth-child(7n + 5) { background: linear-gradient(90deg, rgba(54,162,235,.08), rgba(54,162,235,.15)); }
.task-item:nth-child(7n + 6) { background: linear-gradient(90deg, rgba(153,102,255,.08), rgba(153,102,255,.15)); }
.task-item:nth-child(7n + 7) { background: linear-gradient(90deg, rgba(255,99,255,.08), rgba(255,99,255,.15)); }

/* === RESPONSIVE MOBILE === */
@media (max-width: 915px) {
  .schedule-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 kolom per baris di HP */
    overflow-y: auto;
    height: auto;
  }

  .day-column {
    height: 350px;
    min-width: 0;
  }

  .header-row h1 {
    font-size: 1.4em;
  }

  .user-area-container {
    position: relative;
    right: auto;
    align-items: center;
    margin-top: 10px;
  }

  .week-nav {
    flex-direction: column;
    gap: 15px;
  }

  .search-wrapper {
    position: relative;
    right: auto;
    width: 100%;
  }

  .search-container {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .schedule-grid {
    grid-template-columns: 1fr; /* 1 kolom di HP kecil */
  }
}