/* =======================================================================
   文件：site.css
   版本：v1
   ======================================================================= */

/* ===========================
   全局基础样式
=========================== */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
}

.page {
    display: flex;
    flex-direction: column; /* ⭐ 新增 */
    min-height: 100vh;
}

.aligncenter {
    text-align: center;
    width: 100%;
}

/* ===========================
   左侧导航（PC 显示）
=========================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 180px;
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* ⭐ 顶部菜单 + 底部按钮 */

    padding-top: 20px;
    gap: 12px;
    z-index: 999;
}

    .sidebar .nav-link {
        padding: 10px 16px;
        font-size: 15px;
        color: #444;
        text-decoration: none;
        border-radius: 6px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .sidebar .nav-link:hover {
            background: #f0f0f0;
        }

        .sidebar .nav-link.active {
            background: #0d6efd;
            color: white;
            font-weight: bold;
        }

/* 底部设置按钮区域 */
.sidebar-bottom {
    padding: 20px 10px;
    border-top: 1px solid #ddd;
}

    .sidebar-bottom .nav-link {
        padding: 10px 16px;
        font-size: 15px;
        color: #444;
        border-radius: 6px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .sidebar-bottom .nav-link:hover {
            background: #f0f0f0;
        }

        .sidebar-bottom .nav-link.active {
            background: #0d6efd;
            color: white;
            font-weight: bold;
        }

/* ===========================
   底部导航（默认隐藏）
=========================== */
.bottom-nav {
    display: none; /* ⭐ PC 默认隐藏 */
}

/* ===========================
   手机端底部导航（宽度 <= 768px）
=========================== */
@media (max-width: 768px) {

    .bottom-nav {
        display: flex !important; /* ⭐ 手机显示 */
        position: sticky;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 58px;
        background: #ffffff;
        border-top: 1px solid #ddd;
        justify-content: space-around;
        align-items: center;
        z-index: 999;
        padding-bottom: env(safe-area-inset-bottom);
    }

        .bottom-nav .nav-item {
            flex: 1;
            text-align: center;
            font-size: 12px;
            color: #444;
            text-decoration: none;
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

            .bottom-nav .nav-item .bi {
                font-size: 20px;
            }

            .bottom-nav .nav-item.active {
                color: #0d6efd;
                font-weight: bold;
            }
}

.nav-warning {
    padding: 12px;
    margin: 10px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-radius: 6px;
    font-size: 14px;
}

/* ===========================
   内容区域
=========================== */
.main-content {
    margin-left: 180px;
    padding: 20px;
    flex: 1; /* ⭐ 新增 */
    overflow-y: auto; /* ⭐ 新增 */
}

/* ===========================
   手机竖屏（宽度 <= 768px）
=========================== */
@media (max-width: 768px) {

    .sidebar {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 16px;
        padding-bottom: 70px;
        flex: 1; /* ⭐ 新增 */
        overflow-y: auto; /* ⭐ 新增 */
    }
}

/* ===========================
   模态框
=========================== */
input, textarea, select {
    box-sizing: border-box;
}

/* =========================
   Modal 统一样式（全设备兼容）
========================= */

/* 背景遮罩 */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9998;
}

/* ⭐ 弹窗容器（不滚动） */
.modal-box {
    background: #fff;
    width: 520px;
    max-width: 92vw;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    /* ⭐ 安卓平板关键修复：避免 80vh 计算错误 */
    max-height: calc(100vh - 40px);
    overflow: hidden; /* ⭐ 禁止整个弹窗滚动 */
    -webkit-overflow-scrolling: touch;
}

/* header 固定 */
.modal-header {
    padding: 14px 18px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ⭐ body 滚动（唯一滚动区域） */
.modal-body {
    padding: 16px 18px;
    overflow-y: auto !important;
    flex: 1;
    /* ⭐ 安卓平板兼容：避免内容高度撑破 */
    max-height: calc(100vh - 160px);
}

/* footer 固定 */
.modal-footer {
    padding: 12px 18px;
    background: #fff;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

/* ===========================
   统一美化：文本框
=========================== */

input.form-control,
select.form-control,
textarea.form-control,
input[type="text"],
input[type="number"],
input[type="search"],
input[type="password"],
textarea,
select {
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 15px;
    transition: all 0.15s ease;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

    input:focus,
    textarea:focus,
    select:focus {
        border-color: #4da3ff;
        box-shadow: 0 0 0 3px rgba(77,163,255,0.25);
        outline: none;
    }

    input:disabled,
    textarea:disabled,
    select:disabled {
        background: #f5f5f5;
        color: #888;
        cursor: not-allowed;
    }

/* ===========================
   统一美化：按钮（浅色版）
=========================== */

button,
.btn {
    border-radius: 6px !important;
    padding: 8px 14px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    transition: all 0.15s ease !important;
}

.btn-primary {
    background: #4da3ff !important;
    border-color: #4da3ff !important;
    color: white !important;
}

    .btn-primary:hover {
        background: #3394ff !important;
    }

.btn-success {
    background: #5ccf8a !important;
    border-color: #5ccf8a !important;
    color: white !important;
}

    .btn-success:hover {
        background: #45c577 !important;
    }

.btn-danger {
    background: #ff6b6b !important;
    border-color: #ff6b6b !important;
    color: white !important;
}

    .btn-danger:hover {
        background: #ff5252 !important;
    }

.btn-secondary {
    background: #bfc5cc !important;
    border-color: #bfc5cc !important;
    color: #333 !important;
}

    .btn-secondary:hover {
        background: #aeb4bb !important;
    }

.btn-outline-secondary {
    border: 1px solid #cfd6dd !important;
    color: #444 !important;
    background: white !important;
}

    .btn-outline-secondary:hover {
        background: #f5f7f9 !important;
    }

button:disabled,
.btn:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.input-group .form-control {
    border-right: none;
    border-radius: 6px 0 0 6px !important;
}

.input-group .btn {
    border-radius: 0 6px 6px 0 !important;
}

.insert-top {
    border-top: 3px solid #007bff !important;
}

.insert-bottom {
    border-bottom: 3px solid #007bff !important;
}

.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 10px;
    border-top: 1px solid #ddd;
    display: flex;
    gap: 10px;
    justify-content: center;
    z-index: 999;
}

.nav-link.active {
    background: #007bff;
    color: white !important;
    font-weight: bold;
}

.page-header {
    margin-bottom: 10px;
    line-height: 1.3;
    text-align: center;
    width: 100%;
}

.race-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.race-subtitle {
    font-size: 14px;
    color: #666;
    margin-top: 2px;
}

.page-function {
    font-size: 24px;
    font-weight: 700;
    margin-top: 6px;
    color: #000;
}

.input-modern {
    width: 100%;
    padding: 12px 14px !important;
    font-size: 15px;
    border: 1px solid #d0d7de;
    border-radius: 8px !important;
    background: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

    .input-modern:focus {
        border-color: #4da3ff;
        box-shadow: 0 0 0 3px rgba(77,163,255,0.25);
        outline: none;
    }

.input-error {
    border-color: #ff6b6b !important;
    box-shadow: 0 0 0 3px rgba(255,107,107,0.25) !important;
}

.error-icon {
    color: #ff6b6b;
    margin-left: 4px;
}

.error-text {
    font-size: 13px;
    color: #ff6b6b;
    margin-top: 4px;
}

.form-field {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

    .form-field label {
        width: 50px;
        text-align: right;
        margin: 0;
        font-size: 15px;
        font-weight: 600;
        color: #333;
    }

    .form-field .input-modern {
        flex: 1;
        padding: 12px 14px !important;
        border-radius: 8px !important;
    }

    .form-field .error-text {
        margin-left: 102px;
        margin-top: 4px;
    }

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding: 6px 0;
}

.page-size select {
    padding: 4px 8px;
}

.page-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===========================
   ⭐ 自动高度版本（已替换）
=========================== */
.arrival-container {
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-height: none !important; /* ⭐ 高度交给 JS 自动计算 */
}

    .arrival-container::-webkit-scrollbar {
        width: 6px;
    }

    .arrival-container::-webkit-scrollbar-thumb {
        background: #bbb;
        border-radius: 3px;
    }

.row-white {
    background-color: #ffffff !important;
}

.row-blue {
    background-color: #e8f4ff !important; /* ⭐ 浅蓝色 */
}

/* ===========================
   全局 Toast 样式（统一）
=========================== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast-item {
    background: #4da3ff;
    color: white;
    padding: 10px 18px;
    border-radius: 6px;
    margin-top: 10px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .25s ease, transform .25s ease;
    font-size: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

    .toast-item.show {
        opacity: 1;
        transform: translateY(0);
    }

/* ===========================
   Toast Confirm（浅蓝色风格）
=========================== */
#toast-confirm {
    z-index: 999999 !important;
}

.toast-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.toast-confirm-box {
    background: #e6f3ff; /* 浅蓝色背景 */
    border: 2px solid #4da3ff; /* 主色调蓝色边框 */
    padding: 20px;
    border-radius: 10px;
    width: 280px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.toast-confirm-message {
    margin-bottom: 20px;
    font-size: 16px;
    color: #333;
    white-space: pre-line;
}

.toast-confirm-buttons {
    display: flex;
    justify-content: space-between;
}

    .toast-confirm-buttons .btn {
        width: 48%;
        padding: 8px 0;
        border-radius: 6px;
        color: white;
        border: none;
        cursor: pointer;
    }

    /* 确定按钮：绿色 */
    .toast-confirm-buttons .btn-primary {
        background: #28a745 !important;
    }

    /* 取消按钮：红色 */
    .toast-confirm-buttons .btn-secondary {
        background: #dc3545 !important;
    }

.btn-outline-secondary.used {
    background: #e6e6e6 !important;
    border-color: #ccc !important;
    color: #444 !important;
    font-weight: bold;
}

.form-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.form-label {
    width: 110px;
    text-align: right;
    margin-right: 10px;
    font-weight: 500;
}

.form-input {
    flex: 1;
}

.project-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .project-row input {
        flex: 1;
    }

.discard-cell {
    background-color: #BFBFBF !important;
}

.dns-text {
    color: red !important;
}

/* ===========================
   Confirm 弹窗（安全版）
=========================== */

.toast-confirm.hidden {
    display: none;
}

.toast-confirm {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.3);
    z-index: 9998;
}

.toast-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #e6f3ff;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    min-width: 260px;
    text-align: center;
    z-index: 9999;
}

.toast-btns {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

    .toast-btns button {
        padding: 8px 20px;
        border: none;
        border-radius: 6px;
        font-size: 16px;
        color: white;
    }

#toast-yes {
    background: #28a745;
}

#toast-no {
    background: #d9534f;
}

#toast-cancel {
    background: #bfc5cc;
}
/* ===========================
   Toast 提示（蓝底白字）
=========================== */
.toast-message {
    background: #4da3ff; /* 你的系统主色调 */
    color: white;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 15px;
    margin-top: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    opacity: 1;
    transition: opacity .5s ease;
}

    /* 淡出动画 */
    .toast-message.fade-out {
        opacity: 0;
    }

    /* 类型扩展（可选） */
    .toast-message.success {
        background: #28a745;
    }

    .toast-message.error {
        background: #dc3545;
    }

    .toast-message.warning {
        background: #ffc107;
        color: #333;
    }

    .toast-message.info {
        background: #4da3ff;
    }

/* ===========================
   Confirm 弹窗（安全版）
=========================== */

#toast-msg {
    white-space: pre-line;
}
