/* 角色管理器样式 */
.role-manager-modal {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

/* 角色管理器模态框滚动条样式 */
.role-manager-modal::-webkit-scrollbar {
    width: 6px;
}

.role-manager-modal::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: 3px;
}

.role-manager-modal::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.role-manager-modal::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Tab 导航样式 */
.role-tab-nav {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    background: var(--secondary-color);
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

.role-tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.role-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.role-tab-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
}

.role-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

/* Tab 内容区域 */
.role-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.role-tab-content.active {
    display: block;
}

/* 确保内容区域能够滚动 */
.role-tab-content::-webkit-scrollbar {
    width: 6px;
}

.role-tab-content::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: 3px;
}

.role-tab-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.role-tab-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* 工具栏样式 */
.role-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
    padding: 1rem;
    background: var(--secondary-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.role-search-container {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.role-search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
}

.role-filters {
    display: flex;
    gap: 0.75rem;
}

.role-filter-select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    min-width: 120px;
}

.role-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* 统计栏样式 */
.role-stats-bar {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.role-stat-item {
    text-align: center;
}

.role-stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.role-stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 角色网格样式 */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    min-height: 200px;
}

/* 角色卡片样式 */
.role-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--soft-shadow);
    position: relative;
    overflow: hidden;
}

.role-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.role-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.role-category {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.role-actions {
    display: flex;
    gap: 0.25rem;
}

.role-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--secondary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.role-action-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.role-action-btn.favorite-btn.active {
    background: #ff6b6b;
    color: white;
}

.role-card-content {
    margin-bottom: 1.5rem;
}

.role-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    line-height: 1.3;
}

.role-description {
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.role-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.role-tag {
    padding: 0.25rem 0.5rem;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-light);
}

.role-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-light);
}

.role-rating {
    display: flex;
    gap: 2px;
}

.star {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.star:hover {
    transform: scale(1.2);
}

.star.filled {
    color: #ffc107;
}

.role-card-footer {
    display: flex;
    gap: 0.75rem;
}

.role-use-btn,
.role-edit-btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.9rem;
}

/* 无角色状态 */
.no-roles {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.no-roles-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-roles h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

/* 快速生成器样式 */
.quick-role-generator {
    background: var(--light-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.quick-role-generator h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 收起/展开按钮 */
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 1rem;
    background: var(--secondary-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.collapsible-header:hover {
    background: var(--pearl-color);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-content.expanded {
    max-height: 1000px;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .role-manager-modal {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        padding: 1rem;
        margin: 0;
        border-radius: 0;
    }
    
    /* 移动端Tab导航 */
    .role-tab-nav {
        margin-bottom: 1rem;
    }
    
    .role-tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    /* 移动端工具栏优化 */
    .role-toolbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .role-search-container {
        order: 1;
        width: 100%;
    }
    
    .role-filters {
        order: 2;
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .role-filter-select {
        width: 100%;
        min-width: auto;
    }
    
    .role-actions {
        order: 3;
        width: 100%;
        justify-content: space-between;
    }
    
    .role-actions .btn {
        flex: 1;
        min-width: 0;
        font-size: 0.8rem;
        padding: 0.75rem 0.5rem;
        text-align: center;
    }
    
    /* 移动端统计栏 */
    .role-stats-bar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
        text-align: center;
    }
    
    .role-stat-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
    }
    
    .role-stat-number {
        font-size: 1.2rem;
    }
    
    /* 移动端角色网格 */
    .roles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* 移动端角色卡片 */
    .role-card {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .role-name {
        font-size: 1.1rem;
    }
    
    .role-description {
        -webkit-line-clamp: 3;
        font-size: 0.9rem;
    }
    
    .role-card-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .role-use-btn,
    .role-edit-btn {
        width: 100%;
        padding: 1rem;
    }
    
    /* 移动端快速生成器 */
    .quick-role-generator {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .quick-role-generator h3 {
        font-size: 1rem;
    }
    
    /* 移动端角色标签 */
    .role-tags {
        gap: 0.25rem;
    }
    
    .role-tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* 移动端角色操作按钮 */
    .role-card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .role-category {
        flex: 1;
        min-width: 0;
    }
    
    .role-actions {
        gap: 0.5rem;
    }
    
    .role-action-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .role-manager-modal {
        padding: 0.5rem;
    }
    
    .role-toolbar {
        padding: 0.75rem;
    }
    
    .role-actions .btn {
        font-size: 0.7rem;
        padding: 0.5rem 0.25rem;
    }
    
    .role-card {
        padding: 0.75rem;
    }
    
    .role-name {
        font-size: 1rem;
    }
    
    .role-stat-number {
        font-size: 1rem;
    }
    
    .role-stat-label {
        font-size: 0.7rem;
    }
    
    /* 紧凑的角色卡片 */
    .role-card-content {
        margin-bottom: 1rem;
    }
    
    .role-stats {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

/* 角色菜单样式 */
.role-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 1000;
    min-width: 150px;
    overflow: hidden;
}

.role-menu-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.role-menu-item:hover {
    background: var(--secondary-color);
}

.role-menu-item.danger {
    color: var(--danger-color);
}

.role-menu-item.danger:hover {
    background: #fee2e2;
}

/* 移动端角色菜单 */
@media (max-width: 768px) {
    .role-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        border-radius: 16px 16px 0 0;
        min-width: auto;
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .role-menu-item {
        padding: 1rem;
        font-size: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .role-menu-item:last-child {
        border-bottom: none;
    }
}

/* 动画效果 */
@keyframes roleCardEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.role-card {
    animation: roleCardEnter 0.3s ease-out;
}

/* 加载状态 */
.roles-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--text-light);
}

.roles-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 滑动手势指示器 */
.swipe-indicator {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    z-index: 1001;
}

@media (max-width: 768px) {
    .swipe-indicator {
        display: block;
    }
}