/* 管理后台自定义样式 */

/* 表格样式优化 */
table {
    border-collapse: collapse;
}

table th {
    white-space: nowrap;
}

table td {
    vertical-align: middle;
}

/* 输入框聚焦效果 */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 按钮悬停效果 */
button:not(:disabled):hover {
    transform: translateY(-1px);
}

button:disabled {
    cursor: not-allowed;
}

/* 卡片阴影 */
.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 下拉菜单动画 */
[x-cloak] {
    display: none !important;
}

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

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

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

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

/* 表格固定表头 */
.table-fixed-header thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 响应式表格 */
@media (max-width: 768px) {
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast动画 */
.toast-enter {
    animation: toast-in 0.3s ease;
}

.toast-leave {
    animation: toast-out 0.3s ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* 弹窗遮罩动画 */
.modal-backdrop {
    transition: opacity 0.3s ease;
}

/* 分页样式 */
.pagination a {
    transition: all 0.2s;
}

.pagination a:hover {
    background-color: #f3f4f6;
}

/* 状态标签 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.25rem;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #9ca3af;
}

/* 表单验证错误 */
.input-error {
    border-color: #ef4444 !important;
}

.error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* 渐变背景 */
.gradient-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

/* 导航菜单高亮 */
nav a.active {
    background-color: #eff6ff;
    color: #2563eb;
}

/* 手机浏览器：强制宽度 1700px 桌面画布，高度自适应，不缩小，滑动查看 */
html.admin-force-desktop-view {
    width: 1700px;
    min-width: 1700px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
html.admin-force-desktop-view body.admin-force-desktop-view {
    width: 1700px;
    min-width: 1700px;
    min-height: auto;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}
html.admin-force-desktop-view body.admin-force-desktop-view .admin-main-content {
    min-width: 1700px;
}
/* 强制桌面模式下使用横栏导航，隐藏手机汉堡菜单与侧栏 */
html.admin-force-desktop-view [aria-label="打开菜单"],
html.admin-force-desktop-view .admin-mobile-nav-backdrop,
html.admin-force-desktop-view .admin-mobile-nav-panel {
    display: none !important;
}
html.admin-force-desktop-view .admin-header-username {
    display: inline;
    max-width: 9rem;
}

/* 管理后台：手机侧栏导航 */
.admin-mobile-nav-backdrop {
    background: rgba(0, 0, 0, 0.45);
}
.admin-mobile-nav-panel {
    width: min(280px, 86vw);
    max-width: 86vw;
}
.admin-header-username {
    display: none;
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}
@media (min-width: 768px) {
    .admin-header-username {
        display: inline;
        max-width: 9rem;
    }
}
body.admin-nav-open {
    overflow: hidden;
    touch-action: none;
}
.admin-main-content {
    min-height: calc(100vh - 3.5rem);
}

/* 固定底部操作栏 */
.fixed-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    z-index: 40;
}
