/**
 * 权限组件样式
 * 为权限相关组件提供样式支持
 */

/* ==================== 权限指令样式 ==================== */

/* 权限隐藏 */
.permission-hidden {
    display: none !important;
}

/* 权限不可见（占位） */
.permission-invisible {
    visibility: hidden !important;
}

/* 权限禁用 */
.permission-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* 权限可见（动画效果） */
.permission-visible {
    animation: permission-fade-in 0.3s ease-in;
}

@keyframes permission-fade-in {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 菜单样式 ==================== */

.menu-container {
    width: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
}

.menu-item {
    position: relative;
    list-style: none;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 4px;
    margin: 2px 8px;
}

.menu-link:hover {
    background-color: #f5f5f5;
    color: #1890ff;
}

.menu-link.active {
    background-color: #e6f7ff;
    color: #1890ff;
    font-weight: 500;
}

.menu-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-text {
    flex: 1;
    font-size: 14px;
}

.menu-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.menu-item.open > .menu-link .menu-arrow {
    transform: rotate(180deg);
}

/* 子菜单 */
.submenu {
    list-style: none;
    padding-left: 20px;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.menu-item.open > .submenu {
    max-height: 1000px;
}

.submenu .menu-link {
    padding: 10px 16px;
    font-size: 13px;
}

.submenu .menu-icon {
    width: 16px;
    height: 16px;
    font-size: 14px;
}

/* 多级菜单 */
.menu-level-0 > .menu-link {
    font-weight: 500;
}

.menu-level-1 > .menu-link {
    padding-left: 48px;
}

.menu-level-2 > .menu-link {
    padding-left: 64px;
}

/* ==================== 按钮样式 ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.3s ease;
    user-select: none;
}

.btn:hover {
    opacity: 0.8;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* 按钮尺寸 */
.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-md {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* 按钮类型 */
.btn-primary {
    color: #fff;
    background-color: #1890ff;
    border-color: #1890ff;
}

.btn-primary:hover {
    background-color: #40a9ff;
    border-color: #40a9ff;
}

.btn-success {
    color: #fff;
    background-color: #52c41a;
    border-color: #52c41a;
}

.btn-success:hover {
    background-color: #73d13d;
    border-color: #73d13d;
}

.btn-warning {
    color: #fff;
    background-color: #faad14;
    border-color: #faad14;
}

.btn-warning:hover {
    background-color: #ffc53d;
    border-color: #ffc53d;
}

.btn-danger {
    color: #fff;
    background-color: #ff4d4f;
    border-color: #ff4d4f;
}

.btn-danger:hover {
    background-color: #ff7875;
    border-color: #ff7875;
}

.btn-info {
    color: #fff;
    background-color: #13c2c2;
    border-color: #13c2c2;
}

.btn-info:hover {
    background-color: #36cfc9;
    border-color: #36cfc9;
}

.btn-link {
    color: #1890ff;
    background-color: transparent;
    border-color: transparent;
}

.btn-link:hover {
    color: #40a9ff;
    text-decoration: underline;
}

/* 按钮图标 */
.btn i {
    margin-right: 4px;
}

.btn i:last-child {
    margin-right: 0;
}

/* ==================== 按钮组 ==================== */

.btn-group {
    display: inline-flex;
    gap: 8px;
}

.btn-group .btn {
    margin: 0;
}

.btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ==================== 操作按钮 ==================== */

.action-buttons {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.action-buttons .btn {
    padding: 4px 8px;
    font-size: 12px;
}

.action-buttons .btn i {
    font-size: 14px;
}

/* ==================== 下拉按钮 ==================== */

.btn-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    position: relative;
}

.dropdown-toggle::after {
    content: '';
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
    border-top: 4px solid;
    border-right: 4px solid transparent;
    border-bottom: 0;
    border-left: 4px solid transparent;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 160px;
    padding: 8px 0;
    margin: 4px 0 0;
    background-color: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
    color: #1890ff;
}

.dropdown-divider {
    height: 1px;
    margin: 8px 0;
    background-color: #f0f0f0;
}

/* ==================== 加载状态 ==================== */

.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    margin-left: -7px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

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

/* ==================== 权限徽章 ==================== */

.permission-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    color: #fff;
    background-color: #1890ff;
    border-radius: 10px;
    margin-left: 8px;
}

.permission-badge-success {
    background-color: #52c41a;
}

.permission-badge-warning {
    background-color: #faad14;
}

.permission-badge-danger {
    background-color: #ff4d4f;
}

/* ==================== 响应式 ==================== */

@media (max-width: 768px) {
    .menu-link {
        padding: 10px 12px;
    }
    
    .menu-text {
        font-size: 13px;
    }
    
    .submenu .menu-link {
        padding: 8px 12px;
    }
    
    .btn-group {
        flex-wrap: wrap;
    }
    
    .action-buttons {
        flex-wrap: wrap;
    }
}

/* ==================== 暗黑模式支持 ==================== */

@media (prefers-color-scheme: dark) {
    .menu-link {
        color: #e8e8e8;
    }
    
    .menu-link:hover {
        background-color: #333;
        color: #40a9ff;
    }
    
    .menu-link.active {
        background-color: #1f1f1f;
        color: #40a9ff;
    }
    
    .dropdown-menu {
        background-color: #1f1f1f;
        border-color: #333;
    }
    
    .dropdown-item {
        color: #e8e8e8;
    }
    
    .dropdown-item:hover {
        background-color: #333;
    }
}

