/* 报关端样式 - 深空灰蓝主题 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #F5F7FA;
    min-height: 100vh;
    transition: all 0.3s ease;
    margin: 0;
    padding: 0;
}

/* 报关端主题规范 */
:root {
    --theme-primary: #0F2942;
    --theme-secondary: #0F2942;
    --theme-accent: #0F2942;
    --theme-neutral-bg: #F5F7FA;
    --theme-neutral-white: #FFFFFF;
    --theme-neutral-dark: #0A1626;
    --theme-neutral-gray: #86909C;
    --theme-emphasis: #165DFF;
    --theme-success: #00B42A;
    --theme-warning: #FF7D00;
    --theme-error: #ff4d4f;
}

/* Header */
.header {
    background-color: var(--theme-primary);
    color: white;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-title {
    font-size: 18px;
    width: 160px;
    text-align: center;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 1001;
}

.header-icon {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* 顶部用户信息：姓名 + 企业名称（所有页面统一） */
.header-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.header-company {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 2px;
    white-space: nowrap;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 统一头像/文本/箭头顺序：头像在左，文本居中，箭头在右（避免个别页面 DOM 顺序不同导致位置错乱） */
.header-user .header-avatar {
    order: 1;
    flex: 0 0 auto;
}

.header-user .header-user-info {
    order: 2;
}

.header-user #userMenuArrow {
    order: 3;
}

.header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* 主题切换器 */
.theme-switcher {
    position: relative;
    cursor: pointer;
}

.theme-palette {
    position: absolute;
    top: 50px;
    right: 0;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 120px;
    display: none;
    z-index: 1000;
    padding: 8px;
}

.theme-palette.active {
    display: block;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.3s;
}

.theme-option:hover {
    background-color: #f5f5f5;
}

.theme-color {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    border: 1px solid #ddd;
}

.theme-name {
    font-size: 12px;
    color: #333;
}

/* 用户抽屉菜单 */
.user-drawer {
    position: absolute;
    top: 70px;
    right: 20px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 160px;
    display: none;
    z-index: 1000;
}

.user-drawer.active {
    display: block;
}

.drawer-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
}

.drawer-item:hover {
    background-color: #f5f5f5;
}

.drawer-item i {
    width: 16px;
    text-align: center;
}

/* Layout */
.layout {
    display: flex;
    padding-top: 70px;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 160px;
    background-color: var(--theme-primary);
    color: white;
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    overflow-y: auto;
    /* 避免子菜单展开/收起时滚动条出现导致菜单宽度抖动 */
    scrollbar-gutter: stable;
    z-index: 999;
}

.menu-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.menu-item.active {
    background-color: rgba(255, 255, 255, 0.15);
}

.menu-item i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.sidebar .menu-item .submenu-arrow {
    width: 16px !important;
    min-width: 16px !important;
    margin-left: auto !important;
    color: rgba(255, 255, 255, 0.7) !important;
    transition: transform 0.3s ease;
    font-size: 14px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    text-align: center;
    font-family: FontAwesome !important;
}

/* Submenu */
.submenu {
    display: none;
    background-color: rgba(0, 0, 0, 0.1);
}

.submenu-item {
    padding: 10px 15px 10px 32px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.submenu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.submenu-item.active {
    background-color: rgba(255, 255, 255, 0.15);
}

.submenu-item i {
    width: 14px;
    text-align: center;
    font-size: 13px;
}

/* Content */
.content {
    flex: 1;
    margin-left: 160px;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* 防止页面整体横向滚动 */
}

/* Tabs */
.tabs-container {
    background-color: white;
    /* 去掉标签页下划线效果 */
    border-bottom: none;
    display: flex;
    align-items: center;
    padding: 0 10px;
    height: 40px;
    overflow-x: auto;
}

.tabs-wrapper {
    display: flex;
    flex: 1;
    gap: 2px;
}

.tab-item {
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid #e8e8e8;
    border-bottom: none;
    background-color: #fafafa;
    color: #666;
    text-decoration: none; /* 去掉 a 标签默认下划线（如“报关单管理”标签） */
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;
    top: 1px;
}

.tab-item:hover {
    background-color: #f0f0f0;
}

.tab-item.active {
    background-color: white;
    color: var(--theme-primary);
    border-bottom: 1px solid white;
    font-weight: 500;
}

.tab-close {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 10px;
}

.tab-close:hover {
    background-color: #ff4d4f;
    color: white;
}

.tab-home {
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid #e8e8e8;
    border-bottom: none;
    background-color: #fafafa;
    color: #666;
    text-decoration: none; /* 去掉 a 标签默认下划线 */
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;
    top: 1px;
}

.tab-home.active {
    background-color: var(--theme-neutral-bg);
    color: var(--theme-primary);
    border-bottom: 1px solid var(--theme-neutral-bg);
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: var(--theme-neutral-bg);
    overflow-x: hidden; /* 仅表格容器横向滚动 */
}

.content-header {
    background-color: var(--theme-neutral-white);
    padding: 20px;
    border-radius: 2px;
    margin-bottom: 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.content-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--theme-neutral-dark);
    margin-bottom: 10px;
}

.content-subtitle {
    font-size: 14px;
    color: var(--theme-neutral-gray);
}

/* Cards */
.card {
    background-color: var(--theme-neutral-white);
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    padding: 15px;
    margin-bottom: 15px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.card-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--theme-neutral-dark);
}

/* Buttons */
.btn {
    padding: 6px 16px;
    border-radius: 2px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* 表格操作列（全局统一） */
.action-links {
    display: flex;
    gap: 12px;
    white-space: nowrap;
}

.action-link {
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: #666;
}

.action-link:hover {
    text-decoration: none;
    opacity: 0.85;
}

.action-link.edit {
    color: var(--theme-primary);
}

.action-link.delete,
.action-link.disable {
    color: var(--theme-error);
}

.action-link.enable {
    color: var(--theme-primary);
}

.action-link.sync {
    color: var(--theme-primary);
}

.btn-primary {
    background-color: var(--theme-primary);
    color: white;
}

.btn-primary:hover {
    background-color: #0a2239;
}

.btn-success {
    background-color: var(--theme-success);
    color: white;
}

.btn-success:hover {
    background-color: #009a23;
}

.btn-danger {
    background-color: var(--theme-error);
    color: white;
}

.btn-danger:hover {
    background-color: #d9363e;
}

.btn-default {
    background-color: white;
    color: #666;
    border: 1px solid #d9d9d9;
}

.btn-default:hover {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

/* Search Form */
.search-form {
    padding: 15px 20px;
    background-color: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-label {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

.search-input {
    padding: 5px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    font-size: 13px;
    width: 150px;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--theme-primary);
}

.search-select {
    padding: 5px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    font-size: 13px;
    width: 150px;
    background-color: white;
    cursor: pointer;
}

.search-select:focus {
    outline: none;
    border-color: var(--theme-primary);
}

/* 下拉菜单默认选项灰色 */
.search-select {
    color: #999;
}

.search-select option:not([value=""]) {
    color: #333;
}

.search-select:focus {
    color: #333;
}

.search-select:focus option[value=""] {
    color: #999;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: normal;
    color: var(--theme-neutral-dark);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--theme-emphasis);
    box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1);
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    cursor: pointer;
}

/* 输入框提示语颜色 */
::placeholder {
    color: #9CA3AF;
    opacity: 1;
}

/* 下拉菜单默认选项颜色 */
.search-select,
.form-select {
    color: #9CA3AF;
}

.search-select option:not([value=""]):not(:disabled),
.form-select option:not([value=""]):not(:disabled) {
    color: var(--theme-neutral-dark);
}

.search-select:focus,
.form-select:focus {
    color: var(--theme-neutral-dark);
}

.search-select:focus option[value=""],
.form-select:focus option[value=""] {
    color: #9CA3AF;
}

/* Tables */
.table-container {
    padding: 0 20px 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    max-width: 100%;
    overscroll-behavior-x: contain; /* 防止横向滚动传递到页面/父容器 */
}

.table {
    width: max-content;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 100%;
}

.table th {
    background-color: #fafafa;
    padding: 12px;
    text-align: left;
    font-weight: 500;
    color: var(--theme-neutral-dark);
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    color: var(--theme-neutral-gray);
    white-space: nowrap;
}

.table tr:hover {
    background-color: #fafafa;
}

/* Pagination */
.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 0 20px 20px;
}

.pagination-info {
    font-size: 13px;
    color: #666;
}

.pagination-buttons {
    display: flex;
    gap: 5px;
}

.pagination-buttons .btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background-color: var(--theme-neutral-white);
    border-radius: 4px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

/* 全局：弹窗内字体不加粗（覆盖部分页面内联样式） */
.modal,
.modal * {
    font-weight: 400 !important;
}

.modal.ai-recognition-modal {
    max-width: 1045px;
    width: 1045px;
    max-height: 85.5vh;
    height: 85.5vh;
}

.modal-header {
    /* 全局弹窗标题区：降低高度，减少竖向占比 */
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 15px;
    color: var(--theme-neutral-dark);
}

.modal-close {
    font-size: 18px;
    color: var(--theme-neutral-gray);
    cursor: pointer;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

/* Toast */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-size: 14px;
    z-index: 3000;
    display: none;
    animation: slideIn 0.3s ease;
}

.toast.active {
    display: block;
}

.toast.success {
    background-color: var(--theme-success);
}

.toast.error {
    background-color: var(--theme-error);
}

.toast.warning {
    background-color: var(--theme-warning);
}

.toast.info {
    background-color: var(--theme-emphasis);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 15px;
    width: 100%;
}

.stat-card {
    background-color: var(--theme-neutral-white);
    padding: 20px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.stat-card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.stat-title {
    font-size: 13px;
    color: #666;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.stat-icon.blue {
    background-color: #e6f7ff;
    color: #1890ff;
}

.stat-icon.green {
    background-color: #f6ffed;
    color: #52c41a;
}

.stat-icon.orange {
    background-color: #fff7e6;
    color: #fa8c16;
}

.stat-icon.red {
    background-color: #fff1f0;
    color: #ff4d4f;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.stat-change {
    font-size: 12px;
    color: #999;
}

.stat-change.up {
    color: #52c41a;
}

.stat-change.down {
    color: #ff4d4f;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.chart-card {
    background-color: var(--theme-neutral-white);
    padding: 20px;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    height: 320px;
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--theme-primary);
    margin-bottom: 16px;
}

.chart-container {
    width: 100%;
    height: 260px;
}

/* Utility Classes */
.text-primary {
    color: var(--theme-primary);
}

.text-emphasis {
    color: var(--theme-emphasis);
}

.text-success {
    color: var(--theme-success);
}

.text-warning {
    color: var(--theme-warning);
}

.text-error {
    color: var(--theme-error);
}

.text-danger {
    color: var(--theme-error);
}

.bg-primary {
    background-color: var(--theme-primary);
}

.bg-emphasis {
    background-color: var(--theme-emphasis);
}

.bg-success {
    background-color: var(--theme-success);
}

.bg-warning {
    background-color: var(--theme-warning);
}

.bg-error {
    background-color: var(--theme-error);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar .menu-item span {
        display: none;
    }
    
    .sidebar .menu-item i {
        margin-right: 0;
        font-size: 18px;
    }
    
    .content {
        margin-left: 60px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal {
        width: 95%;
    }
}

/* 商品信息表格输入框样式 */
.goods-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    font-size: 12px;
    background: #fff;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
}

.goods-input:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.goods-input::placeholder {
    color: #bbb;
}

.goods-code-input:hover,
.goods-name-input:hover,
.goods-spec-input:hover {
    border-color: #1890ff;
    cursor: pointer;
}
