* {
  -webkit-tap-highlight-color: transparent;
}
.schedule-title-badge {
  display: inline-block;
  color: #006699;
  padding: 0 0 5px 0;
  border-bottom: 2px solid #006699;
  font-weight: bold;
  font-size: inherit;
  font-family: inherit;
  letter-spacing: 1px;
  transform: translateY(-3px);
}
.watermark-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none; 
  z-index: 9998; 
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='450' height='300'><text x='50%' y='50%' transform='rotate(-30 225 150)' fill='rgba(0,0,0,0.06)' font-size='28' font-weight='bold' font-family='Microsoft JhengHei, sans-serif' text-anchor='middle' dominant-baseline='middle'>模擬系統，非實際選課頁面</text></svg>");
  background-repeat: repeat;
}
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}
.modal-content {
  background-color: white;
  padding: 20px 30px;
  border-radius: 4px;
  width: 85%;
  max-width: 450px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border: 1px solid #999;
  font-family: Arial, "Microsoft JhengHei", sans-serif;
  animation: modalFadeIn 0.2s ease-in-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-title {
  text-align: left;
  font-weight: bold;
  font-size: 20px;
  margin-top: 0;
  margin-bottom: 15px;
  color: #333;
  border-bottom: 2px solid #5d7b9d;
  padding-bottom: 10px;
}
.modal-title.danger {
  border-bottom: 2px solid #d9534f;
  color: #d9534f;
}
.modal-text {
  text-align: left;
  line-height: 1.6;
  font-size: 15px;
  color: #444;
  margin-bottom: 24px;
}
.modal-text ol { margin: 0; padding-left: 22px; }
.modal-text li { margin-bottom: 10px; }
#customAlertText {
  max-height: 50vh;
  overflow-y: auto;
  padding: 5px 10px 5px 0;
  background-color: transparent;
  border: none;
}
#customAlertText::-webkit-scrollbar { width: 5px; }
#customAlertText::-webkit-scrollbar-track { background: transparent; border-radius: 10px; }
#customAlertText::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 10px; }
#customAlertText::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.3); }
.modal-btn {
  padding: 8px 20px;
  border-radius: 4px;
  border: 1px solid #888;
  background-color: #f8f8f8;
  color: #333;
  font-size: 15px;
  cursor: pointer;
  font-family: Arial, "Microsoft JhengHei", sans-serif;
  transition: 0.2s;
  -webkit-appearance: none; 
}
.modal-btn:hover { background-color: #e8e8e8; }
.modal-btn.primary-btn {
  background-color: #006699;
  color: white;
  border-color: #006699;
}
.modal-btn.primary-btn:hover { background-color: #005580; }
.modal-btn.danger-btn {
  background-color: #d9534f;
  color: white;
  border-color: #d9534f;
}
.modal-btn.danger-btn:hover { background-color: #c9302c; }
.modal-btn:disabled {
  background-color: #eee;
  color: #aaa;
  cursor: not-allowed;
  border-color: #ccc;
}
.tour-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: none;
}
.tour-highlight {
  position: relative;
  z-index: 10001 !important;
  background-color: white !important; 
  border-radius: 6px;
  box-shadow: 0 0 0 6px white, 0 4px 15px rgba(0,0,0,0.4) !important; 
  pointer-events: none; 
  color: #333 !important; 
}
th.tour-highlight {
  color: #006699 !important;
}
body.tour-active #tour-step-3,
body.tour-active #tour-step-4 {
  overflow: visible !important;
  overflow-x: visible !important;
}
.tour-tooltip {
  position: absolute;
  z-index: 10002;
  background: white;
  border-radius: 8px;
  padding: 24px;
  width: 340px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  font-family: Arial, "Microsoft JhengHei", sans-serif;
  display: none;
  transition: top 0.3s ease, left 0.3s ease;
}
.tour-tooltip::-webkit-scrollbar { width: 6px; }
.tour-tooltip::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.tour-tooltip::-webkit-scrollbar-thumb:hover { background: #999; }
.tour-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.tour-progress-pill {
  background-color: #eef5f9;
  color: #006699;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
}
.tour-close-btn {
  font-size: 24px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  line-height: 1;
}
.tour-close-btn:hover { color: #333; }
.tour-text {
  margin-bottom: 24px;
  margin-top: 4px;
  padding-right: 25px;
  font-size: 16px;
  font-weight: bold;
  line-height: 1.6;
  color: #333;
  text-align: left;
}
@media screen and (min-width: 768px) {
  .tour-text { font-size: 16px; }
}
.tour-buttons {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.tour-btn {
  flex: 1;
  padding: 10px 0;
  border: 1px solid #0084b4;
  background: white;
  color: #0084b4;
  border-radius: 4px;
  cursor: pointer;
  font-size: 15px;
  font-weight: bold;
  transition: 0.2s;
  -webkit-appearance: none; 
}
.tour-btn-primary { background: #0084b4; color: white; }
.tour-btn:hover { opacity: 0.8; }
.tour-btn:disabled { border-color: #ccc; color: #ccc; cursor: not-allowed; opacity: 1; background: white; }
.floating-widgets {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10005;
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  font-family: Arial, "Microsoft JhengHei", sans-serif;
}
.tour-bot-icon {
  width: 60px;
  height: 60px;
  background-color: rgba(243, 156, 18, 0.92); 
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
  color: white;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  line-height: 1.2;
}
.tour-bot-icon:hover { 
  transform: scale(1.08); 
  background-color: rgba(243, 156, 18, 1);
}
.line-bot-icon {
  width: 60px;
  height: 60px;
  background-color: rgba(6, 199, 85, 0.92); 
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.line-bot-icon:hover { 
  transform: scale(1.08); 
  background-color: rgba(6, 199, 85, 1);
}
.line-bot-icon::before {
  content: 'LINE';
  color: white;
  font-weight: bold;
  font-size: 16px;
}
.download-btn-icon {
  width: 60px;
  height: 60px;
  background-color: rgba(0, 102, 153, 0.92); 
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease, background-color 0.2s ease;
  color: white;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  line-height: 1.2;
}
.download-btn-icon:hover { 
  transform: scale(1.08); 
  background-color: rgba(0, 102, 153, 1);
}
.download-btn-icon.loading { 
  background-color: #888; 
  cursor: not-allowed; 
  transform: none; 
}
.scroll-nav-group {
  display: none; 
  flex-direction: column;
  gap: 12px;
}
.scroll-nav-group.show {
  display: flex;
  animation: popUp 0.3s ease forwards;
}
.scroll-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: #666;
  transition: all 0.2s ease;
  -webkit-appearance: none;
}
.scroll-btn:hover {
  background: rgba(255, 255, 255, 1);
  color: #006699;
  transform: scale(1.08);
}
.line-bot-card {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 260px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
  overflow: hidden;
  display: none; 
  flex-direction: column;
  transform-origin: bottom right;
  animation: popUp 0.3s ease forwards;
}
.line-bot-card.show { display: flex; }
.line-bot-header {
  background-color: #06C755; color: white; padding: 12px 15px; font-weight: bold; font-size: 16px; display: flex; justify-content: space-between; align-items: center;
}
.line-bot-header .close-card { cursor: pointer; font-size: 20px; line-height: 1; }
.line-bot-body { padding: 15px; font-size: 14px; color: #333; }
.line-bot-body p { margin: 0 0 10px 0; }
.line-bot-body ul { margin: 0 0 15px 0; padding-left: 0; list-style: none; }
.line-bot-body li { margin-bottom: 6px; display: flex; align-items: center; }
.line-bot-body li::before { content: '✅'; margin-right: 6px; font-size: 12px; }
.line-add-btn {
  display: block; background-color: #06C755; color: white !important; text-align: center; padding: 10px 0; border-radius: 6px; text-decoration: none; font-weight: bold; transition: background-color 0.2s;
}
.line-add-btn:hover { background-color: #05b34c; }
.MozCenter { width: 80%; margin-right: auto; margin-left: auto; background-color: #F7F6F3; border-color: #E6E2D8; border-spacing: 4px; border-style: Solid; Border-width: 1px; Color: #333333; box-sizing: border-box; }
ul.MozCenter { padding: 15px 25px; } 
ul li, ul { list-style-position: inside; text-align: justify; }
.style2 { text-align: center; color: #cc0000; font-weight: bold; font-size: large; }
.center { width: 100%; text-align: center; align-content: center; }
.auto-style1 { color: #cc0000; }
.auto-style2 { padding: 10px; text-align: center; text-decoration: none; display: inline-block; font-size: x-large; margin: 4px 2px; border-radius: 12px; cursor: pointer; -webkit-transition-duration: 0.4s; transition-duration: 0.4s; }
.auto-right { text-align: right; }
.table1 { border-collapse: separate; border-spacing: 15px; margin-left: auto; margin-right: auto; }
.auto-style3 { color: #FF0000; }
.btn {
    padding: 5px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 2px 2px;
    border-radius: 6px;
    cursor: pointer;
    -webkit-appearance: none; 
    -webkit-transition-duration: 0.4s; 
    transition-duration: 0.4s;
}
.btn:hover { 
    background-color: #4CAF50; 
    color: white !important; 
}
.button5 { background-color: white; color: black; border: 2px solid #555555; border-radius: 4px; }
.button5:hover { background-color: #555555; color: white; }
input { cursor: pointer; }
body { background-image: url('https://i.imgur.com/meS5ada.gif'); margin: 8px; font-family: "Times New Roman", Times, serif; }
.hidden { display: none; }
.mobile-break { display: none; }
.course-row {
  background-color: white;
  transition: background-color 0.1s;
}
@media (hover: hover) {
  .course-row:hover {
    background-color: #CCCCCC;
  }
}
#loginPage,
#coursePage,
#schedulePage {
  position: relative;
  min-height: calc(100vh - 16px);
  padding-bottom: 220px; 
  box-sizing: border-box;
}
.site-footer {
  position: absolute; 
  bottom: -8px;       
  left: -8px;
  right: -8px;
  z-index: 9999;
  padding: 40px 20px;
  background-color: #343a40; 
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft JhengHei", sans-serif;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}
.site-footer .footer-main {
  font-size: 15px;
  color: #f8f9fa;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.site-footer .footer-link {
  color: #20c997; 
  text-decoration: none;
  font-weight: bold;
  margin: 0 6px;
  transition: all 0.3s ease;
}
.site-footer .footer-link:hover {
  color: #38d39f;
}
.site-footer .footer-divider {
  width: 50px;
  height: 2px;
  background-color: #495057;
  border-radius: 2px;
  margin: 2px 0;
}
.site-footer .footer-note {
  font-size: 13px;
  color: #adb5bd;
  line-height: 1.6;
  max-width: 550px;
}
#tour-step-1 td,
#tour-step-2 td { 
  display: inline-block; 
  margin: 2px 4px;
  text-align: left;
}
:root {
  --time-col-width: 70px;
}
.schedule-wrapper {
  width: 96%; 
  max-width: 720px; 
  margin: 20px auto 40px auto; 
}
.schedule-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.schedule-capture-wrap {
  margin-top: 10px;
  width: 100%;
}
.schedule-capture {
  position: relative;
  z-index: 9999;
  width: 100%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.06);
  overflow: hidden;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", sans-serif;
}
.schedule-grid {
  padding: 0;
}
.grid-header, .grid-row {
  display: grid;
  align-items: stretch;
}
.grid-header {
  background: #f5f7fa; 
  font-weight: bold; 
  font-size: 13px;
  text-align: center;
}
.grid-header > div {
  padding: 10px 2px;
  border-right: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444; 
  text-align: center;
  line-height: 1.3;
}
.grid-header > div:last-child {
  border-right: none;
}
.grid-row {
  border-bottom: 1px solid #eceff3;
  min-height: 56px;
}
.grid-row:nth-child(even) {
  background: #fafbfc;
}
.time-cell {
  padding: 4px 2px;
  border-right: 1px solid #eceff3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
}
.time-cell .period {
  font-size: 15px;
  font-weight: bold; 
  color: #444; 
  line-height: 1.1;
}
.time-cell .time {
  font-size: 11px;
  color: #7a7a7a;
  line-height: 1.2;
  text-align: center;
}
.course-cell {
  border-right: 1px solid #eceff3;
  padding: 4px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.course-cell:last-child {
  border-right: none;
}
.course-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  text-align: center;
}
.course-name {
  font-size: 12px;
  font-weight: bold; 
  color: #333; 
  line-height: 1.25;
  word-break: break-word;
}
.course-teacher {
  font-size: 11px;
  color: #8b8b8b;
  line-height: 1.2;
  word-break: break-word;
}
.course-room {
  font-size: 11px;
  color: #007aff;
  line-height: 1.2;
  word-break: break-word;
}

#activeFiltersContainer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#activeFiltersContainer:not(:empty) {
  margin-bottom: 8px;
}

#activeFiltersContainer:empty {
  display: none;
}

.active-filter-pill {
  display: flex;
  align-items: center;
  background-color: #e9ecef;
  border: 1px solid #dee2e6;
  border-radius: 16px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #495057;
  animation: fadeIn 0.2s ease-in-out;
}

.active-filter-pill:hover {
    background-color: #dee2e6;
}

.active-filter-pill .remove-pill {
  margin-left: 6px;
  cursor: pointer;
  color: #adb5bd;
  font-weight: bold;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

.active-filter-pill .remove-pill:hover {
  color: #d9534f;
}

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

#searchBarContainer {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: stretch;
  width: 100%;
  max-width: 360px;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex-grow: 1;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: #999;
  width: 16px;
  height: 16px;
  pointer-events: none; 
  z-index: 2;
}

#searchInput {
  padding: 8px 30px 8px 34px !important;
  box-sizing: border-box;
  width: 100%;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin: 0;
}

.search-clear-btn {
  position: absolute;
  right: 1px;  
  top: 1px;   
  bottom: 1px;  
  width: 30px;
  display: none; 
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #999;
  font-size: 18px;
  z-index: 5;
  background-color: transparent;
  border-radius: 0 3px 3px 0;
}
.search-clear-btn:hover {
  color: #d9534f;
}

.filter-btn {
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: background 0.2s;
}
.filter-btn:hover { background: #f0f0f0; }

.filter-panel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 5px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 15px;
  width: 280px;
  z-index: 100;
  display: none;
}
.filter-panel.show { display: block; }
.filter-section { margin-bottom: 12px; }
.filter-title { font-weight: bold; font-size: 13px; margin-bottom: 8px; color: #333; }
.filter-options { display: flex; flex-wrap: wrap; gap: 6px; }


.filter-chip {
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  background: white;
  color: #555;
  transition: all 0.2s;
}
.filter-chip.active {
  background: #006699;
  color: white;
  border-color: #006699;
}


#filterStatusBar {
  display: none;
  background: #f0f7ff;
  border: 1px solid #cce5ff;
  padding: 6px 12px;
  margin-bottom: 10px;
  border-radius: 4px;
  font-size: 13px;
  color: #004085;
  align-items: center;
  justify-content: space-between;
}
.filter-panel.show { display: block; }
.filter-section { margin-bottom: 12px; }
.filter-title { font-weight: bold; font-size: 13px; margin-bottom: 8px; color: #333; }
.filter-options { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  background: white;
  color: #555;
  transition: all 0.2s;
}
.filter-chip.active {
  background: #006699;
  color: white;
  border-color: #006699;
}

@media screen and (max-width: 768px) {
  :root {
    --time-col-width: 48px; 
  }
  .mobile-break { display: block; }
  .MozCenter { width: 96%; }
  .table1 { border-spacing: 5px; }
  .auto-style2 { font-size: 18px; width: 85% !important; }
  table { max-width: 100%; }
  
  #coursePage > table:nth-of-type(1) td:empty { display: none; } 
  
  select { max-width: 100%; }
  
  #GVOpencourse, #GVStudSelect { width: 100%; font-size: 13px; table-layout: auto; }
  
  #GVOpencourse th, #GVOpencourse td, #GVStudSelect th, #GVStudSelect td {
    padding: 3px 1px; 
    word-break: break-word;
    overflow-wrap: break-word; 
    white-space: normal;
  }
  .tour-tooltip { width: 85vw; max-width: 320px; padding: 16px; }
  .tour-text { font-size: 15px; }
  .tour-btn { padding: 6px 0; font-size: 14px; }
  
  .schedule-wrapper { width: 100%; margin: 10px auto; padding: 0 4px; box-sizing: border-box; }
  .schedule-capture { border-radius: 8px; }
  .grid-header { font-size: 11px; }
  .grid-header > div { padding: 6px 1px; }
  
  .time-cell { padding: 2px 1px; }
  .time-cell .period { font-size: 13px; }
  .time-cell .time { font-size: 10px; transform: scale(0.9); }
  
  .grid-row { min-height: 48px; }
  .course-cell { padding: 2px 1px; }
  .course-name { font-size: 11px; line-height: 1.15; }
  .course-teacher, .course-room { font-size: 10px; line-height: 1.1; letter-spacing: -0.5px; }
  .floating-widgets {
    bottom: 15px;
    right: 15px;
    gap: 10px;
  }
  .tour-bot-icon, .line-bot-icon, .download-btn-icon {
    width: 48px; 
    height: 48px; 
    font-size: 11px;
  }
  .line-bot-icon::before {
    font-size: 12px;
  }
  .scroll-nav-group {
    gap: 10px;
  }
  .scroll-btn {
    width: 36px;
    height: 36px;
  }
  .scroll-btn svg {
    width: 16px;
    height: 16px;
  }
  .line-bot-card {
    bottom: 60px;
  }
  .site-footer {
    padding: 30px 15px;
  }
  .site-footer .footer-main {
    font-size: 14px;
  }
  .site-footer .footer-note {
    font-size: 12px;
  }
}
@keyframes spinner-spin { 100% { transform: rotate(360deg); } }
