/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Roboto, system-ui, sans-serif; }
body { background: #e9f0f7; min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 24px 16px; }
.app-container { width: 100%; max-width: 1300px; } /* 稍微加寬最大寬度 */

/* ===== 頂部橫列 ===== */
.header-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; background: #fff; border-radius: 60px; padding: 8px 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.06); margin-bottom: 28px; border: 1px solid #d9e2ec; }
.logo-area { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.3rem; color: #0b2a4a; letter-spacing: 0.5px; }
.logo-icon { background: #0b2a4a; color: #fff; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.callsign-badge { background: #0066cc; color: #fff; padding: 4px 14px; border-radius: 40px; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.5px; }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; list-style: none; }
.nav-links a { text-decoration: none; color: #2c3e50; font-weight: 500; padding: 10px 18px; border-radius: 40px; transition: 0.2s; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a.active { background: #e6f0ff; color: #0066cc; }

/* ===== 四國語言滑動開關 ===== */
.lang-switch {
    position: relative;
    display: flex;
    align-items: center;
    background: #e0e9f2;
    border-radius: 40px;
    padding: 4px;
    cursor: pointer;
    width: max-content;
    height: 38px;
    user-select: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.lang-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 42px;
    height: calc(100% - 8px);
    background: #fff;
    border-radius: 30px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1;
}

.lang-switch[data-active="cn"] .lang-slider { transform: translateX(42px); }
.lang-switch[data-active="en"] .lang-slider { transform: translateX(84px); }
.lang-switch[data-active="ja"] .lang-slider { transform: translateX(126px); }

.lang-option {
    width: 42px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #7e96af;
    z-index: 2;
    transition: color 0.3s;
}

.lang-switch[data-active="zh"] .lang-option[data-lang="zh"],
.lang-switch[data-active="cn"] .lang-option[data-lang="cn"],
.lang-switch[data-active="en"] .lang-option[data-lang="en"],
.lang-switch[data-active="ja"] .lang-option[data-lang="ja"] {
    color: #0b2a4a;
}

/* ===== 卡片 ===== */
.card { background: #fff; border-radius: 32px; padding: 28px 30px; box-shadow: 0 8px 24px rgba(0,0,0,0.04); border: 1px solid #e0e9f2; margin-bottom: 28px; }
.card h2 { font-size: 1.5rem; font-weight: 600; color: #0b2a4a; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.card-sub { color: #5a6e85; font-size: 0.95rem; margin-bottom: 22px; }

/* ===== 按鈕 ===== */
.btn { padding: 14px 28px; border-radius: 40px; border: none; font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; background: #eef3f9; color: #1f3a5f; }
.btn-primary { background: #0b2a4a; color: #fff; }
.btn-primary:hover { background: #123a63; }
.btn-outline { background: transparent; border: 1px solid #b8cee4; }
.btn-outline:hover { background: #eef6ff; border-color: #7aa9d9; }
.btn-sm { padding: 8px 18px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== 角色標籤 ===== */
.role-badge { padding: 6px 16px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; background: #e3efff; color: #0066cc; display: inline-block; }
.role-badge.admin { background: #fff3e0; color: #b45f06; }

/* ===== 表格 ===== */
.table-wrapper { overflow-x: auto; margin-top: 16px; border-radius: 20px; border: 1px solid #e1eaf2; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { background: #f4f9ff; text-align: left; padding: 16px 12px; font-weight: 600; color: #1a3a5c; border-bottom: 1px solid #dae5f0; white-space: nowrap; }
td { padding: 14px 12px; border-bottom: 1px solid #edf2f8; color: #2b4056; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafdff; }

/* 🌟 針對管理後台表格的特製優化，讓它不用左右滑動 */
#adminPanel table { min-width: 100% !important; }
#adminPanel th, #adminPanel td { padding: 10px 8px; font-size: 0.85rem; }

/* ===== 狀態徽章 ===== */
.badge-none { background: #e0e9f2; color: #5a6e85; padding: 4px 12px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.badge-not-needed { background: #f3e5ff; color: #7b3fa0; padding: 4px 12px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.badge-pending { background: #fff0d9; color: #b45f06; padding: 4px 12px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.badge-received { background: #d9f0e0; color: #0e6b3e; padding: 4px 12px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.badge-sent { background: #e0e7ff; color: #3b4e9e; padding: 4px 12px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.badge-requested { background: #f3e5ff; color: #7b3fa0; padding: 4px 12px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.badge-completed { background: #d9f0e0; color: #0e6b3e; padding: 4px 12px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.badge-completed-dark { background: #0f5132; color: #ffffff; padding: 4px 12px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.badge-approved { background: #d9f0e0; color: #0e6b3e; padding: 4px 12px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; display: inline-block; white-space: nowrap; }
.badge-rejected { background: #fde8e8; color: #b03030; padding: 4px 12px; border-radius: 40px; font-size: 0.8rem; font-weight: 600; display: inline-block; white-space: nowrap; }

/* ===== 搜尋框 ===== */
.search-box { flex: 1; max-width: 300px; min-width: 200px; }
.search-box input { width: 100%; padding: 10px 16px; border-radius: 40px; border: 1.5px solid #cbdae8; font-size: 0.9rem; background: #f8fbfe; outline: none; transition: 0.25s; font-family: inherit; }
.search-box input:focus { border-color: #0066cc; background: #ffffff; box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.15); }

/* ===== 篩選下拉選單 ===== */
.filter-select {
    padding: 10px 16px;
    border-radius: 40px;
    border: 1.5px solid #cbdae8;
    font-size: 0.9rem;
    background: #ffffff;
    color: #1f3a5f;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    transition: 0.25s;
}
.filter-select:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.15);
}

/* ===== 管理員登入與表單 ===== */
.admin-login-box { background: #f8fbfe; padding: 24px 28px; border-radius: 24px; border: 1px solid #dbe7f3; display: flex; flex-direction: column; gap: 16px; max-width: 400px; margin: 0 auto; }
.admin-login-box input { width: 100%; height: 50px; padding: 10px 20px; border-radius: 12px; border: 1px solid #cbdae8; font-size: 1rem; outline: none; background: #fff; }
.admin-login-box input:focus { border-color: #0066cc; box-shadow: 0 0 0 3px rgba(0,102,204,0.1); }
.admin-login-box .btn { width: 100%; padding: 14px; border-radius: 12px; }

.admin-upload-grid { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 24px; }
.admin-upload-grid > div { flex: 1; min-width: 250px; }
.manual-form { display: flex; flex-direction: column; gap: 10px; }
.manual-form input, .manual-form select { padding: 12px 18px; border-radius: 12px; border: 1.5px solid #cbdae8; outline: none; font-family: inherit; font-size: 1rem; background: #f8fbfe; color: #2b4056; }
.manual-form input:focus, .manual-form select:focus { border-color: #0066cc; background: #fff; box-shadow: 0 0 0 4px rgba(0,102,204,0.15); }

/* ===== 上傳區與縮圖 ===== */
.upload-zone { border: 2px dashed #b8cee4; border-radius: 24px; padding: 32px 24px; text-align: center; background: #fbfdff; transition: 0.2s; }
.upload-zone:hover { border-color: #0066cc; background: #f4faff; }
.upload-label { display: inline-block; background: #0b2a4a; color: #fff; padding: 12px 32px; border-radius: 40px; cursor: pointer; font-weight: 500; transition: 0.2s; margin-bottom: 8px; }
.upload-label:hover { background: #123a63; }
.file-hint { color: #6b8199; font-size: 0.85rem; margin-top: 8px; }
.file-name { margin-top: 12px; font-size: 0.9rem; color: #1f3a5f; font-weight: 500; }
.upload-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.upload-btns label { cursor: pointer; padding: 6px 12px; border-radius: 40px; font-size: 0.78rem; font-weight: 600; border: 1px solid #b8cee4; background: #fff; transition: 0.15s; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.upload-btns label:hover { background: #eef6ff; border-color: #7aa9d9; }
.upload-btns input[type="file"] { display: none; }
.qsl-thumb { width: 40px; height: 28px; object-fit: cover; border-radius: 4px; border: 1px solid #dbe7f3; cursor: pointer; transition: 0.15s; background: #f4f9ff; }
.qsl-thumb:hover { transform: scale(1.05); border-color: #0066cc; }
.qsl-thumb-empty { width: 40px; height: 28px; border-radius: 4px; border: 1px dashed #cbdae8; display: flex; align-items: center; justify-content: center; color: #b8cee4; font-size: 1rem; background: #fbfdff; }

/* ===== 燈箱與 Toast ===== */
.lightbox { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.75); display: none; align-items: center; justify-content: center; z-index: 2000; padding: 24px; }
.lightbox.show { display: flex; }
.lightbox img { max-width: 90%; max-height: 85vh; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); background: #fff; padding: 8px; }
.lightbox-close { position: absolute; top: 24px; right: 32px; color: #fff; font-size: 2rem; cursor: pointer; line-height: 1; }
.lightbox-close:hover { opacity: 0.7; }
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px); background: #0b2a4a; color: #fff; padding: 14px 32px; border-radius: 60px; font-weight: 500; font-size: 0.95rem; opacity: 0; pointer-events: none; transition: 0.3s ease; box-shadow: 0 12px 28px rgba(0,0,0,0.2); z-index: 3000; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.flex-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.empty-state { text-align: center; padding: 40px 20px; color: #7e96af; }

/* ===== 響應式 (手機版優化) ===== */
@media (max-width: 700px) {
    .header-bar { flex-direction: column; border-radius: 24px; padding: 16px; gap: 16px; }
    .nav-links { justify-content: center; width: 100%; }
    .nav-links a { padding: 8px 14px; font-size: 0.85rem; }
    .header-bar > div:last-child { width: 100%; justify-content: center; margin-top: 4px; }
    .card { padding: 20px 18px; border-radius: 24px; }
    
    /* 手機版表格調整 */
    #adminPanel table { font-size: 0.75rem; min-width: 800px; }
    #adminPanel th, #adminPanel td { padding: 8px 4px; }
    .search-box { max-width: 100%; width: 100%; margin-top: 10px; }
}
