* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 导航栏 */
.navbar {
    background: white;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.navbar-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.navbar-menu a {
    color: #333;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s;
}

.navbar-menu a:hover {
    background: #667eea;
    color: white;
}

.navbar-menu a.active {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.navbar-user {
    color: #666;
    font-size: 14px;
}

/* 卡片 */
.card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-title {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

/* 按钮 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #667eea;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    background: #f8f9ff;
    border-color: #5568d3;
}

.upload-area.dragover {
    background: #f8f9ff;
    border-color: #5568d3;
}

.upload-icon {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 10px;
}

.upload-text {
    color: #666;
    margin-bottom: 10px;
}

/* 预览图片 */
.preview-container {
    margin-top: 20px;
    text-align: center;
}

.preview-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 发票列表 */
.invoice-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.invoice-item {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    cursor: pointer;
}

.invoice-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.invoice-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 15px;
}

.invoice-image.invoice-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #f8f9ff 0%, #fff 100%);
    border: 1px solid #e5e7eb;
    color: #667eea;
    object-fit: unset;
}

.invoice-info {
    color: #666;
    font-size: 14px;
}

.invoice-info-item {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

/* 识别历史 - 空状态 */
.history-empty {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(180deg, #f8f9ff 0%, #fff 100%);
    border-radius: 12px;
    border: 2px dashed #d0d7de;
}
.history-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.8;
}
.history-empty-text {
    font-size: 18px;
    color: #333;
    margin-bottom: 8px;
}
.history-empty-hint {
    color: #666;
    font-size: 14px;
    margin-bottom: 24px;
}
.history-empty-btn {
    padding: 14px 32px;
    font-size: 16px;
}

/* 发票卡片操作按钮 */
/* 识别历史 - 工具栏 */
.history-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}
.history-total {
    color: #666;
    font-size: 14px;
}

/* 发票卡片 - 复选框 */
.invoice-item {
    position: relative;
}
.invoice-item-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
}
.invoice-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.history-batch-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}
.history-batch-actions .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}
.pagination-btn {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}
.pagination-btn:hover {
    background: #f5f5f5;
    border-color: #667eea;
    color: #667eea;
}
.pagination-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}
.pagination-info {
    color: #666;
    font-size: 14px;
    margin: 0 8px;
}

.invoice-actions {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.btn-sm {
    font-size: 12px;
    padding: 8px 14px;
}

.detail-actions {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.invoice-info-label {
    font-weight: 500;
    color: #333;
}

/* 详情页 */
.detail-container {
    display: block;
}

.detail-image-wrapper {
    text-align: center;
    margin-bottom: 24px;
}

.detail-image {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.detail-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.detail-summary {
    background: #e8f4fd;
    padding: 15px 18px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.detail-summary-title {
    font-weight: 600;
    color: #1f3b57;
    margin-bottom: 4px;
}

.detail-summary-subtitle {
    font-size: 12px;
    color: #666;
}

.detail-summary-link {
    color: #667eea;
    text-decoration: none;
}

.detail-summary-link:hover {
    text-decoration: underline;
}

.btn-copy-all {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-left: 4px;
}
.btn-copy-all:hover {
    background: #5568d3;
}

.detail-summary-divider {
    margin: 0 6px;
    color: #ccc;
}

.detail-group {
    margin-bottom: 20px;
}

.detail-group-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    padding-left: 4px;
    border-left: 3px solid #667eea;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}

.detail-field {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 12px 12px 10px;
    min-height: 72px;
}

.detail-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.detail-field-label {
    color: #333;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.detail-field-value {
    color: #555;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.copy-btn.copy-btn-compact {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.detail-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
}

.detail-value {
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copy-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.copy-btn:hover {
    background: #5568d3;
}

/* 消息提示 */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .navbar-menu {
        flex-direction: column;
        width: 100%;
    }
    
    .navbar-menu a {
        width: 100%;
        text-align: center;
    }
    
    .detail-container {
        grid-template-columns: 1fr;
    }
    
    .invoice-list {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 20px;
    }
}

/* 登录/注册页面 */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
}

.auth-card {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.auth-title {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 28px;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.auth-link a {
    color: #667eea;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* 购买次数 - 套餐卡片 */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}
.pricing-card {
    display: block;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 16px 14px;
    cursor: pointer;
    background: linear-gradient(180deg, #f8f9ff 0%, #fff 100%);
    transition: all 0.2s;
    text-align: center;
    position: relative;
}
.pricing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}
.pricing-card:active {
    transform: translateY(0);
}
.pricing-card.selected {
    border-color: #667eea;
    background: linear-gradient(180deg, #e0e7ff 0%, #f0f4ff 100%);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}
.pricing-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}
.pricing-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
.pricing-card input[type="radio"] {
    margin-bottom: 10px;
}
.pricing-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-top: 8px;
}
.pricing-price {
    margin-top: 8px;
    font-size: 22px;
    font-weight: 800;
    color: #667eea;
}
.pricing-sub {
    margin-top: 6px;
    font-size: 12px;
    color: #666;
}
.pricing-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}
