* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: #faf8f5;
    background-image: linear-gradient(135deg, #ffffff 0%, #faf8f5 100%);
    min-height: 100vh;
    padding: 20px;
}

/* 移动端导航栏切换脚本需要的样式 */
.mobile-menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 24px;
        color: #6d4c41;
        cursor: pointer;
        z-index: 100;
        padding: 5px;
    }
    
    .main-nav {
        position: relative;
    }
    
    /* 默认在移动端隐藏下拉菜单 */
    .nav-dropdown .dropdown-menu {
        display: none;
    }
    
    /* 点击后显示 */
    .nav-dropdown.mobile-active .dropdown-menu {
        display: block;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(109, 76, 65, 0.08);
    overflow: hidden;
    border: 1px solid #e8ddd4;
}

header {
    background: linear-gradient(135deg, #a1887f 0%, #8d6e63 100%);
    color: #fff;
    padding: 35px;
    text-align: center;
    border-bottom: 3px solid #8d6e63;
    box-shadow: 0 2px 10px rgba(109, 76, 65, 0.15);
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

.main-nav {
    display: flex;
    background: #f5f0e8;
    border-bottom: 2px solid #e8ddd4;
    align-items: center;
    position: relative;
}

.nav-item {
    padding: 15px 30px;
    text-decoration: none;
    color: #6d4c41;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    position: relative;
    cursor: pointer;
}

.nav-item:hover {
    background: #ede7df;
    color: #8d6e63;
}

.nav-item.active {
    background: #fff;
    color: #8d6e63;
    border-bottom-color: #a1887f;
}

.nav-dropdown > span {
    display: block;
    padding: 15px 30px;
    color: #6d4c41;
    font-weight: 500;
}

.nav-dropdown:hover > span {
    background: #ede7df;
    color: #8d6e63;
}

/* 下拉菜单样式 */
.nav-dropdown {
    position: relative;
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(109, 76, 65, 0.15);
    border-radius: 6px;
    border: 1px solid #e8ddd4;
    z-index: 1000;
    margin-top: 2px;
    padding: 5px 0;
}

.dropdown-menu a {
    display: block;
    padding: 12px 25px;
    color: #5d4037;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.dropdown-menu a:hover {
    background: #f5f0e8;
    color: #8d6e63;
    border-left-color: #a1887f;
}

.dropdown-menu a.active {
    background: #f5f0e8;
    color: #8d6e63;
    border-left-color: #a1887f;
    font-weight: 600;
}

main {
    padding: 30px;
    background: #ffffff;
    color: #5d4037;
}

.welcome {
    text-align: center;
    padding: 40px;
}

.welcome h2 {
    color: #5d4037;
    margin-bottom: 20px;
    font-size: 24px;
}

.welcome ul {
    text-align: left;
    display: inline-block;
    margin-top: 20px;
}

.welcome li {
    margin: 10px 0;
    padding: 10px;
    background: #f5f0e8;
    border-radius: 5px;
    color: #5d4037;
    border-left: 3px solid #a1887f;
}

/* 表格样式 */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(109, 76, 65, 0.06);
    border: 1px solid #e8ddd4;
    border-radius: 6px;
    overflow: hidden;
}

table th {
    background: linear-gradient(135deg, #bca085 0%, #a1887f 100%);
    color: #fff;
    padding: 16px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    border-bottom: 2px solid #8d6e63;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e8ddd4;
    color: #5d4037;
}

table tr:hover {
    background: #faf8f5;
    transition: background 0.2s;
}

table tr:last-child td {
    border-bottom: none;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #a1887f 0%, #8d6e63 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(141, 110, 99, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #8d6e63 0%, #6d4c41 100%);
    box-shadow: 0 4px 12px rgba(141, 110, 99, 0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #66bb6a 0%, #4caf50 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #d4a574 0%, #bc8f5f 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(188, 143, 95, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #bc8f5f 0%, #a67c52 100%);
    box-shadow: 0 4px 12px rgba(188, 143, 95, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, #bca085 0%, #a1887f 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(161, 136, 127, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #a1887f 0%, #8d6e63 100%);
    box-shadow: 0 4px 12px rgba(161, 136, 127, 0.4);
    transform: translateY(-1px);
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #5d4037;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #d7ccc8;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #5d4037;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: #a1887f;
    box-shadow: 0 0 0 3px rgba(141, 110, 99, 0.2);
    background: #fffbf7;
}


.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* 权限复选框样式 */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.permission-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f5f0e8;
    border-radius: 5px;
    border: 2px solid #e8ddd4;
    transition: all 0.3s;
}

.permission-item:hover {
    border-color: #a1887f;
    background: #ede7df;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(161, 136, 127, 0.15);
}

.permission-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
}

.permission-item label {
    cursor: pointer;
    flex: 1;
    margin: 0;
    font-weight: normal;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid #d7ccc8;
    border-radius: 5px;
    text-decoration: none;
    color: #5d4037;
    background: #f5f0e8;
}

.pagination a:hover {
    background: linear-gradient(135deg, #a1887f 0%, #8d6e63 100%);
    color: white;
    border-color: #8d6e63;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(141, 110, 99, 0.3);
}

.pagination .current {
    background: linear-gradient(135deg, #a1887f 0%, #8d6e63 100%);
    color: white;
    border-color: #8d6e63;
    box-shadow: 0 2px 6px rgba(141, 110, 99, 0.3);
}

/* 搜索框 */
.search-box {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #d7ccc8;
    border-radius: 5px;
    background: #fff;
    color: #5d4037;
}

.search-box input:focus {
    outline: none;
    border-color: #a1887f;
    box-shadow: 0 0 0 3px rgba(141, 110, 99, 0.2);
    background: #fffbf7;
}

/* 消息提示 */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
    border-right: 1px solid #c8e6c9;
    border-top: 1px solid #c8e6c9;
    border-bottom: 1px solid #c8e6c9;
}

.alert-error {
    background: #fff3e0;
    color: #e65100;
    border-left: 4px solid #ff9800;
    border-right: 1px solid #ffe0b2;
    border-top: 1px solid #ffe0b2;
    border-bottom: 1px solid #ffe0b2;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 模态框样式 */
.modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: block !important;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(109, 76, 65, 0.3);
    z-index: 10001;
    cursor: pointer;
}

.modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(109, 76, 65, 0.2);
    width: 90%;
    max-width: 1400px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10002;
    cursor: default;
    pointer-events: auto;
    border: 1px solid #e8ddd4;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.modal-header {
    padding: 22px;
    border-bottom: 2px solid #8d6e63;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #bca085 0%, #a1887f 100%);
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(109, 76, 65, 0.1);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-header button {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: white;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    transition: all 0.3s;
}

.modal-header button:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e8ddd4;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f5f0e8;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* 响应式设计 - 移动端适配 */
@media (max-width: 768px) {
    /* 基础布局 */
    body {
        padding: 10px;
    }
    
    .container {
        border-radius: 8px;
    }
    
    /* 头部 */
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 20px;
    }
    
    /* 导航栏 - 移动端改为垂直布局 */
    .main-nav {
        flex-direction: column;
        align-items: stretch;
    }
    
    .nav-item {
        padding: 12px 15px;
        border-bottom: 1px solid #e8ddd4;
        text-align: left;
    }
    
    .nav-dropdown > span {
        padding: 12px 15px;
        cursor: pointer;
        position: relative;
    }
    
    .nav-dropdown > span::after {
        content: ' ▼';
        float: right;
        font-size: 12px;
    }
    
    .nav-dropdown.active > span::after {
        content: ' ▲';
    }
    
    /* 下拉菜单在移动端改为全宽显示 */
    .dropdown-menu {
        position: static;
        display: none;
        width: 100%;
        box-shadow: none;
        border: none;
        border-top: 1px solid #e8ddd4;
        border-radius: 0;
        margin-top: 0;
        background: #f5f0e8;
    }
    
    .nav-dropdown.active .dropdown-menu {
        display: block;
    }
    
    .dropdown-menu a {
        padding: 12px 30px;
        border-left: none;
        border-bottom: 1px solid #e8ddd4;
    }
    
    /* 用户信息区域 */
    .main-nav > div:last-child {
        margin-left: 0 !important;
        padding: 12px 15px !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
        border-top: 1px solid #e8ddd4;
    }
    
    .main-nav > div:last-child span {
        margin-right: 0 !important;
        margin-bottom: 5px;
        display: block;
        width: 100%;
    }
    
    /* 主内容区 */
    main {
        padding: 15px;
    }
    
    main h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    /* 表格 - 移动端横向滚动 */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 15px -15px;
        padding: 0 15px;
    }
    
    table {
        font-size: 12px;
        min-width: 600px;
    }
    
    table th,
    table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    table th {
        font-size: 11px;
        padding: 10px 6px;
    }
    
    /* 表单 */
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .permissions-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* 防止iOS自动缩放 */
    }
    
    /* 搜索框 */
    .search-box {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box form {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-box input {
        width: 100%;
    }
    
    /* 按钮 */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
        width: 100%;
        text-align: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    /* 分页 */
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .pagination a,
    .pagination span {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    /* 模态框 */
    .modal-content {
        width: 95%;
        max-width: 95%;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 15px;
        max-height: calc(95vh - 120px);
    }
    
    .modal-footer {
        padding: 15px;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* 欢迎页面 */
    .welcome {
        padding: 20px 15px;
    }
    
    .welcome h2 {
        font-size: 20px;
    }
    
    .welcome ul {
        width: 100%;
    }
    
    /* 消息提示 */
    .alert {
        padding: 12px;
        font-size: 14px;
    }
    
    /* 统计信息框 */
    div[style*="background: #f5f0e8"],
    div[style*="background: #fff3e0"],
    div[style*="background: #e3f2fd"] {
        padding: 10px !important;
        font-size: 13px !important;
    }
    
    /* 标签页导航 */
    div[style*="display: flex"][style*="gap: 5px"] {
        flex-wrap: wrap;
    }
    
    /* 表单操作区域 */
    .form-actions {
        flex-direction: column;
        gap: 15px;
        align-items: stretch !important;
    }
    
    .form-actions .info {
        text-align: center;
        font-size: 13px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* 输入框组 */
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group input[type="number"],
    .faction-input,
    .coord-input,
    .ticket-input {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* 装备卷单元格 */
    .ticket-cell {
        padding: 8px 4px !important;
    }
    
    .ticket-cell label {
        font-size: 10px !important;
        margin-bottom: 3px;
    }
    
    /* 坐标输入组 */
    .coord-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* 清空坐标区域 */
    .clear-coords-section {
        padding: 12px;
    }
    
    .clear-coords-section h3 {
        font-size: 16px;
    }
    
    .clear-coords-section form > div {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* 标签页导航 */
    div[style*="border-bottom: 2px"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    div[style*="border-bottom: 2px"] > div {
        min-width: max-content;
    }
    
    /* 统计信息网格 */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* 小屏幕手机 (最大宽度480px) */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    header {
        padding: 15px 10px;
    }
    
    header h1 {
        font-size: 18px;
    }
    
    main {
        padding: 10px;
    }
    
    main h2 {
        font-size: 18px;
    }
    
    table {
        font-size: 11px;
        min-width: 500px;
    }
    
    table th,
    table td {
        padding: 6px 4px;
    }
    
    .btn {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .modal-content {
        width: 98%;
        max-width: 98%;
    }
    
    .nav-item {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .dropdown-menu a {
        padding: 10px 20px;
        font-size: 13px;
    }
}
