/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
}

/* 标题样式 */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 36px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 14px;
    opacity: 0.9;
}

/* 卡片样式 */
.toolbar-card,
.table-card,
.storage-status-bar {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

/* 数据存储状态栏 */
.storage-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
}

.storage-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.storage-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

/* 工具栏样式 */
.toolbar-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.toolbar-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 表格样式 */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

tbody tr:hover {
    background: #f5f5f5;
}

tbody tr.editing {
    background: #fff3cd;
}

/* 可编辑单元格 */
.editable {
    cursor: pointer;
    position: relative;
}

.editable:hover {
    background: #e9ecef;
}

.editable.editing {
    padding: 0;
}

.editable input {
    width: 100%;
    padding: 12px;
    border: 2px solid #667eea;
    font-size: 13px;
    font-family: inherit;
}

.editable input:focus {
    outline: none;
}

/* 确认按钮 */
.confirm-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #28a745;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 16px;
    z-index: 5;
}

.confirm-btn:hover {
    background: #218838;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-hint {
    font-size: 12px;
    color: #ccc;
    margin-top: 10px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.3);
}

.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.modal-header h2 {
    color: #333;
    font-size: 24px;
}

.close-btn {
    font-size: 32px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: all 0.3s;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    margin-bottom: 20px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* 列表容器 */
.list-container {
    max-height: 400px;
    overflow-y: auto;
}

.list-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 5px;
    color: #333;
}

.list-item-detail {
    font-size: 12px;
    color: #666;
}

.list-item-actions {
    display: flex;
    gap: 10px;
}

/* 信息文本 */
.info-text {
    background: #e7f3ff;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #667eea;
    margin-bottom: 20px;
    font-size: 14px;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 30px;
    background: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.progress-log {
    max-height: 300px;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    line-height: 1.8;
}

.progress-log-item {
    margin-bottom: 5px;
}

.progress-log-success {
    color: #28a745;
}

.progress-log-error {
    color: #dc3545;
}

.progress-log-info {
    color: #17a2b8;
}

/* 复选框样式 */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 别名标签 */
.alias-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #667eea;
    color: white;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .toolbar-card {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-section {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 28px;
    }

    .modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 20px;
    }

    table {
        font-size: 11px;
    }

    th, td {
        padding: 8px;
    }

    .btn {
        padding: 8px 15px;
        font-size: 12px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 统计表格样式 */
.stats-container {
    margin-bottom: 12px;
}

.stats-card-vertical {
    background: white;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stats-table-vertical {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stats-table-vertical td {
    padding: 4px 8px;
    border: 1px solid #ddd;
}

.stats-table-vertical .stat-label {
    background: #f0f0f0;
    color: #333;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
}

.stats-table-vertical .stat-value {
    text-align: center;
    font-weight: bold;
    font-size: 13px;
    color: #000;
    background: #fff;
}

.stats-table-vertical .stat-input {
    width: 70px;
    padding: 2px 4px;
    border: 2px solid #667eea;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s;
    box-sizing: border-box;
}

.stats-table-vertical .stat-input:focus {
    outline: none;
    border-color: #764ba2;
    background: #f0f8ff;
}

.stats-table-vertical .stat-input::placeholder {
    color: #bbb;
}

/* 删除线样式（软删除标记） */
.deleted-row {
    text-decoration: line-through;
    color: #dc3545 !important;
    opacity: 0.6;
}

.deleted-row td {
    text-decoration: line-through;
    color: #dc3545 !important;
}

/* 延迟到账样式（黄色背景高亮） */
.late-arrival-row {
    background-color: #fff3cd !important;
}

.late-arrival-row:hover {
    background-color: #ffe69c !important;
}

/* AFF 同步警告样式 */
.aff-sync-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 15px;
    animation: alertPulse 2s infinite;
}

@keyframes alertPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 193, 7, 0); }
}

.aff-sync-alert .alert-icon {
    font-size: 20px;
}

.aff-sync-alert .alert-text {
    font-weight: bold;
    color: #856404;
}

.aff-sync-alert a {
    color: #0056b3;
    font-weight: bold;
    text-decoration: underline;
}

.aff-sync-alert a:hover {
    color: #003d82;
}

/* AFF 同步模态框样式 */
.sync-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.sync-loading p {
    font-size: 16px;
}

.sync-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.sync-summary p {
    margin: 5px 0;
    font-size: 14px;
}

.sync-section {
    margin-bottom: 25px;
}

.sync-section h3 {
    color: #333;
    font-size: 16px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
}

.sync-hint {
    color: #666;
    font-size: 12px;
    margin-bottom: 10px;
    font-style: italic;
}

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

.sync-table th,
.sync-table td {
    padding: 10px 12px;
    border: 1px solid #ddd;
    text-align: left;
}

.sync-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
}

.sync-table tr:nth-child(even) {
    background: #f8f9fa;
}

.sync-table tr:hover {
    background: #e9ecef;
}

.sync-table .address-cell {
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.sync-success {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    background: #d4edda;
    border-radius: 8px;
    color: #155724;
    font-size: 18px;
    font-weight: bold;
}

.sync-success .success-icon {
    font-size: 24px;
}

/* 警告按钮样式 */
.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #333;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ffca2c 0%, #ffb300 100%);
    transform: translateY(-2px);
}

/* 同步操作区域 */
.sync-actions {
    margin-top: 20px;
    padding: 15px;
    background: #e7f3ff;
    border-radius: 8px;
    text-align: center;
}

.sync-actions .btn {
    margin-bottom: 10px;
}

.sync-actions .sync-hint {
    margin: 0;
    color: #0056b3;
}

/* 同步表格选中行高亮 */
.sync-table input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.sync-table tr:has(input:checked) {
    background: #cce5ff !important;
}

.sync-table tr:has(input:checked) td {
    font-weight: bold;
}

/* 表格筛选器样式 */
.filter-row th {
    background: #f8f9fa;
    padding: 5px;
}

.filter-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    box-sizing: border-box;
}

.filter-input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 3px rgba(102, 126, 234, 0.3);
}

.filter-input::placeholder {
    color: #aaa;
}
