/* 公共样式 - 移动优先增强版 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Microsoft YaHei', 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #0066cc;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

a:hover {
    text-decoration: underline;
}

button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

ul, li { list-style: none; }

/* 主布局 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.header {
    background-color: #fff;
    border-bottom: 1px solid #e1e1e1;
    padding: 1px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px;
    gap: 10px;
    flex-wrap: wrap;
}

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

.right-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.right-btns a {
    padding: 6px 12px;
    background: #0066cc;
    color: #fff;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.2;
}

/* 导航 */
.nav {
    display: flex;
    padding: 2px 0;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    flex-wrap: wrap;
}

.nav a {
    padding: 10px 12px;
    color: #333;
    text-align: center;
    transition: all 0.3s;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav a:hover, .nav a.active {
    background: #0066cc;
    color: #fff;
    text-decoration: none;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    margin: 1px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    gap: 8px;
}

.search-item {
    margin: 0;
    flex: 0 1 auto;
}

.search-item select,
.search-item input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 100px;
    height: 42px;
    font-size: 16px;
    background: #fff;
    -webkit-appearance: none;
}

.search-btns {
    margin-left: auto;
    display: flex;
    align-items: center;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    min-height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #0066cc;
    color: #fff;
    font-size: 14px;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    font-family: inherit;
}

.btn-primary { background: #0066cc; }
.btn-success { background: #28a745; }
.btn-danger  { background: #dc3545; }
.btn-warning { background: #ffc107; color: #333; }
.btn-default { background: #e9ecef; color: #333; }
.btn-cancel  { background: #e9ecef; color: #333; }
.btn:hover { opacity: 0.9; }

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 13px;
}

.table th,
.table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #e1e1e1;
    vertical-align: middle;
}

.table th {
    background: #f5f5f5;
    font-weight: bold;
    white-space: nowrap;
}

.table tr:hover { background: #f9f9f9; }

/* 表单 */
.form-group { margin-bottom: 15px; }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    font-size: 13.5px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background: #fff;
    min-height: 42px;
    font-family: inherit;
}

.form-control:focus {
    border-color: #0066cc;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.12);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px 0;
    flex-wrap: wrap;
    gap: 6px;
}

.pagination a, .pagination span {
    padding: 8px 12px;
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
}

.pagination a:hover {
    background: #f5f5f5;
    text-decoration: none;
}

.pagination .page-select {
    height: 40px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.pagination span.disabled {
    color: #aaa;
    cursor: not-allowed;
}

/* 卡片（仅后台图片管理沿用） */
.card-list {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.card {
    width: calc(33.333% - 20px);
    margin: 10px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s;
}

.card:hover {
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.card-img { height: 160px; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 10px; }
.card-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-text {
    margin-bottom: 10px;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-footer {
    padding: 10px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

/* 遮罩层 */
.mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.modal {
    position: relative;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.modal-title {
    font-size: 16px;
    font-weight: bold;
    padding-right: 30px;
}

.modal-close {
    position: absolute;
    right: 14px;
    top: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    border-radius: 50%;
    line-height: 1;
    color: #666;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover { background: #f2f2f2; }

.modal-body {
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* 吐司 */
.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(0,0,0,0.78);
    color: #fff;
    border-radius: 6px;
    z-index: 1000;
    font-size: 14px;
    max-width: 90vw;
    text-align: center;
    animation: fadeIn 0.3s, fadeOut 0.3s 2.7s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* 底部 */
.footer {
    padding: 8px 12px;
    border-top: 1px solid #e1e1e1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: #fff;
    margin-top: 12px;
    font-size: 12.5px;
    color: #666;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}

/* 响应式 */
@media (max-width: 768px) {
    .container { padding: 0 12px; }

    .card { width: calc(50% - 20px); }

    .search-bar { flex-direction: column; align-items: stretch; }
    .search-item { width: 100%; }
    .search-item select,
    .search-item input { width: 100%; }
    .search-btns { margin-left: 0; }
    .search-btns .btn { width: 100%; }

    .top-bar { flex-direction: column; align-items: flex-start; }
    .right-btns { width: 100%; }

    /* 移动端表格：整表横滚，避免被 body overflow-x:hidden 裁切 */
    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .table tr { display: table-row; }
    .table th, .table td { display: table-cell; }
}

@media (max-width: 480px) {
    .card { width: 100%; }
    .nav a { flex: 1 1 33.333%; font-size: 13px; }
    .modal { max-height: 92vh; }
    .modal-body { max-height: calc(92vh - 120px); }
}