/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

/* 页面居中 */
#app_background {
    min-height: 100vh;
    background: linear-gradient(135deg, rgb(221, 221, 221), rgb(221, 221, 221));
    font-family: Arial, sans-serif;
    padding: 20px;
    text-align: center;
    margin: 0;
    padding-bottom: 80px;
}

h1 {
    font-size: 30px;
    color: #333;
    margin-top: 20px;
}

.item_btn {
    margin: 10px 0;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #7e9cbc;
    color: white;
    border: none;
    border-radius: 5px;
    min-width: 500px;
}

.item_btn:hover {
    background-color: #435c77;
}

.section {
    margin-bottom: 30px;
}

.section .new_btn {
    display: inline-block;
    margin: 10px;
}

.new_btn {
    margin: 10px 0;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #637485;
    color: white;
    border: none;
    border-radius: 5px;
}

.new_btn:hover {
    background-color: rgb(52, 68, 85);
}

.btn_save {
    background-color: #3c7fc3;
    color: white;
    border: none;
}

.btn_save:hover {
    background-color: #80b2e4;
}

.content-container {
    max-height: 100vh;
    padding-bottom: 20px;
}

.revisions-wrapper {
    margin-left: 0px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.2rem;
    margin-bottom: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
}

.revision-wrapper {
    min-height: 55px;
    background-color: #d0d8df;
    border: 1px solid #d0d8df;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
}

.field-group {
    gap: 2px;
    min-width: 0;
    /* 控制元素間距 */
}

.revision-label {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 1px;
    /* margin-right: -1.8rem; */
    /* 讓 label 和 input 之間有少許間距 */
}

.date-input,
.note-input {
    min-width: 0;
    flex-grow: 1;
    /* 確保 input 不會過寬，保持一致的間距 */
    height: 40px;
    /* 明確設定高度，使兩者一致 */
    padding: 6px 5px 6px 3px;
}

.revision_btn {
    white-space: nowrap;
    padding: 1.5px 4px;
    cursor: pointer;
    background-color: #637485;
    color: white;
    border: none;
    border-radius: 5px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
}

.modal-header {
    font-size: 18px;
    font-weight: bold;
}

.modal-body {
    margin: 10px 0;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: 70vh;
}

.title_label {
    width: 90px;
    text-align: right;
}

label {
    text-align: right;
    white-space: nowrap;
}

.form-control {
    flex: 1;
    /* 讓 input 佔據剩餘空間 */
}

.input_text {
    text-align: left;
    font-weight: bold;
    display: inline-block;
    white-space: nowrap;
}

.breakable-text {
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: break-word;
    display: block;
}

.article_text {
    text-align: left;
    font-weight: bold;
    display: inline-block;
    white-space: nowrap;
    min-width: 40px;
    /* padding-right: 10px; */
}

.article-label {
    min-width: 6em;
    padding-right: 5px;
    /* justify-content: center; */
    display: flex;
    /* text-align: left; */
    white-space: nowrap;
    /* 禁止換行 */
}

.fixed-label {
    display: inline-block;
    min-width: 8em;
    /* 8 個中文字寬度 */
    text-align: left;
    white-space: nowrap;
}

.normal_text {
    text-align: left;
    /* 文字靠左 */
    display: inline-block;
    padding: 0;
    margin: 0;
    font-weight: normal;
}

.description-text {
    white-space: normal;
    /* 允許換行 */
    word-break: break-word;
    line-height: 1.6;
    text-align: left;
}

.agenda-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.clause-wrapper {
    &.editable {
        padding: 4px 0 0 26px;
    }

    &.readonly {
        padding: 0;
    }
}

.textarea-wrapper {
    position: relative;
    width: 100%;
}

.textarea-wrapper textarea {
    width: 100%;
    min-height: 80px;
    padding-right: 50px;
    /* 預留右側空間給按鈕 */
    box-sizing: border-box;
}

.auto-resize-textarea {
    font-size: 16px;
    line-height: 1.5;
    /* 預設一行 */
    padding: 5px 0 3px 12px;
    border: 1px solid #ccc;
    resize: none;
    box-sizing: border-box;
    overflow: hidden;
}


.textarea-wrapper.three-buttons textarea {
    min-height: 110px;
}

.textarea-buttons {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.textarea-wrapper1 {
    position: relative;
    width: 100%;
}

.textarea-wrapper1 textarea {
    width: 100%;
    padding-right: 75px;
    /* 預留右側空間給按鈕 */
    box-sizing: border-box;
}

.textarea-wrapper1.three-buttons textarea {
    padding-right: 115px;
}

.textarea-wrapper1 .btn {
    height: 37px;
    border-radius: 0px;
    white-space: nowrap;
}

.textarea1-buttons {
    position: absolute;
    bottom: 0;
    right: 0;
}


.input-group .btn {
    height: 100%;
    border-radius: 0;
    white-space: nowrap;
}

.add_btn {
    white-space: nowrap;
    padding: 1.5px 4px;
    cursor: pointer;
    background-color: #637485;
    color: white;
    border: none;
    border-radius: 5px;
}


.add_btn:hover {
    background-color: #a9bed5;
}

.delete_btn {
    white-space: nowrap;
    /* 防止按鈕折行 */
    padding: 1.5px 4px;
    cursor: pointer;
    background-color: #c71d1d;
    color: white;
    border: none;
    border-radius: 5px;
}

.delete_btn:hover {
    background-color: #ea4646;
}

.article-wrapper {
    margin-left: 10px;
    background-color: #61a6ec;
    /* 內距 */
    margin-bottom: 0.5rem;
    margin-top: 5rem;
    /* 每筆細項之間的間距 */
    position: relative;
}

.chapter_btn {
    white-space: nowrap;
    /* 防止按鈕折行 */
    padding: 2px 5px;
    cursor: pointer;
    background-color: #5593d0;
    color: white;
    border: none;
    border-radius: 5px;
}

.chapter_btn:hover {
    background-color: #0e355f;
}

.scroll-top-btn {
    position: absolute;
    bottom: 100px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-size: 30px;
}

.scroll-top-btn:hover {
    background-color: #495057;
    transform: translateY(-3px);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* 半透明黑色背景 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* 確保最上層 */
}

.loading-box {
    background-color: #fff;
    padding: 20px 30px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.loading-text {
    margin-left: 15px;
    font-size: 1.2rem;
    color: #333;
}

.uploading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* 半透明黑色背景 */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* 確保最上層 */
}

.uploading-box {
    background-color: #fff;
    padding: 20px 30px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.uploading-text {
    margin-left: 15px;
    font-size: 1.2rem;
    color: #333;
}

.custom-spinner {
    color: #2b642d;
    /* spinner 顏色 */
}

.switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    background-color: #ccc;
    border-radius: 34px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: 0.4s;
}

.slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: 0.4s;
}

input:checked+.slider {
    background-color: #4c7aaf;
}

input:checked+.slider::before {
    transform: translateX(28px);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #333;
    padding: 10px 15px;
    flex-wrap: wrap;
    font-size: larger;
}

/* Logo + 標題 */
.logo-title {
    display: flex;
    align-items: center;
    gap: 5px;
}

.logo {
    height: 50px;
    display: block;
}

.system-title {
    font-size: 20px;
    font-weight: bold;
    color: white;
}

/* 漢堡按鈕（手機用） */
.menu-toggle {
    font-size: 24px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: none;
    /* 桌機不顯示 */
}

/* 桌機選單 */
nav ul {
    list-style-type: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}

nav ul li a {
    color: white;
    text-decoration: none;
    padding: 10px;
}

nav ul li a:hover {
    background-color: #575757;
    color: black;
}

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

    .item-row {
        flex-direction: row;
        justify-content: center;
        /* 按鈕靠左 */
        gap: 5px;
    }

    .item_btn {
        min-width: 100%;
        /* 滿版寬度 */
        box-sizing: border-box;
        /* 確保 padding 也包含在寬度內 */
        margin: 5px 0;
        /* 可選：縮小按鈕的上下間距 */
    }

    .delete_btn,
    .revision_btn,
    .schedule_btn,
    .detail_btn,
    .btn_save,
    .btn-secondary {
        min-width: 25px;
        box-sizing: border-box;
        font-size: 14px;
    }

    .scroll-top-btn {
        position: absolute;
        width: 35px;
        height: 35px;
        bottom: 85px;
        right: 10px;
        font-size: 25px;
    }

    .detail-wrapper {
        &.editable {
            margin-left: -5px;
        }
    }

    .menu-toggle {
        display: block;
    }

    nav {
        width: 100%;
        display: none;
    }

    nav.open {
        display: block;
    }

    nav ul {
        flex-direction: column;
        gap: 0;
    }

    nav ul li a {
        display: block;
        border-top: 1px solid #444;
        padding: 12px 20px;
    }
}

@media print {
    body * {
        visibility: hidden !important;
    }

    /* 只顯示 modal 本體與其內部 */
    .modal,
    .modal * {
        visibility: visible !important;
    }

    /* 讓 modal 本身仍保留 layout */
    .modal {
        position: absolute !important;
        overflow: visible !important;
        left: 0;
        top: 0;
        width: 100% !important;
    }

    .modal-dialog {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .modal-content {
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
    }

    .modal-body {
        max-height: none !important;
        overflow: visible !important;
    }

    .modal-backdrop {
        display: none !important;
    }

    .input_text {
        font-size: 14pt;
        line-height: 1.5;
    }

    /* 如果你還是要隱藏按鈕之類的 */
    .file-input,
    .visible,
    .scroll-top-btn,
    .btn,
    .close {
        display: none !important;
    }
}


/* Footer 样式 */
footer {
    text-align: center;
    padding: 20px;
    background-color: #333;
    color: white;
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 60px;
}