/* flask_ctf_platform/static/style.css */

/* 引入自定義字體 */
@font-face {
    font-family: 'SimpleHandmade';
    src: url('/static/SimpleHandmade.otf') format('opentype');
}

/* 強制全域字體 */
* {
    font-family: 'SimpleHandmade', 'Times New Roman', serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* 基本字體和背景 */
body {
    background-color: #f7f3e9;
    color: #3f3e3e;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    text-align: center;
    position: relative;
}
body::before {
    content: '';
    position: absolute;
    top:0; left:0; right:0; bottom:0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10"><circle cx="1" cy="1" r="0.5" fill="%23e8e4dc"/><circle cx="6" cy="6" r="0.5" fill="%23e8e4dc"/></svg>'), repeating-linear-gradient(0deg, transparent, transparent 30px, rgba(139,90,43,0.05) 30px, rgba(139,90,43,0.05) 31px), repeating-linear-gradient(90deg, transparent, transparent 30px, rgba(139,90,43,0.05) 30px, rgba(139,90,43,0.05) 31px);
    background-blend-mode: multiply;
    opacity: 0.95;
    pointer-events: none;
    z-index: 1;
}
body > * { position: relative; z-index:2; }

/* Nav */
nav { display:flex; justify-content:center; gap:25px; background-color:#c9bda5; padding:10px 0; border-bottom:2px solid #a89f8c; font-weight:bold; box-shadow:0 2px 5px rgba(0,0,0,0.2); margin-bottom:40px; }
nav a {
    text-decoration: none;
    color: #3f3e3e;
    padding: 8px 18px;
    position: relative;
    transition: transform 0.2s ease, color 0.2s ease;
}

/* 移除原底部線條 */
nav a::after {
    display: none;
}

/* 滑鼠經過時微微上浮並變色 */
nav a:hover {
    transform: translateY(-3px);
    color: #6a5e4b;
}

/* Containers */
.label-container { margin:25px auto; width:70%; text-align:center; background-color:#fcfaf5; border:1px solid #d4cbb6; box-shadow:0 1px 3px rgba(0,0,0,0.1); }
.label-title { background-color:#e8e1d2; padding:12px; cursor:pointer; display:block; width:100%; border:none; border-bottom:1px solid #d4cbb6; font-size:1.1em; font-weight:bold; color:#3f3e3e; text-align:left; padding-left:40px; position:relative; }
.label-title::before { content:'►'; position:absolute; left:15px; top:50%; transform:translateY(-50%); transition:transform 0.3s; font-size:0.8em; color:#6a5e4b; }
.label-title.active::before { transform:translateY(-50%) rotate(90deg); }
.label-title:hover { background-color:#f0ebdf; }
.label-content { display:none; background-color:#fffefb; color:#3f3e3e; padding:15px; width:100%; margin:0 auto; text-align:left; font-size:0.95em; }

/* Tables */
table { width:100%; border-collapse:collapse; margin:15px 0; }
th, td { border:1px solid #e1d8c2; padding:10px; text-align:left; }
th { background-color:#e8e1d2; color:#4b3e34; font-weight:bold; }
td { font-size:0.95em; }

/* Forms */
.login-container { width:50%; margin:40px auto; background-color:#fcfaf5; border:1px solid #d4cbb6; padding:25px; box-shadow:0 1px 3px rgba(0,0,0,0.1); }
.admin-container { width:70%; margin:40px auto; background-color:#fcfaf5; border:1px solid #d4cbb6; padding:25px; box-shadow:0 1px 3px rgba(0,0,0,0.1); }
.login-title, .admin-title { font-family:'SimpleHandmade','Times New Roman', serif; font-size:1.8em; font-weight:bold; margin-bottom:20px; color:#4b3e34; text-shadow:1px 1px 1px rgba(255,255,255,0.6); }
.input-group { margin-bottom:18px; text-align:left; }
.input-label { display:block; margin-bottom:8px; font-size:1em; color:#4b3e34; font-weight:bold; }
.login-input, .flag-input { width:calc(100% - 22px); padding:10px; border:1px solid #b3a795; background-color:#fffefb; font-size:1em; color:#3f3e3e; box-shadow:inset 0 1px 2px rgba(0,0,0,0.05); border-radius:6px; }
.login-button, .submit-button { background-color:#e8e1d2; border:1px solid #d4cbb6; padding:10px 25px; font-size:1.05em; cursor:pointer; color:#3f3e3e; font-weight:bold; transition:background-color 0.3s, transform 0.2s; border-radius:6px; }
.login-button:hover, .submit-button:hover { background-color:#f0ebdf; transform:translateY(-1px); }

.home-center { text-align:center; margin-top:150px; font-size:4em; font-weight:bold; color:#4b3e34; }

/* Modal */
.modal { position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.5); display:flex; justify-content:center; align-items:center; z-index:999; }
.modal-content { background:#fcfaf5; padding:20px; border:1px solid #d4cbb6; width:70%; max-height:80%; overflow:auto; border-radius:8px; text-align:left; }
.close { float:right; cursor:pointer; font-size:1.5em; }

/* Admin tables */
.admin-table { width:100%; border-collapse:collapse; margin:15px 0; }
.admin-table th, .admin-table td { border:1px solid #e1d8c2; padding:10px; }
.admin-table th { background-color:#e8e1d2; color:#4b3e34; font-weight:bold; }

.toast {
    background-color: #fcfaf5;
    border: 1px solid #d4cbb6;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 12px 20px;
    margin-top: 10px;
    border-radius: 6px;
    font-family: 'SimpleHandmade', 'Times New Roman', serif;
    color: #3f3e3e;
    min-width: 200px;
    max-width: 300px;
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* --------- 手機響應式設計 --------- */
@media (max-width: 1024px) {
    /* 導覽列改成換行排列 */
    nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    nav a {
        padding: 8px 12px;
        font-size: 1em;
    }

    /* 容器寬度自適應 */
    .label-container,
    .login-container,
    .admin-container,
    .modal-content {
        width: 95%;
        margin: 15px auto;
        padding: 15px;
    }

    /* Label 標題文字和 padding 調整 */
    .label-title {
        padding-left: 30px;
        font-size: 1em;
    }

    /* Label content 文字大小 */
    .label-content {
        font-size: 0.9em;
    }

    /* 表格可橫向滾動 */
    .label-content table,
    .admin-table,
    .admin-table table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
    th, td {
        padding: 8px;
        font-size: 0.9em;
    }

    /* 按鈕與輸入框 */
    .login-button, .submit-button {
        padding: 8px 15px;
        font-size: 0.95em;
    }
    .flag-input, .login-input {
        width: 100%;
        font-size: 0.95em;
    }

    /* Modal 調整 */
    .modal-content h2 {
        font-size: 1.2em;
    }
}

/* 小螢幕手機（直向） */
@media (max-width: 480px) {
    nav {
        gap: 5px;
    }
    nav a {
        font-size: 0.9em;
        padding: 6px 10px;
    }

    .label-title {
        padding-left: 25px;
        font-size: 0.95em;
    }

    .modal-content {
        width: 90%;
        padding: 10px;
    }

    th, td {
        font-size: 0.85em;
        padding: 6px;
    }

    .login-button, .submit-button {
        font-size: 0.9em;
        padding: 6px 12px;
    }

    .toast {
        min-width: 150px;
        max-width: 90%;
        font-size: 0.9em;
        padding: 10px 15px;
    }
}

/* Toast 位置固定在上方，手機友善 */
#toast-container {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Toast 文字換行避免過長破版 */
.toast {
    word-wrap: break-word;
}
