/**
 * itab-nav 布局层:基础重置、壁纸、时钟、搜索框、磁贴网格容器
 */

/* ---- CSS 变量(主题) ---- */
.itab-app {
	/* 主题色与文字 */
	--itab-accent: #4f7cff;
	--itab-text: #1f2329;
	--itab-text-2: #5f6672;
	--itab-text-invert: #ffffff;

	/* 卡片 */
	--itab-card-bg: rgba(255, 255, 255, 0.72);
	--itab-card-bg-hover: rgba(255, 255, 255, 0.9);
	--itab-card-border: rgba(255, 255, 255, 0.5);
	--itab-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
	--itab-shadow-hover: 0 12px 32px rgba(15, 23, 42, 0.2);

	/* 网格 */
	--itab-cols: 6;
	--itab-cell: 92px;
	--itab-gap: 18px;
	--itab-row-gap: 18px;
	--itab-icon-size: 56px;

	/* 圆角 */
	--itab-radius: 18px;
	--itab-icon-radius: 16px;
}

.itab-app[data-theme="dark"] {
	--itab-text: #eef1f6;
	--itab-text-2: #a7aebc;
	--itab-card-bg: rgba(24, 28, 38, 0.6);
	--itab-card-bg-hover: rgba(30, 35, 48, 0.78);
	--itab-card-border: rgba(255, 255, 255, 0.08);
	--itab-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
	--itab-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* ---- 根容器 ---- */
.itab-app {
	position: relative;
	min-height: 100vh;
	width: 100%;
	overflow-x: hidden;
	color: var(--itab-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
		"Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	-webkit-font-smoothing: antialiased;
	background-color: #dfe7f5;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	transition: background-color 0.3s ease;
	box-sizing: border-box;
}

.itab-app *,
.itab-app *::before,
.itab-app *::after {
	box-sizing: border-box;
}

/* 壁纸遮罩(保证文字可读) */
.itab-app__wallpaper {
	position: fixed;
	inset: 0;
	z-index: 0;
	background: inherit;
	background-size: cover;
	background-position: center;
}

/* 默认渐变壁纸 */
.itab-app__wallpaper--gradient {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ---- 主内容容器(居中) ---- */
.itab-app__stage {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	min-height: 100vh;
	padding: 6vh 4vw 16vh;
}

/* ---- 时钟区 ---- */
.itab-clock {
	text-align: center;
	user-select: none;
	margin-bottom: 3vh;
	text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
	color: var(--itab-text);
}

.itab-clock__time {
	font-size: 64px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 1px;
	font-variant-numeric: tabular-nums;
}

.itab-clock__date {
	margin-top: 10px;
	font-size: 15px;
	font-weight: 500;
	opacity: 0.85;
}

/* ---- 搜索框 ---- */
.itab-search {
	position: relative;
	display: flex;
	align-items: center;
	width: min(680px, 90vw);
	height: 52px;
	margin-bottom: 6vh;
	padding: 0 8px 0 6px;
	border-radius: 18px;
	background: var(--itab-card-bg);
	border: 1px solid var(--itab-card-border);
	box-shadow: var(--itab-shadow);
	backdrop-filter: blur(12px) saturate(1.2);
	-webkit-backdrop-filter: blur(12px) saturate(1.2);
}

.itab-search__engine {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	border-radius: 12px;
	cursor: pointer;
	transition: background 0.2s;
}

.itab-search__engine:hover {
	background: rgba(127, 127, 127, 0.12);
}

.itab-search__engine-ico {
	width: 28px;
	height: 28px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 700;
	color: #fff;
	flex: none;
}

.itab-search__caret {
	font-size: 11px;
	opacity: 0.55;
}

.itab-search__input {
	flex: 1;
	min-width: 0;
	height: 100%;
	border: none;
	outline: none;
	background: transparent;
	font-size: 16px;
	color: var(--itab-text);
	padding: 0 12px;
}

.itab-search__input::placeholder {
	color: var(--itab-text-2);
}

.itab-search__go {
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 10px;
	background: var(--itab-accent);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	transition: opacity 0.2s;
}

.itab-search__go:hover {
	opacity: 0.88;
}

/* 引擎下拉 */
.itab-search__dropdown {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	min-width: 200px;
	padding: 6px;
	border-radius: 14px;
	background: var(--itab-card-bg);
	border: 1px solid var(--itab-card-border);
	box-shadow: var(--itab-shadow-hover);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	z-index: 50;
}

.itab-search__dropdown-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 12px;
	border-radius: 9px;
	cursor: pointer;
	font-size: 14px;
}

.itab-search__dropdown-item:hover {
	background: rgba(127, 127, 127, 0.14);
}

.itab-search__dropdown-item.is-active {
	font-weight: 600;
}

.itab-search__dropdown-divider {
	height: 1px;
	margin: 6px 4px;
	background: rgba(127, 127, 127, 0.2);
}

/* ---- 磁贴网格容器 ---- */
.itab-grid {
	display: grid;
	grid-template-columns: repeat(var(--itab-cols), var(--itab-cell));
	grid-auto-rows: var(--itab-cell);
	gap: var(--itab-row-gap) var(--itab-gap);
	grid-auto-flow: dense;
	justify-content: center;
}

/* ---- 登录提示 ---- */
.itab-login-hint {
	text-align: center;
	color: var(--itab-text);
	font-size: 15px;
	padding: 24px 20px;
}

.itab-login-hint a {
	color: var(--itab-accent);
	font-weight: 600;
}

/* ---- 同步状态(左下角) ---- */
.itab-sync {
	position: fixed;
	left: 18px;
	bottom: 16px;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 12px;
	color: var(--itab-text-2);
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

.itab-sync__spinner {
	width: 13px;
	height: 13px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: itab-spin 0.8s linear infinite;
}

@keyframes itab-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ---- 响应式 ---- */
@media (max-width: 720px) {
	.itab-app {
		--itab-cell: 76px;
		--itab-gap: 14px;
		--itab-cols: 4;
	}
	.itab-clock__time {
		font-size: 46px;
	}
}

@media (max-width: 480px) {
	.itab-app {
		--itab-cell: 66px;
		--itab-gap: 12px;
		--itab-cols: 3;
	}
	.itab-clock__time {
		font-size: 38px;
	}
}
