/* --- 1. 基礎重置與佈局 --- */
body {
    font-family: "Microsoft JhengHei", "PingFang TC", sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    line-height: 1.6;
}

/* 確保全站容器一致 */
.container {
    width: 95%;
    max-width: 1100px;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* --- 2. 導覽列 (Navbar) 強化 --- */
.navbar {
    background: #007bff;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* 核心：確保導覽列永遠在最上層，不會被頁面內容遮擋 */
    position: sticky;
    top: 0;
    z-index: 1000; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo {
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.nav-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-right a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

/* --- 3. 下拉選單 (Dropdown) 修正 --- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background-color: #0056b3;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0; /* 靠右對齊，避免選單超出螢幕左側 */
    background-color: #ffffff;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1001;
    border-radius: 4px;
    overflow: hidden; /* 確保圓角效果 */
}

.dropdown-content a {
    color: #333 !important; /* 強制文字變深色 */
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.dropdown-content a:hover {
    background-color: #f8f9fa;
    color: #007bff !important;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* --- 4. 登入彈窗 (Modal) 專用樣式 --- */
.modal-bg {
    display: flex; /* 使用 Flex 居中 */
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* 遮罩深一點比較有質感 */
    z-index: 9999; /* 必須高於導覽列 */
}

.hidden {
    display: none !important;
}

/* 狀態標籤 (用於報名審核結果) */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
}
.status-0 { background: #fff3cd; color: #856404; } /* 待審 */
.status-1 { background: #d4edda; color: #155724; } /* 通過 */
.status-2 { background: #cce5ff; color: #004085; } /* 推薦 */

/*學年度*/
.year-badge {
    background-color: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    border: 1px solid #dee2e6;
    margin-right: 5px;
}

/* --- 5. 按鈕通用樣式 --- */
button {
    cursor: pointer;
    border-radius: 4px;
    transition: opacity 0.2s;
}
button:hover {
    opacity: 0.9;
}

/* contest_setup.php用*/
.setup-container { max-width: 1000px; margin: 20px auto; }
.contest-table { width: 100%; border-collapse: collapse; background: white; margin-top: 20px; }
.contest-table th, .contest-table td { border: 1px solid #eee; padding: 12px; text-align: left; }
.contest-table th { background: #f8f9fa; }

/* contest_setup.php用_表單區塊樣式 */
.add-box { background: #eefbff; padding: 20px; border-radius: 8px; border: 1px solid #b8daff; margin-bottom: 30px; }
.form-row { display: flex; gap: 15px; margin-bottom: 15px; flex-wrap: wrap; }
.form-item { flex: 1; min-width: 200px; }
.form-item label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-item input, .form-item select { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }

.btn-add { background: #007bff; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; }

/* --- 更新後的表格樣式 --- */
.news-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    /* 核心：讓寬度分配更穩定 */
    table-layout: auto; 
}

.news-table th, .news-table td {
    border: 1px solid #eee;
    padding: 15px 12px; /* 增加內距，讓文字有呼吸空間 */
    text-align: left;
    vertical-align: middle;
    word-wrap: break-word; /* 防止長文字撐破表格 */
}

.news-table th {
    background-color: #007bff;
    color: white;
    font-weight: bold;
    white-space: nowrap;
}

/* 斑馬紋效果，提升閱讀舒適度 */
.news-table tr:nth-child(even) {
    background-color: #fcfcfc;
}

.news-table tr:hover {
    background-color: #f1f8ff; /* 滑鼠移過時的微光效果 */
}

/* 強制讓某些容器撐滿 100% 螢幕寬度 */
.container {
    width: 95%;      /* 增加寬度佔比 */
    max-width: 1400px; /* 提高最大寬度上限 */
    margin: 20px auto;
}