/* ===== 全域設定 ===== */
html,
body {
    height: 100%;
}

body {
    overflow-x: hidden;
    overflow-y: auto;

    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f4f6f9;
}

/* ===== Header ===== */
.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background-color: #1e2a38;
    color: white;
}

.left {
    font-size: 50px;
    font-weight: bold;
    cursor: pointer;

}

.right {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: flex-end;
}

.right_sign {
    cursor: pointer;
}

.right_note2 {
    cursor: pointer;
}

.right_sign img {
    width: 35px;
}

.right_note2 img {
    width: 35px;
}

/* ===== Header ===== */

/* ======= sidebar ======= */
/* 漢堡按鈕 */
.tag {
    position: fixed;
    left: 0;
    top: 40%;
    padding: 10px 8px;
    border-radius: 0 12px 12px 0;
    cursor: pointer;
    z-index: 1000;

    background: linear-gradient(135deg,
            #f8f8f8 0%,
            #e6e6e6 30%,
            #ffffff 60%,
            #dcdcdc 100%);
    box-shadow:
        2px 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 0 10px rgba(255, 255, 255, 0.6);

    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hamburger-tag:hover {
    transform: translateX(3px);
    box-shadow:
        3px 3px 12px rgba(0, 0, 0, 0.2),
        inset 0 0 15px rgba(255, 255, 255, 0.7);
    background-color: #888;
}

.tag img {
    display: block;
}

/* 背景遮罩 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    z-index: 1100;
}

/* Sidebar 主體 */
.sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    /* 預設隱藏 */
    width: 260px;
    height: 100%;
    background: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    transition: left 0.3s ease;
    z-index: 1101;
}

.sidebar-content {
    padding: 20px;
}

.sidebar-content div:hover {
    background: #f5f5f5;
    cursor: pointer;
}

.sidebar-content a {
    display: block;
    padding: 10px 0;
    text-decoration: none;
    color: #333;
}

.sidebar-content a:hover {
    color: #007bff;
}

.mobile-topbar {
    display: none;
}

/* 第一層submenu */
.menu-item {
    position: relative;
}

.menu-link {
    padding: 10px 0;
    cursor: pointer;
    font-weight: 600;
    color: #222;
}

.submenu {
    display: none;
    padding-left: 15px;
    color: #1e2a38;
}

.menu-item.open>.submenu {
    display: block;
}

/* 第一層 submenu 文字淡一點 */
.submenu a,
.submenu-link {
    color: #666;
    padding-left: 25px;
    /* 往右推一點 */
    position: relative;
}

/* 加左邊小圓點 */
.submenu a::before,
.submenu-link::before {
    content: "•";
    position: absolute;
    left: 10px;
    color: #bbb;
    font-size: 14px;
}

.home,
.warning,
.setting,
.notification-setting,
.menu-link,
.submenu-link {
    display: flex;
    align-items: center;
    /* 垂直置中 */
    align-content: center;
    gap: 15px;
    /* 圖片與文字距離 */
}

.notification-setting span {
    gap: 20px;
}

.menu-link,
.submenu-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-left {
    display: flex;
    align-items: center;
    gap: 15px;
}


.arrow,
.submenu-link img {
    opacity: 0.6;
    /* 箭頭顏色淡一點 */
}

/* 第二層從右側滑出 */
.submenu-item {
    position: relative;
}

.submenu-right {
    position: absolute;
    top: 0;
    left: 180px;
    width: 200px;
    background: white;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    display: none;
    padding: 10px;
}

.submenu-right a {
    color: #888;
    padding-left: 35px;
}

.submenu-item:hover .submenu-right {
    display: block;
}

/* 登出按鈕 */
.logout-btn {
    width: 100%;
    padding: 10px;
    background: #d9534f;
    color: white;
    border: none;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logout-btn:hover {
    background: #c9302c;
}

/* ======= sidebar ======= */

/* ===== Modal 盒子 ===== */
.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #1e2a38;

}

.form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.form-row label {
    width: 90px;
}

.modal {
    position: fixed;
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    width: 350px;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.modal h2 {
    margin-top: 0;
    text-align: center;
}

.modal button {
    margin-top: 15px;
    padding: 8px;
    border: none;
    border-radius: 6px;
    background-color: #1e2a38;
    color: white;
    cursor: pointer;
}

.modal button:hover {
    background-color: #2f3f52;
}

.modal p {
    text-align: center;
    font-size: 14px;
}

.modal a {
    color: #1e2a38;
    font-weight: bold;
    text-decoration: none;
}

.modal a:hover {
    text-decoration: underline;
}


/* ===== Footer ===== */
footer {
    margin-top: 80px;
    padding: 20px;
    background-color: #1e2a38;
    color: white;
}

.footer_text {
    display: flex;
    justify-content: center;
}

.guest-only,
.login-only {
    display: none;
}

.mobile-topbar {
    display: none;
    visibility: hidden;
}

.mobile-topbar.ready {
    visibility: visible;
}

/* ===== Footer ===== */

@media (max-width: 1200px) {
    footer {
        display: flex;
        flex: 1 0 auto;
        flex-shrink: 0;

        align-content: center;
        align-items: center;
        justify-content: center;
    }

    .footer_text {
        display: flex;
        margin: 0;

        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 600px) {
    footer {
        display: flex;
        flex: 1 0 auto;
        flex-shrink: 0;

        font-size: 15px;
    }

    .footer_text {
        display: flex;
        margin: 0;
        align-self: flex-start;
        justify-content: center;
    }
}

/* 手機版 */
@media (max-width:480px) {

    html,
    body {
        overflow-x: hidden;
        max-width: 100%;
    }

    img,
    video {
        max-width: 100%;
        height: auto;
    }

    .left {
        font-size: 30px;
    }

    .right img {
        width: 24px;
        height: 24px;
    }

    .right_sign {
        font-size: 15px;
    }

    .welcome_board {
        margin-top: 50px;
        text-align: center;
        padding: 10px;
    }

    .line0 {
        font-size: 22px;
    }

    .line1 {
        font-size: 16px;
    }

    .line2 {
        font-size: 14px;
    }

    /* sidebar 手機版 */
    .sidebar {
        width: 220px;
    }

    .sidebar-content a {
        font-size: 14px;
    }

    .submenu-right {
        position: static !important;
        left: auto !important;
        top: auto !important;
        width: 100%;
        min-width: 0;
        box-shadow: none;
        border-left: 2px solid #e5e7eb1b;
        margin-top: 8px;
        margin-left: 12px;
        padding-left: 10px;
        background: transparent;
    }

    .submenu-item.has-submenu-right {
        display: block;
    }

    .submenu-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .submenu-right a,
    .submenu-right-year a {
        display: block;
        padding: 8px 0;
        font-size: 13px;
        white-space: normal;
        word-break: break-word;
    }

    footer {
        font-size: 12px;

        display: flex;
        flex: 1 0 auto;
        flex-shrink: 0;
        align-content: center;
        align-items: center;
        justify-content: center;
    }

    /* modal 手機版 */
    .modal {
        width: 70%;
    }

    .footer_text {
        display: flex;
        /* margin: 0; */
        align-self: center;
        justify-content: center;
    }

    /* ========================手機版本上排功能========================== */
    .top {
        display: none !important;
    }

    .tag {
        display: none !important;
    }

    .mobile-topbar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 56px;
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 0 12px;
        box-sizing: border-box;
        background: #1e2a38;
        border-bottom: 1px solid #e5e5e5;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        z-index: 1001;

        -webkit-tap-highlight-color: transparent;
    }

    .mobile-left,
    .mobile-center,
    .mobile-right {
        display: flex;
        align-items: center;
    }

    .mobile-center {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        align-items: center;
    }

    .mobile-left,
    .mobile-right {
        display: flex;
        align-items: center;
    }

    .topbar-brand {
        font-size: 35px;
        font-weight: 700;
        color: white;
    }

    .topbar-btn {
        border: none;
        background: rgba(255, 255, 255, 0.12);

        padding: 0;
        width: 40px;
        height: 40px;
        border-radius: 10px;

        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;

        backdrop-filter: blur(6px);
        /* 🔥質感關鍵 */
        transition: all 0.2s ease;
    }

    .topbar-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .topbar-btn:active {
        transform: scale(0.92);
        background: rgba(255, 255, 255, 0.25);
    }

    .mobile-icons {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .topbar-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    body {
        padding-top: 56px;
    }

    .sidebar-user-box {
        padding: 12px 0 16px;
        border-bottom: 1px solid #eee;
        margin-bottom: 12px;
    }

    .sidebar-user-greet {
        font-size: 16px;
        font-weight: 600;
        color: #333;
        margin-bottom: 8px;
    }

    .sidebar-user-link {
        display: inline-block;
        font-size: 14px;
        color: #007bff;
        text-decoration: none;
    }

    .sidebar-user-link:hover {
        text-decoration: underline;
    }


    .mobile-topbar,
    .mobile-topbar * {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
    }

    .topbar-btn,
    .topbar-icon,
    .mobile-left,
    .mobile-center,
    .mobile-right {
        outline: none;
    }

}