/* 全局样式 */
* {
    box-sizing: border-box;
}

/* 全局：页面背景透明，保留最小背景色回退 */
body {
    font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    /* 背景图 + 轻度叠色以提升可读性，图片文件放置：assets/bg.jpg */
    background: 
        linear-gradient(rgba(0,0,0,0.18), rgba(0,0,0,0.18)),
        url("assets/bg.png") center / cover no-repeat fixed;
    background-color: rgba(0,0,0,0.18);
    color: #f5f7fa;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* 标题栏 */
h1 {
    font-size: 28px;
    margin: 0 0 20px 0;
    color: var(--theme);
    border-bottom: 3px solid var(--theme);
    padding-bottom: 10px;
}

h2 {
    font-size: 18px;
    color: var(--theme-dark);
    margin-top: 20px;
    margin-bottom: 15px;
}

/* 容器：稍提高对比度 */
.container {
    max-width: 1000px;
    margin: 20px auto;
    background: rgba(255,255,255,0.06); /* 保持玻璃效果，但提高可读性 */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.10);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 20px;
    }
}

/* 卡片、登录框、进度容器等统一玻璃样式 */
.card, .login-box, #progressContainer, #progressContainer > div {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.12);
    color: #222;
}

/* 登录框特殊（覆盖原内联样式） */
.login-box {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.10);
}

/* 按钮对比增强（保留原色，同时适配透明背景） */
.btn {
    display: inline-block;
    padding: 10px 18px;
    margin: 5px 5px 5px 0;
    background: var(--theme);
    color: white;
    border-radius: 6px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.btn:hover {
    background: var(--theme-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

/* 表单组 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

/* 表单输入 */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="file"],
select {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
select:focus {
    outline: none;
    border-color: #007BFF;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

input[type="file"] {
    border: 2px dashed #ddd;
    padding: 15px;
    cursor: pointer;
    transition: border-color 0.3s;
}

input[type="file"]:hover {
    border-color: #007BFF;
}

/* 表单行布局 */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* 列表 */
ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

li {
    padding: 12px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
    background: rgba(255,255,255,0.02);
}

li:hover {
    background: #f9f9f9;
}

li label {
    cursor: pointer;
    display: flex;
    align-items: center;
}

li input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

/* 文件列表：修正对齐与悬停表现 */
ul.file-list {
    list-style: none;
    padding: 0;
    margin: 12px 0;
}
ul.file-list li {
    margin: 3px 0;               /* 项间距 */
    border-radius: 6px;
    background: rgba(255,255,255,0.02);
    transition: background 140ms ease; /* 不再使用 transform，避免布局位移 */
    overflow: hidden;
    /* 保证内层 a 可撑满宽度 */
    display: block;
}
.item-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;           /* 统一内边距，避免视觉偏移 */
    width: 100%;
    color: inherit;
    text-decoration: none;
}
.item-link:hover {
    background: rgba(255,255,255,0.045); /* 仅高亮，不抬起 */
    text-decoration: none;
}
.item-icon {
    width: 28px;
    flex: 0 0 28px;
    text-align: left;            /* 图标和文字左对齐 */
    font-size: 18px;
    line-height: 1;
}
.item-name {
    flex: 1 1 auto;
    word-break: break-word;
    color: inherit;
    text-align: left;            /* 明确左对齐文本，避免居中偏移 */
}

/* 面包屑导航 */
.breadcrumb {
    margin: 15px 0 20px 0;
    font-size: 14px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
}

.breadcrumb a {
    text-decoration: none;
    color: var(--theme);
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--theme-dark);
    text-decoration: underline;
}

.breadcrumb span {
    margin: 0 8px;
    color: #999;
}

/* 信息提示 */
.message {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* 日志内容 */
pre {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 13px;
    line-height: 1.5;
    color: #111;
}

/* 上传进度条 */
.progressBar {
    width: 100%;
    height: 24px;
    background: #eee;
    border-radius: 6px;
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.progressBar div {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #28a745, #218838);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* 进度条容器 */
#progressContainer {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
}

#progressContainer > div {
    margin-bottom: 20px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    border-left: 4px solid var(--theme);
}

/* 顶部导航栏 */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* 背景改为透明，保留毛玻璃效果以提高可读性 */
    background: transparent;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom: none;
    padding: 12px 20px;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); /* 轻微阴影区分内容 */
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .nav-left {
    flex: 1;
}

.navbar .site-title {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.navbar .nav-right {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.navbar .nav-right a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    padding: 5px 10px;
    border-radius: 4px;
}

.navbar .nav-right a:hover {
    background: rgba(255,255,255,0.2);
    color: #FFD700;
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 10px;
    }

    .navbar .nav-right {
        width: 100%;
        justify-content: center;
    }
}

/* 用户信息卡片 */
.user-info {
    background: #e7f3ff;
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid var(--theme);
    font-size: 14px;
}

/* 卡片容器 */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    border-top: 4px solid var(--theme);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.card h2 {
    font-size: 18px;
    margin: 0 0 10px 0;
    color: var(--theme);
}

.card p {
    font-size: 14px;
    color: #666;
    margin: 0 0 15px 0;
    line-height: 1.6;
}

/* 操作按钮组 */
.button-group {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

/* 分页导航 */
.pagination {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
    justify-content: center;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border-radius: 4px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination a:hover {
    background: #007BFF;
    color: white;
}

/* 分页容器：垂直堆叠并居中子元素 */
.pagination-container {
    display: flex;
    flex-direction: column;    /* 垂直排列：分页按钮 / 统计 / 跳页表单 */
    align-items: center;       /* 水平居中 */
    gap: 12px;
    margin-top: 20px;
    width: 100%;
}

/* 分页按钮行水平居中 */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 页信息居中显示 */
.page-info {
    font-size: 14px;
    color: #666;
    text-align: center;
}

/* 跳页表单居中 */
.jump-page {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}
.jump-page input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* 按钮小样式保持一致性 */
.jump-page button {
    padding: 8px 12px;
    background: var(--theme);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.jump-page button:hover { background: var(--theme-dark); }

/* 自定义右键菜单样式（美化：半透明、圆角、毛玻璃，边框细化） */
.custom-context-menu {
    display: none;
    position: fixed;
    background: rgba(255,255,255,0.10); /* 半透明白 */
    backdrop-filter: blur(8px);          /* 毛玻璃效果 */
    -webkit-backdrop-filter: blur(8px);
    border: 0.45px solid rgba(255,255,255,0.12); /* 更细 */
    border-radius: 12px;                /* 更圆的角 */
    box-shadow: 0 8px 20px rgba(5,15,30,0.32);
    z-index: 99999;
    min-width: 110px;                   /* 更短 */
    max-width: 220px;
    overflow: hidden;
    pointer-events: auto;
    transition: opacity 160ms ease, transform 160ms ease;
    opacity: 0;
    transform: translateY(6px);
    top: 0;
    left: 0;
}

/* 可见时的过渡状态 */
.custom-context-menu[aria-hidden="false"] {
    opacity: 1;
    transform: translateY(0);
}

/* 菜单项居中、内边距适中 */
.custom-context-menu .context-item {
    padding: 10px 12px;           /* 减小内边距 */
    cursor: pointer;
    user-select: none;
    transition: background 140ms ease, color 140ms ease;
    font-size: 14px;
    color: rgba(255,255,255,0.95);
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;      /* 居中 */
    text-align: center;
}

/* 悬停效果保持简洁 */
.custom-context-menu .context-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

/* 按下效果 */
.custom-context-menu .context-item:active {
    background: rgba(255,255,255,0.10);
}

/* Icon 颜色调整（若使用 emoji 可忽略） */
.custom-context-menu .context-item span {
    opacity: 0.95;
}

/* 用户管理表格：固定列宽并对齐 */
.user-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.user-table col.col-username { width: 30%; }
.user-table col.col-role { width: 18%; }
.user-table col.col-actions { width: 52%; }

.user-table th, .user-table td {
    padding: 8px 10px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: #222;
    background: rgba(255,255,255,0.02);
}
.user-table thead th {
    background: rgba(255,255,255,0.04);
    color: var(--theme);
    font-weight: 600;
    text-align: left;
}

/* 单元格类：明确文本对齐 */
.username-cell { text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.role-cell { text-align: left; }
.actions-cell { text-align: left; }

/* 内联表单在单元格内水平排列，并限制控件宽度避免撑破列 */
.user-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap:8px; align-items:center; margin:0; }
.small-input {
    height: 32px;
    padding: 6px 8px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.08);
    vertical-align: middle;
    box-sizing: border-box;
}
/* 限制 small-input 最大宽度，防止操作列被推宽（放宽密码框宽度） */
.small-input[type="password"] { max-width: 220px; }

/* 专用宽输入类，供 users.php 底部编辑密码使用：更宽且响应式 */
.wide-input {
	max-width: 360px;
	min-width: 140px;
	width: 40%;
	box-sizing: border-box;
}

/* 小屏适配：宽输入变为块级占满可用宽度 */
@media (max-width: 720px) {
	.wide-input { width: 100%; max-width: 100%; }
}

/* 按钮微调 */
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 6px; }
.btn.small.danger { background: #dc3545; border: none; }
.btn.small.danger:hover { background: #c82333; }

/* 在窄屏时让操作列换行排列 */
@media (max-width: 720px) {
    .user-table col.col-username { width: 35%; }
    .user-table col.col-role { width: 25%; }
    .user-table col.col-actions { width: 40%; }
    .inline-form { flex-direction: column; align-items: flex-start; gap:6px; }
}

/* 上传美化：每个文件的上传项 */
.upload-item {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 10px;
	border-radius: 8px;
	background: rgba(255,255,255,0.03);
	border: 1px solid rgba(255,255,255,0.04);
	margin-bottom: 10px;
}

/* 标题行：图标 + 名称 + 操作按钮 */
.upload-item .heading {
	display:flex;
	align-items:center;
	justify-content:space-between;
	gap:8px;
}
.upload-item .file-info {
	display:flex;
	align-items:center;
	gap:10px;
	color: inherit;
}
.upload-item .file-icon { font-size:18px; width:28px; text-align:left; }
.upload-item .file-name { font-size:14px; color:inherit; word-break:break-all; }

/* 进度条容器 */
.upload-item .progress-row {
	display:flex;
	align-items:center;
	gap:10px;
}
.progressBar {
	flex:1;
	height:12px;
	background: linear-gradient(90deg, rgba(0,0,0,0.06), rgba(0,0,0,0.04));
	border-radius: 8px;
	overflow:hidden;
	box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
	border: 1px solid rgba(0,0,0,0.03);
}
.progressBar .progress {
	height:100%;
	width:0%;
	background: linear-gradient(90deg, var(--theme), var(--theme-dark));
	transition: width 220ms ease;
}

/* 百分比与元信息 */
.progress-percent {
	min-width:48px;
	text-align:right;
	font-size:13px;
	color:#e9eef9;
}
.progress-meta {
	font-size:12px;
	color:#cfe6ff;
}

/* 取消按钮 */
.cancel-btn {
	background: transparent;
	border: 1px solid rgba(255,255,255,0.08);
	color: #fff;
	padding: 4px 8px;
	border-radius: 6px;
	cursor: pointer;
	font-size:13px;
}
.cancel-btn:hover {
	background: rgba(255,255,255,0.03);
	border-color: rgba(255,255,255,0.12);
}

/* 上传完成/失败状态 */
.upload-success .progress-meta { color: #bff0c6; }
.upload-fail .progress-meta { color: #ffd2d2; }

/* 小屏适配 */
@media (max-width:600px) {
	.progress-percent { display:none; }
	.upload-item .heading { flex-direction:column; align-items:flex-start; gap:6px; }
}

/* 画廊样式 */
.gallery { display:grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap:14px; margin-top:16px; }
.gallery a { display:block; border-radius:8px; overflow:hidden; background: rgba(255,255,255,0.95); color:#222; text-decoration:none; }
.gallery img { width:100%; height:140px; object-fit:cover; display:block; }
.gallery div { padding:8px; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* 文件夹项 */
.folder-item { padding:10px; background: rgba(255,255,255,0.03); border-radius:8px; display:flex; align-items:center; gap:8px; }

/* 复制链接吐司提示 */
.copy-toast {
    position: fixed;
    top: 18px;
    right: 18px;
    min-width: 160px;
    max-width: 320px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.28);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 220ms ease, transform 220ms ease;
    pointer-events: none;
    z-index: 12000;
}
.copy-toast.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.copy-toast.success { background: linear-gradient(90deg,#28a745,#218838); }
.copy-toast.error { background: linear-gradient(90deg,#dc3545,#c82333); }
