/* ==========================================
   Tab 頁籤與搜尋列 SearchBar
   ========================================== */
.tab-container { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 4px; margin-bottom: 12px; width: 100%; }
.tab-btn { flex-shrink: 0; white-space: nowrap; padding: 6px 14px; font-size: 13px; font-weight: 600; border-radius: 16px; border: 1px solid var(--border-color); background-color: var(--card-bg); color: var(--text-color); cursor: pointer; transition: all 0.2s ease; }
.tab-btn.active { background-color: var(--primary-color); color: #ffffff; border-color: var(--primary-color); }

.search-bar-container { margin-bottom: 12px; width: 100%; box-sizing: border-box; }
.search-input-wrapper { position: relative; display: flex; align-items: center; width: 100%; }
.search-input { width: 100%; height: 40px; padding: 8px 36px; font-size: 15px; border: 1px solid var(--border-color); border-radius: 10px; background-color: var(--card-bg); outline: none; box-sizing: border-box; appearance: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.search-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1); }
.search-icon { position: absolute; left: 12px; width: 16px; height: 16px; fill: none; stroke: var(--secondary-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.search-clear-btn { position: absolute; right: 10px; width: 20px; height: 20px; background: #c7c7cc; border: none; border-radius: 50%; color: #fff; font-size: 12px; line-height: 20px; text-align: center; cursor: pointer; display: none; padding: 0; }
.search-hidden { display: none !important; }

/* ==========================================
   ActionCard, Accordion & Carousel
   ========================================== */
.action-card-container { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; text-align: center; width: 100%; box-sizing: border-box; }
.action-card-icon { font-size: 36px; margin-bottom: 10px; line-height: 1; }
.action-card-title { font-size: 16px; font-weight: 700; color: var(--text-color); margin-bottom: 6px; }
.action-card-text { font-size: 13px; color: var(--secondary-text); margin-bottom: 14px; max-width: 320px; line-height: 1.4; }
.action-card-container .btn { margin-bottom: 0; }

.app-accordion { width: 100%; margin-bottom: 12px; border-radius: var(--radius); overflow: hidden; background: var(--card-bg); border: 1px solid var(--border-color); box-sizing: border-box; }
.accordion-item { border-bottom: 1px solid var(--border-color); }
.accordion-item:last-child { border-bottom: none; }
.accordion-header { padding: 14px 16px; font-size: 15px; font-weight: 600; color: var(--text-color); display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; background-color: #ffffff; transition: background-color 0.2s ease; }
.accordion-header:active { background-color: #f2f2f7; }
.accordion-icon { font-size: 12px; color: var(--secondary-text); transition: transform 0.25s ease; }
.accordion-item.active .accordion-icon { transform: rotate(180deg); }
.accordion-body { padding: 0 16px; max-height: 0; overflow: hidden; transition: max-height 0.3s cubic-bezier(0, 1, 0, 1), padding 0.25s ease; font-size: 14px; line-height: 1.5; color: #3a3a3c; background-color: #fafafc; }
.accordion-item.active .accordion-body { padding: 12px 16px; max-height: 1000px; transition: max-height 0.35s ease-in-out, padding 0.25s ease; }

.app-carousel-container { position: relative; width: 100%; margin-bottom: 16px; box-sizing: border-box; }
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; gap: 12px; padding: 4px 2px 12px 2px; scrollbar-width: none; cursor: grab; user-select: none; }
.carousel-track:active { cursor: grabbing; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide { flex: 0 0 100%; scroll-snap-align: start; box-sizing: border-box; }
.app-carousel-container.peek .carousel-slide { flex: 0 0 85%; }

.carousel-slide-content { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border-color); overflow: hidden; height: 100%; display: flex; flex-direction: column; box-sizing: border-box; }
.carousel-slide-content .media-preview-container { margin: 0 !important; border: none !important; border-radius: 0 !important; width: 100% !important; height: 100% !important; display: flex !important; flex-direction: column !important; }
.carousel-slide-content .media-preview-image { display: block !important; width: 100% !important; height: 100% !important; object-fit: cover !important; }

.carousel-text-body { padding: 16px !important; box-sizing: border-box !important; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: flex-start; }
.carousel-text-body .item-title, .carousel-text-body .item-text, .carousel-text-body .item-badge, .carousel-text-body .badge-group { margin-left: 0; margin-right: 0; }

.carousel-nav-btn { display: none; position: absolute; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; background: rgba(255, 255, 255, 0.9); border: 1px solid var(--border-color); border-radius: 50%; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); cursor: pointer; z-index: 10; align-items: center; justify-content: center; font-size: 14px; color: var(--text-color); transition: all 0.2s ease; }
.carousel-nav-btn:hover { background: #ffffff; transform: translateY(-50%) scale(1.1); }
.carousel-nav-btn.prev { left: -10px; }
.carousel-nav-btn.next { right: -10px; }
@media (min-width: 601px) { .carousel-nav-btn { display: flex; } }

.carousel-dots { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 4px; }
.carousel-dot { width: 6px; height: 6px; border-radius: 50%; background-color: #c7c7cc; cursor: pointer; transition: all 0.25s ease; }
.carousel-dot.active { width: 16px; border-radius: 4px; background-color: var(--primary-color); }

/* ==========================================
   RefreshTimer, Modal & Toast
   ========================================== */
.refresh-timer-container { display: flex; align-items: center; justify-content: space-between; background: transparent; border: none; padding: 2px 0 4px 0; margin-bottom: 4px; box-sizing: border-box; font-size: 12px; line-height: 1.2; }
.refresh-last-updated { font-size: 12px; font-weight: 500; color: var(--text-color); line-height: 1.2; }
.refresh-timer-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.refresh-seconds-text { font-size: 12px; font-weight: 400; color: var(--secondary-text); line-height: 1.2; }
.refresh-action-btn { display: inline-flex; align-items: center; gap: 4px; background-color: rgba(0, 122, 255, 0.1); border: 1px solid rgba(0, 122, 255, 0.25); padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--primary-color); cursor: pointer; transition: all 0.2s ease; white-space: nowrap; line-height: 1.2; }
.refresh-action-btn:active { background-color: rgba(0, 122, 255, 0.2); transform: scale(0.96); }
.refresh-icon { width: 12px; height: 12px; fill: currentColor; }
.refresh-icon.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px); z-index: 1000; display: flex; justify-content: center; align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-container { background: var(--card-bg); width: 100%; max-width: 500px; border-top-left-radius: 16px; border-top-right-radius: 16px; padding: 16px 20px 24px 20px; box-sizing: border-box; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); max-height: 85vh; overflow-y: auto; }
.modal-overlay.center .modal-container { align-self: center; border-radius: 16px; transform: scale(0.9); width: 90%; }
.modal-overlay.active .modal-container { transform: translateY(0) scale(1); }
.modal-handle { width: 36px; height: 5px; background-color: #d1d1d6; border-radius: 3px; margin: 0 auto 12px auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--text-color); }
.modal-close-btn { background: #e5e5ea; border: none; width: 28px; height: 28px; border-radius: 50%; font-size: 14px; color: var(--secondary-text); cursor: pointer; display: flex; align-items: center; justify-content: center; }

.toast-container { position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-100px); z-index: 2000; width: calc(100% - 32px); max-width: 420px; padding: 12px 16px; border-radius: 12px; background-color: #1c1c1e; color: #ffffff; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); display: flex; align-items: center; justify-content: space-between; transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.toast-container.active { transform: translateX(-50%) translateY(0); }
.toast-content { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.toast-info    { border-left: 4px solid #007aff; }
.toast-success { border-left: 4px solid #34c759; }
.toast-warning { border-left: 4px solid #ff9500; }
.toast-danger  { border-left: 4px solid #ff3b30; }

.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, 0.85); display: flex; align-items: center; justify-content: center; font-weight: bold; z-index: 999; }
