body {
  background-color: #3f4652; /* 灰米色的背景顏色 */
  font-family: "GenSenRounded TW R";
}

.card {
  cursor: pointer;
  border-radius: 15px !important; /* 增加圓角 */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important; /* 添加陰影 */
  transition: transform 0.3s ease, box-shadow 0.3s ease !important; /* 平滑過渡效果 */
}

.card:hover {
  transform: translateY(-5px) !important; /* 滑鼠懸停時上移，產生浮起效果 */
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2) !important; /* 懸停時增加陰影 */
}

.btn-outline-primary {
  border-color: #576a7c3c; /* 設置邊框顏色 */
  color: #576a7cc2; /* 設置文字顏色 */
  background-color: #00ff111d; /* 透明背景 */
  transition: all 0.3s ease; /* 平滑過渡效果 */
}

.btn-outline-primary:hover {
  background-color: rgb(17, 184, 28);
  color: white; /* 滑鼠懸停時文字顏色變為白色 */
}

.btn-outline-ebook-primary {
  border-color: #576a7c3c; /* 設置邊框顏色 */
  color: #576a7cc2; /* 設置文字顏色 */
  background-color: #0095ff1d; /* 透明背景 */
  transition: all 0.3s ease; /* 平滑過渡效果 */
}

.btn-outline-ebook-primary:hover {
  background-color: rgb(17, 112, 184);
  color: white; /* 滑鼠懸停時文字顏色變為白色 */
}

.card-title {
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 0.5rem;
}

.card-img-top {
  width: 100%;
  object-fit: cover;
  max-height: 200px;
  border-top-left-radius: 15px; /* 圖片左上角圓角 */
  border-top-right-radius: 15px; /* 圖片右上角圓角 */
}

.card-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.web-top-image {
  width: 100%; /* 圖片寬度填滿整個視窗 */
  height: auto; /* 自動調整高度以保持圖片比例 */
  display: block; /* 確保圖片不會有額外的空間 */
}

.web-bottom-image {
  width: 100%; /* 圖片寬度填滿整個視窗 */
  height: auto; /* 自動調整高度以保持圖片比例 */
  display: block; /* 確保圖片不會有額外的空間 */
}

.highlight {
  border: 2px solid #fff; /* 白色邊框 */
  box-shadow: 0 0 30px #fff; /* 白色陰影 */
}

.animate {
  animation: pulse 1s 3; /* 1秒，重複3次 */
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

#searchInput {
  width: 70%; /* 更窄 */
}

#searchButton {
  width: 50px; /* 按鈕大小 */
  height: 50px; /* 按鈕大小 */
  padding: 0; /* 移除内部間距 */
  border-radius: 50%; /* 圓形 */
  display: flex; /* 使圖標居中 */
  justify-content: center; /* 水平居中 */
  align-items: center; /* 垂直居中 */
}

#searchButton i {
  font-size: 20px; /* 圖標大小 */
}

.semi-transparent {
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.5); /* 白色半透明背景 */
  border-radius: 15px; /* 圓角 */
}

/* 預設情況下，只顯示電腦版文本 */
.text-mobile {
  display: none;
}

.btn-fixed-size {
  width: 50px;
  height: 50px;
}

/* 加入選單的基本樣式 */
#school,
#class {
  margin-top: 10px; /* 上邊距 */
  width: 100%; /* 寬度 */
  padding: 5px; /* 內邊距 */
  border-radius: 5px; /* 圓角 */
  border: 1px solid #ccc; /* 邊框 */
}

.card-img-top {
  width: 100%; /* 確保圖片寬度填滿卡片 */
  height: auto; /* 高度自動調整 */
  aspect-ratio: 1 / 1; /* 設定圖片為 1:1 的比例 */
  object-fit: cover; /* 確保圖片按比例填充 */
  object-position: center; /* 圖片居中顯示 */
}

/* 專輯卡片的初始樣式 */
.card-animate {
  opacity: 0 !important;
  transform: translateY(5px) !important;
  transition: opacity 0.5s ease, transform 0.5s ease !important;
}

/* 專輯卡片的動畫結束樣式 */
.card-animate.show {
  opacity: 1 !important;
  transform: translateY(0);
}

/* 模態框深色背景 */
.modal-content {
  background-color: #343a40; /* Bootstrap 深灰色 */
  color: white; /* 文字顏色設為白色 */
}

/* 模態框頭部和腳部深色背景（如果需要） */
.modal-header, .modal-footer {
  border-color: #454d55; /* 設置邊框顏色為更深的灰色 */
}

/* 關閉按鈕（X）顏色 */
.modal-close {
  color: white; /* 設置關閉按鈕顏色為白色 */
  filter: drop-shadow(0 0 2px black); /* 選擇性：為 X 添加陰影以增加對比 */
}

/* 當關閉按鈕為 btn-close 類時，針對 Bootstrap 5 的樣式 */
.btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* */
@media (max-width: 576px) {
  #youtubeEmbed {
    height: 85vh; /* */
  }
}

/* 定位關閉按鈕到右上角 */
.modal-body .btn-close {
    position: absolute;
    right: 1rem; /* 右邊距 */
    top: 1rem; /* 上邊距 */
    z-index: 1050; /* 確保按鈕在 iframe 之上 */
}

/* 為 modal-body 添加內邊距，避免內容與關閉按鈕重疊 */
.modal-body {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#scrollTopBtn {
  animation: fadeIn 0.5s;
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: none;
  z-index: 99;
  border: 1px solid #fff; /* 添加白色外框 */
  outline: none;
  background-color: #333;
  color: white;
  cursor: pointer;
  padding: 15px;
  border-radius: 10px;
  transition: transform 0.3s ease; /* 添加轉換效果使按鈕平滑上浮 */
}

#scrollTopBtn:hover {
  transform: translateY(-5px); /* 滑鼠懸停時上浮 */
}

/* Mobile-First Layout */
#player-container {
    width: 95vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    background: #000;
    border-radius: 20px;
    position: relative;
}

#player {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

#custom-playlist {
    width: 100%;
    flex-grow: 1;
    overflow-y: auto;
    background: #111;
    padding: 10px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.playlist-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 10px;
    padding: 5px;
    border-radius: 8px;
    transition: background-color 0.3s;
}

.playlist-item:hover,
.playlist-item.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.playlist-item img {
    width: 80px;
    height: 45px;
    border-radius: 4px;
    margin-right: 10px;
    object-fit: cover;
}

.playlist-item .title {
    color: white;
    font-size: 0.9rem;
}

.volume-control, #volume-slider {
    display: none;
}

#custom-controls.glass-toolbar {
    flex-shrink: 0;
    position: relative;
    bottom: 0;
    left: 0;
    transform: none;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    border-bottom: none;
    padding: 10px 15px;
    display: flex;
    flex-direction: column; /* Stack progress bar and controls vertically */
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.playback-controls {
    display: flex;
    gap: 15px;
}

#duration-display {
    color: white;
    font-size: 0.9rem;
    text-align: right;
    display: flex;
    flex-direction: column;
}

#total-duration {
    color: rgba(255, 255, 255, 0.7);
}

/* Desktop Layout */
@media (min-width: 768px) {
    #player-container {
        width: 90vw;
        height: 80vh;
        display: grid;
        grid-template-columns: 3fr 1fr;
        grid-template-rows: 1fr auto;
        grid-template-areas:
            "player   playlist"
            "controls playlist";
        border-radius: 20px;
        background: rgba(0, 0, 0, 0.5);
    }

    #player {
        grid-area: player;
        height: 100%;
        width: 100%;
        aspect-ratio: auto;
        border-radius: 20px 0 0 0;
    }

    #custom-controls.glass-toolbar {
        grid-area: controls;
        border-radius: 0 0 0 20px;
        padding: 15px 25px;
        gap: 15px;
    }

    .control-row {
        position: relative;
        justify-content: center;
    }

    #custom-playlist {
        grid-area: playlist;
        height: 100%;
        width: 100%;
        border-radius: 0 20px 20px 0;
        background: rgba(0, 0, 0, 0.3);
        /* overflow: hidden; */
    }

    #duration-display {
        display: flex;
        position: absolute;
        right: 25px;
        top: 50%;
        transform: translateY(-50%);
    }
}

.btn-control {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: white !important;
    font-size: 1.8rem !important;
    width: 70px;
    height: 70px;
    border-radius: 50% !important;
    transition: all 0.2s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.btn-control:active {
    background: rgba(255, 255, 255, 0.4) !important;
    transform: scale(0.95);
}

.volume-control {
    display: flex;
    align-items: center;
    color: white;
    gap: 15px;
}

.volume-control i {
    font-size: 1.5rem;
}

#volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 150px;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    outline: none;
    transition: opacity .2s;
    cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    cursor: pointer;
    border-radius: 50%;
}

#volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    cursor: pointer;
    border-radius: 50%;
}

#custom-progress-bar-container {
    width: 90%;
    margin: 15px auto;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    position: relative;
    cursor: pointer;
}

#custom-progress-bar {
    height: 100%;
    width: 0;
    background-color: #fff;
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.7); /* Lighter color for total duration */
}

#progress-bar-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 24px;
    height: 24px;
    background-color: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 20;
    transition: transform 0.1s ease;
}

#progress-bar-thumb:active {
    transform: translate(-50%, -50%) scale(1.2);
}

#progress-tooltip {
    position: absolute;
    bottom: 25px; /* Positioned securely above the progress bar */
    left: 0; /* Position will be handled by JavaScript */
    top: auto; /* Unset top positioning */
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 3rem;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none; /* Ignore mouse events */
    z-index: 100; /* Ensure it's on top of everything */
}
