/* 基础样式 */
body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	background: linear-gradient(to bottom right, #f9fafb, #f3f4f6);
}

/* 动画效果 */
.slide-in {
	animation: slideIn 0.3s ease-out forwards;
}

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

.fade-in {
	animation: fadeIn 0.3s ease-out forwards;
}

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

/* 拖拽样式 */
.account-item.dragging {
	opacity: 0.5;
	background-color: #dbeafe;
}

[draggable] {
	cursor: move;
}

.dragging {
	opacity: 0.5;
	background-color: #dbeafe;
}

/* 导航按钮 */
.nav-button {
	padding: 0.5rem 0.75rem;
	border-radius: 0.375rem;
	transition: all 0.2s;
	text-decoration: none;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* 小屏模式下隐藏按钮文本，只显示图标 */
@media (max-width: 768px) {
	.nav-button span {
		display: none;
	}
	
	.nav-button i {
		margin-right: 0 !important;
	}
}

.nav-button:not(.active) {
	background-color: #e5e7eb;
	color: #374151;
}

.nav-button:not(.active):hover {
	background-color: #d1d5db;
}

.nav-button.active {
	background-color: #3b82f6;
	color: white;
}

/* 页面卡片 */
.page-card {
	background-color: white;
	border-radius: 0.5rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
	padding: 1.5rem;
	margin-bottom: 1.5rem;
}

.page-card:last-child {
	margin-bottom: 0;
}

/* 账户列表项 */
.account-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem;
	border: 1px solid #e5e7eb;
	border-radius: 0.375rem;
	margin-bottom: 0.75rem;
	background-color: #f9fafb;
	transition: all 0.2s;
}

.account-item:hover {
	background-color: #f3f4f6;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.account-item:last-child {
	margin-bottom: 0;
}

.account-name {
	font-weight: 500;
	color: #1f2937;
}

.amount-input {
	width: 8rem;
	padding: 0.25rem 0.5rem;
	border: 1px solid #d1d5db;
	border-radius: 0.25rem;
	text-align: right;
	transition: all 0.2s;
	height: 2.5rem; /* 与备注框高度一致 */
}

/* 小屏模式下减小宽度 */
@media (max-width: 767px) {
	.amount-input {
		width: 6rem !important;
	}
}

.amount-input:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.note-input {
	width: 16rem; /* 加长一倍 */
	padding: 0.25rem 0.5rem;
	border: 1px solid #d1d5db;
	border-radius: 0.25rem;
	font-size: 0.875rem;
	transition: all 0.2s;
	height: 2.5rem; /* 与金额框高度一致 */
}

/* 小屏模式下减小宽度 */
@media (max-width: 767px) {
	.note-input {
		width: 6rem !important;
	}
}

.unit-label {
	margin-left: 0.5rem;
	color: #6b7280;
}

/* 总计区域 */
.total-section {
	border-top: 1px solid #e5e7eb;
	padding-top: 1rem;
	margin-top: 1rem;
}

.total-label {
	font-weight: 500;
	color: #1f2937;
}

.total-amount {
	font-size: 1.5rem;
	font-weight: bold;
	color: #3b82f6;
	min-width: 6rem;
	text-align: right;
}

#totalAmount {
	padding-right: 0.25rem; /* 在金额右边添加小间距 */
}

/* 小屏模式下总计金额靠右对齐 */
@media (max-width: 767px) {
	.total-amount {
		text-align: right !important;
	}
}

/* 图表容器 */
.chart-container {
	background-color: #f9fafb;
	padding: 1rem;
	border-radius: 0.375rem;
}

.chart-wrapper {
	position: relative;
	height: 300px;
	max-height: 300px;
}

/* 响应式图表高度 */
@media (max-width: 768px) {
	.chart-wrapper {
		height: 250px;
		max-height: 250px;
	}
}

/* 设置页面 */
.setting-section {
	margin-bottom: 1.5rem;
}

.setting-section:last-child {
	margin-bottom: 0;
}

.setting-title {
	font-size: 1.125rem;
	font-weight: 500;
	margin-bottom: 1rem;
	color: #1f2937;
}

.setting-option {
	display: flex;
	align-items: center;
	margin-bottom: 0.5rem;
}

.setting-option:last-child {
	margin-bottom: 0;
}

.setting-checkbox {
	border-radius: 0.25rem;
	color: #3b82f6;
}

.setting-label {
	color: #374151;
}

.unit-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
}

.unit-button {
	padding: 0.25rem 0.5rem;
	font-size: 0.75rem;
	border-radius: 0.25rem;
	background-color: #e5e7eb;
}

.unit-button.active {
	background-color: #3b82f6;
	color: white;
}

/* 账户管理 */
.account-management-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.5rem;
	background-color: #f9fafb;
	border-radius: 0.25rem;
	margin-bottom: 0.5rem;
}

.account-management-item:last-child {
	margin-bottom: 0;
}

.drag-handle {
	cursor: move;
	color: #9ca3af;
}

.delete-account-btn {
	padding: 0.25rem 0.5rem;
	font-size: 0.75rem;
	border-radius: 0.25rem;
	background-color: #ef4444;
	color: white;
	transition: background-color 0.2s;
	border: none;
	cursor: pointer;
}

.delete-account-btn:hover {
	background-color: #dc2626;
}

.add-account-btn {
	padding: 0.5rem 0.75rem;
	font-size: 0.875rem;
	border-radius: 0.375rem;
	background-color: #3b82f6;
	color: white;
	transition: background-color 0.2s;
	margin-top: 0.5rem;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.add-account-btn:hover {
	background-color: #2563eb;
}

.add-account-btn i {
	margin-right: 0.25rem;
}

/* 历史编辑器 */
.history-editor {
	border: 1px solid #e5e7eb;
	border-radius: 0.375rem;
	max-height: 24rem;
	overflow-y: auto;
}

.history-date-header {
	padding: 0.75rem;
	background-color: #f3f4f6;
	font-weight: 500;
	cursor: pointer;
	display: flex;
	justify-content: space-between;
	align-items: center;
	color: #1f2937;
}

.history-details {
	padding: 0.75rem;
}

.history-entry {
	display: grid;
	grid-template-columns: 1fr 1fr 2fr auto;
	gap: 0.5rem;
	align-items: center;
	margin-bottom: 0.5rem;
}

.history-entry:last-child {
	margin-bottom: 0;
}

.history-account {
	font-size: 0.875rem;
	color: #1f2937;
}

.history-amount-input,
.history-note-input {
	padding: 0.25rem 0.5rem;
	border: 1px solid #d1d5db;
	border-radius: 0.25rem;
	font-size: 0.875rem;
	background-color: white;
	color: #1f2937;
}

.history-amount-input:focus,
.history-note-input:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.delete-asset-btn {
	color: #ef4444;
	background: none;
	border: none;
	cursor: pointer;
}

.delete-asset-btn:hover {
	color: #dc2626;
}

/* 按钮样式 */
.action-button {
	padding: 0.5rem 1rem;
	border-radius: 0.375rem;
	font-weight: 500;
	transition: background-color 0.2s;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	cursor: pointer;
}

.action-button i {
	margin-right: 0.25rem;
}

.save-btn {
	background-color: #3b82f6;
	color: white;
}

.save-btn:hover {
	background-color: #2563eb;
}

.export-btn {
	background-color: #10b981;
	color: white;
}

.export-btn:hover {
	background-color: #059669;
}

.import-btn {
	background-color: #6b7280;
	color: white;
}

.import-btn:hover {
	background-color: #4b5563;
}

.populate-btn {
	background-color: #a855f7;
	color: white;
}

.populate-btn:hover {
	background-color: #9333ea;
}

.save-history-btn {
	padding: 0.5rem 0.75rem;
	font-size: 0.875rem;
	border-radius: 0.375rem;
	background-color: #10b981;
	color: white;
	transition: background-color 0.2s;
	margin-top: 0.5rem;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.save-history-btn:hover {
	background-color: #059669;
}

.save-history-btn i {
	margin-right: 0.25rem;
}

/* Toast提示 */
.toast {
	position: fixed;
	bottom: 1rem;
	right: 1rem;
	background-color: #1f2937;
	color: white;
	padding: 1rem;
	border-radius: 0.5rem;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
	transform: translateY(100%);
	opacity: 0;
	transition: all 0.3s ease-out;
	z-index: 50;
}

.toast.show {
	transform: translateY(0);
	opacity: 1;
}

.toast.error {
	background-color: #ef4444;
}

/* 响应式设计 */
@media (max-width: 767px) {
	.page-container {
		padding: 0.5rem;
	}
	
	.header {
		flex-direction: column;
		align-items: stretch;
		gap: 1rem;
	}
	
	.nav-buttons {
		width: 100%;
	}
	
	.account-item {
		flex-direction: column;
		align-items: stretch;
		gap: 0.5rem;
	}
	
	.account-amount {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	
	.history-entry {
		grid-template-columns: 1fr;
	}
	
	/* 总资产金额右对齐 */
	.total-amount {
		text-align: right !important;
	}
	
	/* 速记页面总资产容器在小屏模式下右对齐 */
	#recordPage .flex.items-baseline {
		justify-content: flex-end;
	}
	
	/* 趋势图选择器区域在小屏上堆叠 */
	#overviewPage .flex.flex-col.sm\:flex-row {
		flex-direction: column;
		align-items: flex-start;
	}
	
	#overviewPage .mt-2.sm\:mt-0 {
		margin-top: 0.5rem;
	}
	
	/* 选择器最小宽度 */
	#trendPeriodSelect {
		min-width: 120px;
	}
}

/* 更小屏幕的特殊处理 */
@media (max-width: 480px) {
	#trendPeriodSelect {
		min-width: 100px;
		font-size: 0.875rem;
		padding: 0.25rem 0.5rem;
	}
	
	#overviewPage .flex.flex-col.sm\:flex-row {
		align-items: stretch;
	}
	
	#overviewPage .flex.flex-wrap.gap-2 > * {
		flex: 1;
		min-width: 0;
	}
}