/* style.css */
/* Loading 動畫樣式 */
/* Loading 遮罩 */

#loader-wrapper {
    display: flex;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
}

/* 顯示時的 class */
#loader-wrapper.active {
    opacity: 1;
    visibility: visible;
}

/* 圓圈動畫 */
.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* 點圖放大 Lightbox 背景 */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.lightbox-overlay img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 0 20px #000;
    transition: transform 0.3s ease;
    cursor: zoom-out;
}

/* Logo CSS */
#logo-img1 {
    height: 100px;
    width: auto;
    display: block;
    margin: 0 auto;
}

#logo-img2 {
    height: 50px;
    width: auto;
    display: none;
    margin: 0 auto;
}

/*------------------ 全域樣式 ------------------*/

/* Box model reset: avoid inputs being wider than their containers */
*,
*::before,
*::after {
    box-sizing: border-box;
}

input,
select,
textarea {
    box-sizing: border-box;
    max-width: 100%;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    padding: 0 !important;
    background-color: #f8f9fa;
}

h1,
h2,
h3,
h4 {
    text-align: center;
}

h1 {
    color: #fff;
    font-size: 2em;
}

h2 {
    color: #126196;
    font-size: 1.5em;
}

h3 {
    color: #a79221;
    font-size: 1.1em;
}

h4 {
    color: #036288;
    font-size: 1.3em;
}

/*------------------ Header/Footer ------------------ */
header {
    position: sticky;
    top: 0;
    width: 100%;
}

footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
}

header,
footer {
    background-color: #126196;
    color: white;
    text-align: center;
    padding: 10px 0;
    z-index: 150;
}

.copyright {
    font-size: 16px;
    color: #ffffff;
    letter-spacing: 1px;
    margin-top: -5px;
    /* 增加兩行之間的距離 */
}

.since {
    text-align: left;
    font-size: 12px;
    color: #ffffff;
    text-transform: uppercase;
    margin-left: 20px;
    /* 英文轉大寫更有設計感 */
}

.credits {
    text-align: right;
    font-size: 12px;
    color: #ffffff;
    text-transform: uppercase;
    margin-right: 20px;
    /* 英文轉大寫更有設計感 */
}

/* 捲動定位修正 */
[id] {
    scroll-margin-top: 80px;
}


/*  基本樣式 */
nav {
    position: fixed;
    top: 120px;
    left: 0;
    right: 0;
    z-index: 120;
    background: linear-gradient(90deg, #444, #555);
    padding: 0px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    height: auto;
    width: 100%;
}

/* Nav 項目樣式 */
nav ul li a {
    color: white;
    text-decoration: none;
    padding: 5px 5px;
    margin: 0px 0px;
    border-radius: 5px;
    transition: background-color 0.3s, box-shadow 0.3s;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

nav ul li a:hover {
    background-color: #2481b8;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
    transition: all 0.3s ease-in-out;
}

/* 隱藏導航連結 */
nav ul {
    height: 20px;
    display: flex;
    list-style: none;
    padding: 0px;
    justify-content: center;
    align-items: center;
    gap: 0px;
    /* 項目之間間距 */
}

nav ul li {
    margin: 0 10px;
}

/* ===== Mobile hamburger + label ===== */
nav .hamburger {
    display: none;
    /* 預設大螢幕不顯示（你原本若就是小螢幕顯示，保留也可） */
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

nav .hamburger-bars {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

nav .hamburger-bars>div {
    width: 30px;
    height: 4px;
    border-radius: 3px;
    background: #ffffff;
    /* 可依你的主題色調整 */
}

nav .hamburger-text {
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    color: #ffffff;
    /* 可依你的主題色調整 */
    white-space: nowrap;
}

/* 3. 中間內容區 */
.main-content {
    padding-top: 30px;
    /* header + nav 的高度 */
    padding-bottom: 30px;
    /* footer 的高度 */
}

.sub-container {
    margin: 20px auto 20px auto;
    padding: 10px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    max-width: 100%;
}

/*------------------ 登入註冊表單 ------------------*/
.add-form {
    max-width: 400px;
    margin: 20px auto;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/*------------------ Flash 訊息 ------------------*/
#flash-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4caf50;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 200;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
    text-align: center;
}

/* 群組標題 */
.group-header {
    background-color: #d9edf7;
    font-size: 1.2em;
    font-weight: bold;
    padding: 10px 15px;
    margin-top: 20px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
}

/* 使用者名稱樣式 */
.user-info {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    border-radius: 5px;
    font-weight: bold;
    padding: 10px 0px;
    margin: 0px;
}

.user-info a {
    color: #ddb256;
}

.user-info.marquee span {
    color: #ddb256;
    display: inline-block;
    animation: marquee 8s linear infinite;
}

@keyframes marquee {
    0% {
        transform: translateX(0%);
    }

    100% {
        transform: translateX(-100%);
    }
}


/* 表單選擇容器樣式 */
details summary {
    cursor: pointer;
    font-weight: bold;
    padding: 6px 0;
    margin: 5px auto;
    font-size: 1.2rem;
}

/* ===== moved from templates/auth.php ===== */
/* Auth page scoped styles (apply by adding class="auth-page" on <body>) */
body.auth-page {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
    padding: 24px !important;
    background: #f8fafc;
}

body.auth-page .card {
    max-width: 760px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px;
}

body.auth-page .t {
    font-weight: 800;
    font-size: 1.1rem;
    margin: 0 0 8px;
}

body.auth-page .p {
    color: #334155;
    line-height: 1.6;
}

body.auth-page a {
    color: #2563eb;
    text-decoration: none;
}

/* ==========================
   Responsive rules
   (merged from style-mobile.css in Step14; keep HTML unchanged)
   ========================== */

@media screen and (max-height: 640px) and (orientation: landscape) and (min-aspect-ratio: 13/9) {

    header,
    footer {
        display: none;
    }

    nav {
        top: 0px;
        height: 50px;
    }

    nav ul {
        height: 15px;
    }

    /* 只套用 Safari */
    .safari nav {
        top: 0px;
        height: 50px;
    }
}

/* LOGO 縮小 + Navbar（手機直向） */
@media screen and (max-width: 640px) and (orientation: portrait) {
    #logo-img1 {
        display: none;
    }

    #logo-img2 {
        display: block;
        height: 50px;
    }

    nav {
        flex-direction: column;
        top: 70px;
    }

    nav .hamburger {
        display: flex;
    }

    nav ul {
        flex-direction: column;
        display: none;
        height: auto;
    }

    nav ul.show {
        display: flex;
    }

    nav ul li {
        margin: 10px 0;
    }

    .copyright {
        font-size: 14px;
        margin-bottom: 5px;
    }

    .since {
        font-size: 10px;
        margin-left: 5px;
    }

    .credits {
        font-size: 10px;
        margin-right: 5px;
    }
}

@media screen and (max-width: 640px) {
    .main-content {
        padding-top: 40px;
        /* header + nav 的高度 */
        padding-bottom: 50px;
        /* footer 的高度 */
    }

}

/* ===== 通用按鈕基礎 (footer.php) ===== */
.ext-btn,
.debug-fab,
.fab-main {
    position: fixed;
    bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: bold;
    z-index: 9999;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none;
}

/* 外部瀏覽器按鈕樣式 */
.ext-btn {
    left: 25px;
    background-color: #319acaff;
    display: none;
    /* 由 JS 判定顯示 */
}

/* Debug 按鈕樣式 (置中) */
.debug-fab {
    left: 50%;
    transform: translateX(-50%);
    background: #111;
}

/* 社群主按鈕樣式 (右側) */
.fab-main {
    right: 25px;
    background-color: #777bb4;
    width: auto;
    height: auto;
}

/* 統一 Hover 效果：大螢幕上移並加深陰影 */
.ext-btn:hover,
.debug-fab:hover,
.fab-main:hover {
    opacity: .85;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .3);
}

.ext-btn:hover {
    transform: translateY(-4px);
}

.debug-fab:hover {
    transform: translateX(-50%) translateY(-4px);
}

.fab-main:hover {
    transform: translateY(-4px);
}

/* ===== 社群選單專屬樣式 ===== */
.fab-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 10000;
}

.fab-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    position: absolute;
    bottom: 70px;
    /* 在主按鈕上方 */
    right: 0;
}

.fab-container.active .fab-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-item {
    width: 50px;
    height: 50px;
    margin-bottom: 15px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    overflow: hidden;
}

.fab-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fab-item:hover {
    transform: scale(1.1);
}

/* Tooltip */
.fab-item::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 65px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.fab-item:hover::after {
    opacity: 1;
}

/* ===== 小螢幕 RWD 控制 ===== */
@media (max-width: 576px) {
    .btn-text {
        display: none;
    }

    .ext-btn,
    .debug-fab,
    .fab-main {
        width: 52px;
        height: 52px;
        padding: 0;
        border-radius: 50%;
        bottom: 20px;
    }

    .ext-btn {
        left: 15px;
    }

    .fab-main {
        right: 15px;
    }

    .fab-container {
        bottom: 20px;
        right: 15px;
    }

    .debug-fab {
        left: calc(50% - 26px);
        transform: none;
    }

    .debug-fab:hover {
        transform: translateY(-4px);
    }
}

/* Debug 面板樣式保持不變 */
.debug-panel {
    position: fixed;
    left: 18px;
    bottom: 85px;
    z-index: 99998;
    width: min(520px, calc(100vw - 36px));
    max-height: min(70vh, 520px);
    overflow: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .22);
    border: 1px solid rgba(0, 0, 0, .08);
    transform: translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.debug-panel.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.debug-panel__header {
    position: sticky;
    top: 0;
    background: #fafafa;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
}

.debug-panel__title {
    font-weight: 800;
    margin: 0;
    font-size: 14px;
}

.debug-panel__close {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    padding: 6px 8px;
    border-radius: 10px;
}

.debug-panel__body {
    padding: 12px;
    font-size: 13px;
    color: #222;
}

.debug-panel__pre {
    background: #0b1020;
    color: #e7eefc;
    border-radius: 12px;
    padding: 10px 12px;
    overflow: auto;
    white-space: pre;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.45;
}

/* ===== 手機橫向：隱藏 footer 浮動快捷按鈕 ===== */
@media screen and (orientation: landscape) and (pointer: coarse) and (max-width: 1024px) {
    .ext-btn,
    .debug-fab,
    .fab-container,
    .debug-panel {
        display: none !important;
    }
}
