/**
 * 管理页面自定义样式
 */

/* 全局去除a标签默认样式 */
a {
    text-decoration: none;
    outline: none;
}

a:hover {
    text-decoration: none;
}

a:focus {
    outline: none;
}
/* 自定义滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 侧边栏样式 */
#sidebar {
    width: 16rem; /* 默认宽度 */
    transition: width 0.3s ease-in-out, transform 0.3s ease-in-out;
    overflow-x: hidden; /* 防止内容溢出 */
    position: fixed; /* 确保固定定位 */
    height: 100vh; /* 全屏高度 */
    top: 0; /* 顶部对齐 */
    left: 0; /* 左侧对齐 */
    z-index: 40; /* 确保层级 */
}

/* 折叠状态的侧边栏 */
#sidebar.collapsed {
    width: 4rem;
}

/* 顶部导航栏样式 */
header {
    transition: width 0.3s ease-in-out, left 0.3s ease-in-out;
    position: fixed; /* 确保固定定位 */
    top: 0; /* 确保在顶部 */
    backface-visibility: hidden; /* 防止在某些浏览器中的闪烁 */
    will-change: transform; /* 提高性能 */
    z-index: 50; /* 确保在最上层 */
}

/* 确保头部导航栏内容布局正确 */
header > div {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

/* 侧边栏内容 */
.sidebar-full {
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    white-space: nowrap;
    overflow: hidden;
}

/* 折叠状态下隐藏文本 */
#sidebar.collapsed .sidebar-full {
    display: none;
}

/* 折叠状态下居中图标 */
#sidebar.collapsed .fas {
    margin-right: 0;
}

/* 折叠状态下居中菜单项 */
#sidebar.collapsed a {
    justify-content: center;
}

/* 移动端菜单覆盖层 */
.sidebar-overlay {
    background-color: rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease-in-out;
}

/* 活跃菜单项指示器 - 修复定位问题 */
.menu-active-indicator {
    width: 4px;
    height: 24px;
    border-radius: 0 4px 4px 0;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.2s ease;
}

/* 确保侧边栏在桌面端正确显示 */
@media (min-width: 1024px) {
    #sidebar {
        transform: none;
    }
}

/* 折叠按钮样式 */
.sidebar-toggle-btn {
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 4px;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    position: relative; /* 确保按钮有正确的定位 */
    z-index: 60; /* 确保按钮在最上层 */
    margin-left: 0; /* 强制左边距为0 */
}

.sidebar-toggle-btn:hover {
    background-color: #e5e7eb;
}

.sidebar-toggle-btn i {
    font-size: 1rem;
    color: #4b5563;
    transition: transform 0.3s ease;
}

/* 折叠按钮图标动画 */
.sidebar-icon {
    transition: transform 0.3s ease, color 0.3s ease;
}

#sidebar.collapsed ~ .flex-1 .sidebar-icon.fa-chevron-left {
    color: #3b82f6;
    transform: rotate(180deg);
}

#sidebar:not(.collapsed) ~ .flex-1 .sidebar-icon.fa-grip-lines {
    color: #4b5563;
}

/* 响应式表格样式 */
@media (max-width: 640px) {
    .responsive-table thead {
        display: none;
    }
    
    .responsive-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border-bottom: 2px solid #e5e7eb;
    }
    
    .responsive-table tbody tr:last-child {
        margin-bottom: 0;
    }
    
    .responsive-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        border-bottom: 1px solid #f3f4f6;
        padding: 0.75rem 1rem;
    }
    
    .responsive-table tbody td:last-child {
        border-bottom: none;
    }
    
    .responsive-table tbody td:before {
        content: attr(data-label);
        font-weight: 500;
        color: #6b7280;
        text-align: left;
    }
}

/* 卡片悬停效果 */
.card-hover {
    transition: all 0.3s ease;
}
.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 通知容器样式 */
#notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}
.fade-out {
    animation: fadeOut 0.3s ease-in-out;
}
.slide-in-right {
    animation: slideInRight 0.3s ease-in-out;
}
.slide-out-right {
    animation: slideOutRight 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
@keyframes slideOutRight {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-px-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .mobile-py-2 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* 平板适配 */
@media (min-width: 769px) and (max-width: 1024px) {
    .hide-on-tablet {
        display: none !important;
    }
}

/* 打印样式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        background-color: white !important;
    }
    
    .print-break-inside-avoid {
        break-inside: avoid;
    }
}

/* 用户下拉菜单样式 */
#userMenuButton {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

#userMenuButton:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

#userMenuButton:after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    border: 2px solid white;
}

#userMenu {
    transform-origin: top right;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#userMenu:not(.hidden) {
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 内容包装器样式 */
.content-wrapper {
    padding-top: 3rem;
}

/* 全局内容区域样式 */
main > .content-wrapper > * {
    margin-top: 2rem;
}

main > .content-wrapper > *:first-child {
    margin-top: 2rem !important;
}

/* 确保内页内容正确显示 */
main {
    padding-top: 3rem !important;
}

/* 徽章样式 */
.badge-primary {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fecaca;
    color: #991b1b;
}

.badge-info {
    background-color: #e0e7ff;
    color: #3730a3;
} 