/* GuidePhD 我的伙伴功能样式 - 统一设计风格 */

/* 主要颜色定义 - 与admin.css保持一致 */
:root {
    --primary-color: #165DFF;
    --primary-hover: #4080FF;
    --primary-light: #E8F3FF;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --error-color: #ff4d4f;
    --text-primary: #333;
    --text-secondary: #666;
    --text-light: #999;
    --bg-light: #f0f2f5;
    --bg-white: #ffffff;
    --border-color: #d9d9d9;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* 标签页内容容器 - 移除白色卡片背景，保持原有样式 */
.tab-content {
    padding: 0;
    margin-top: 0;
}

/* 页面标题区域 */
.section-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 伙伴类型切换标签 */
.buddies-type-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.buddies-type-tabs button {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.buddies-type-tabs button.active,
.buddies-type-tabs button.text-primary {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 500;
}

.buddies-type-tabs button:hover {
    color: var(--primary-hover);
}

/* 搜索和筛选区域 */
.buddies-search-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-light);
    border-radius: var(--border-radius);
    align-items: center;
}

/* 搜索区域容器布局 */
.bg-white.rounded-xl.p-4.sm\:p-6.shadow-sm.border.border-neutral-200.mb-6 > div.flex {
    width: 100%;
}

/* 左侧搜索和筛选容器 */
.bg-white.rounded-xl.p-4.sm\:p-6.shadow-sm.border.border-neutral-200.mb-6 > div.flex > div:first-child {
    flex: 1;
    min-width: 0;
}

/* 搜索输入框容器 */
.bg-white.rounded-xl.p-4.sm\:p-6.shadow-sm.border.border-neutral-200.mb-6 > div.flex > div:first-child > div:first-child {
    flex: 1;
}

/* 状态筛选下拉框容器 */
.bg-white.rounded-xl.p-4.sm\:p-6.shadow-sm.border.border-neutral-200.mb-6 > div.flex > div:first-child > div:last-child {
    flex-shrink: 0;
}

.buddies-search-filter input,
.buddies-search-filter select,
.buddies-search-filter button {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: var(--transition);
}

.buddies-search-filter input:focus,
.buddies-search-filter select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.2);
      outline: none;
  }

  /* 搜索输入框 */
  #buddies-search-input {
    flex: 1;
    min-width: 350px;
    width: 100%;
}

/* 确保搜索区域的左右部分能够适应屏幕 */
.bg-white.rounded-xl.p-4.sm\:p-6.shadow-sm.border.border-neutral-200.mb-6 > div.flex.flex-col.md\:flex-row {
    flex-wrap: wrap;
}

/* 调整中等屏幕及以上尺寸的布局 */
@media (min-width: 768px) {
    .bg-white.rounded-xl.p-4.sm\:p-6.shadow-sm.border.border-neutral-200.mb-6 > div.flex.flex-col.md\:flex-row > div:first-child {
        flex: 1;
        min-width: 0;
        display: flex;
        gap: 1rem;
    }
    
    /* 让搜索输入框充分占据可用空间 */
    .bg-white.rounded-xl.p-4.sm\:p-6.shadow-sm.border.border-neutral-200.mb-6 > div.flex.flex-col.md\:flex-row > div:first-child > div.relative.w-full.md\:w-64 {
        flex: 2;
        width: auto;
        max-width: none;
        min-width: 0;
    }
    
    /* 状态筛选下拉框在中等屏幕上的样式 */
    .bg-white.rounded-xl.p-4.sm\:p-6.shadow-sm.border.border-neutral-200.mb-6 > div.flex.flex-col.md\:flex-row > div:first-child > div.relative.w-full.md\:w-48 {
        flex-shrink: 0;
        width: auto;
    }
    
    /* 确保按钮区域不会占用太多空间 */
    .bg-white.rounded-xl.p-4.sm\:p-6.shadow-sm.border.border-neutral-200.mb-6 > div.flex.flex-col.md\:flex-row > div:last-child {
        flex-shrink: 0;
        display: flex;
        gap: 0.5rem;
    }
}

#buddies-status-filter,
#buddies-sort {
    min-width: 150px;
}

/* 伙伴列表容器 */
.buddies-list-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

/* 伙伴列表表格 */
.buddies-list table {
    width: 100%;
    border-collapse: collapse;
}

.buddies-list th {
    background-color: var(--bg-light);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-bottom: 2px solid var(--border-color);
}

.buddies-list td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.buddies-list tr:last-child td {
    border-bottom: none;
}

.buddies-list tr:hover {
    background-color: #fafafa;
}

/* 用户信息单元格样式 */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.875rem;
}

.user-details .user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.user-details .user-major {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* 研究方向单元格 */
.research-direction {
    max-width: 200px;
    color: var(--text-secondary);
}

/* 标签容器样式 */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.buddy-tag {
    background-color: var(--primary-color) !important;
    color: white !important;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(22, 93, 255, 0.3);
    transition: all 0.2s ease;
    display: inline-block;
    margin: 2px;
}

.buddy-tag:hover {
    background-color: var(--primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(22, 93, 255, 0.4);
}

/* 状态指示器 */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator .online {
    color: var(--success-color);
}

.status-indicator .offline {
    color: var(--text-light);
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.action-button {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.action-button.primary {
    color: var(--primary-color);
}

.action-button.primary:hover {
    color: var(--primary-hover);
    background-color: var(--primary-light);
    border-radius: var(--border-radius);
}

.action-button.danger {
    color: var(--text-light);
}

.action-button.danger:hover {
    color: var(--error-color);
    background-color: rgba(255, 77, 79, 0.1);
    border-radius: var(--border-radius);
}

/* 分页控件 */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-white);
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 加载状态 */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-secondary);
    text-align: center;
}

.empty-icon {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-button:hover {
    background-color: var(--primary-hover);
}

/* 操作按钮组 */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* 刷新按钮 */
.refresh-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.refresh-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .buddies-search-filter {
        flex-direction: column;
    }
    
    .buddies-search-filter input,
    .buddies-search-filter select {
        width: 100%;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .action-bar .primary-button,
    .action-bar .refresh-btn {
        justify-content: center;
    }
    
    .buddies-list table {
        font-size: 0.75rem;
    }
    
    .buddies-list th,
    .buddies-list td {
        padding: 0.5rem;
    }
    
    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .tags-container {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* 加载动画增强 */
.loading-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 平滑过渡 */
.transition-custom {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 工具提示效果 */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
}

[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

/* 模态框背景样式 - 统一设置与个人中心档案预览一致 */
#modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#modal-backdrop:not(.hidden) {
    opacity: 1;
    visibility: visible;
}