/* 伙伴CRM系统 - 自定义样式 */

/* 全局样式 */
:root {
    --primary-color: #667eea;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-color: #38ef7d;
    --warning-color: #ffa726;
    --danger-color: #ef5350;
    --info-color: #26c6da;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.1);
    --shadow-lg: 0 0.25rem 0.75rem rgba(0,0,0,0.15);
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f6fa;
    color: #2c3e50;
    line-height: 1.6;
}

/* 侧边栏样式 */
.sidebar {
    width: 16.25rem;
    height: 100vh;
    background: var(--primary-gradient);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
    box-shadow: 0.125rem 0 0.625rem rgba(0,0,0,0.1);
}

.sidebar.collapsed {
    width: 4.375rem;
}

.sidebar-header {
    padding: 1.25rem;
    text-align: center;
    border-bottom: 0.0625rem solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .logo i {
    margin-right: 0.625rem;
    font-size: 1.8rem;
}

.sidebar.collapsed .sidebar-header .logo span {
    display: none;
}

.sidebar-nav {
    padding: 1.25rem 0;
}

.nav-item {
    margin-bottom: 0.3125rem;
}

.nav-link {
    color: rgba(255,255,255,0.8);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 0;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(0.3125rem);
}

.nav-link.active {
    background-color: rgba(255,255,255,0.2);
    color: white;
    border-right: 0.1875rem solid white;
}

.nav-link i {
    width: 1.25rem;
    margin-right: 0.75rem;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
}

/* 主内容区域 */
.main-content {
    margin-left: 16.25rem;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.sidebar.collapsed + .main-content {
    margin-left: 4.375rem;
}

/* 顶部导航栏 */
.top-navbar {
    background: white;
    border-bottom: 0.0625rem solid var(--border-color);
    padding: 0.9375rem 1.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 999;
}

.navbar-left {
    display: flex;
    align-items: center;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--dark-color);
    margin-right: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: var(--light-color);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--dark-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.notification-btn:hover {
    background-color: var(--light-color);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 1.125rem;
    height: 1.125rem;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.user-menu:hover {
    background-color: var(--light-color);
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    margin-right: 0.625rem;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--dark-color);
}

.user-role {
    font-size: 0.75rem;
    color: #6c757d;
}

/* 页面内容 */
.page-content {
    padding: 1.875rem;
}

.page-header {
    margin-bottom: 1.875rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.625rem;
}

.breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
}

.breadcrumb-item {
    font-size: 0.9rem;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* 卡片样式 */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.875rem;
    overflow: hidden;
}

.card-header {
    background: white;
    border-bottom: 0.0625rem solid var(--border-color);
    padding: 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: var(--light-color);
    border-top: 0.0625rem solid var(--border-color);
    padding: 0.9375rem 1.25rem;
}

/* 统计卡片 */
.stats-card {
    background: var(--primary-gradient);
    color: white;
    padding: 1.5625rem;
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-0.3125rem);
    box-shadow: var(--shadow-lg);
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 6.25rem;
    height: 6.25rem;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(1.875rem, -1.875rem);
}

.stats-icon {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 2.5rem;
    opacity: 0.3;
}

.stats-content {
    position: relative;
    z-index: 1;
}

.stats-number {
    font-size: 2.2rem;
    font-weight: bold;
    margin-bottom: 0.3125rem;
}

.stats-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.625rem;
}

.stats-change {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.stats-change i {
    margin-right: 0.3125rem;
}

/* 按钮样式 */
.btn {
    border-radius: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-0.125rem);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-0.125rem);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-0.125rem);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: white;
}

.btn-info:hover {
    transform: translateY(-0.125rem);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-outline-primary {
    border: 0.125rem solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

/* 表格样式 */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    border-bottom: 0.125rem solid var(--border-color);
    font-weight: 600;
    color: var(--dark-color);
    background-color: var(--light-color);
    padding: 0.9375rem;
}

.table td {
    padding: 0.9375rem;
    vertical-align: middle;
    border-bottom: 0.0625rem solid #f1f3f4;
}

.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

/* 响应式表格样式 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

/* 移动端响应式表格优化 */
@media (max-width: 48rem) {
    .table-responsive {
        border: none;
        box-shadow: none;
    }
    
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block;
    }
    
    .table-responsive thead tr {
        position: absolute;
        top: -624.9375rem;
        left: -624.9375rem;
    }
    
    .table-responsive tr {
        border: 0.0625rem solid #ccc;
        margin-bottom: 0.625rem;
        padding: 0.625rem;
        border-radius: 0.5rem;
        background: white;
        box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.1);
    }
    
    .table-responsive td {
        border: none;
        position: relative;
        padding-left: 50% !important;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        text-align: left;
    }
    
    .table-responsive td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0.375rem;
        width: 45%;
        padding-right: 0.625rem;
        white-space: nowrap;
        font-weight: bold;
        color: #666;
        text-align: left;
    }
}

/* 表单样式 */
.form-control {
    border: 0.125rem solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-select {
    border: 0.125rem solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* 徽章样式 */
.badge {
    padding: 0.375rem 0.75rem;
    border-radius: 1.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge.bg-success {
    background: var(--success-color) !important;
}

.badge.bg-warning {
    background: var(--warning-color) !important;
}

.badge.bg-danger {
    background: var(--danger-color) !important;
}

.badge.bg-info {
    background: var(--info-color) !important;
}

.badge.bg-primary {
    background: var(--primary-color) !important;
}

/* 分页样式 */
.pagination {
    margin: 0;
}

.page-link {
    border: none;
    color: var(--primary-color);
    padding: 0.625rem 0.9375rem;
    margin: 0 0.125rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.page-link:hover {
    background-color: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

.page-item.active .page-link {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
}

/* 下拉菜单样式 */
.dropdown-menu {
    border: none;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    padding: 0.625rem 0;
}

.dropdown-item {
    padding: 0.625rem 1.25rem;
    transition: all 0.3s ease;
    border-radius: 0;
}

.dropdown-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

.dropdown-divider {
    margin: 0.5rem 0;
}

/* 消息提示样式 */
.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 0.9375rem 1.25rem;
    margin-bottom: 1.25rem;
}

.alert-success {
    background: linear-gradient(135deg, rgba(56, 239, 125, 0.1) 0%, rgba(17, 153, 142, 0.1) 100%);
    color: #0f5132;
    border-left: 0.25rem solid var(--success-color);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 83, 80, 0.1) 0%, rgba(244, 67, 54, 0.1) 100%);
    color: #842029;
    border-left: 0.25rem solid var(--danger-color);
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 167, 38, 0.1) 0%, rgba(255, 193, 7, 0.1) 100%);
    color: #664d03;
    border-left: 0.25rem solid var(--warning-color);
}

.alert-info {
    background: linear-gradient(135deg, rgba(38, 198, 218, 0.1) 0%, rgba(0, 188, 212, 0.1) 100%);
    color: #055160;
    border-left: 0.25rem solid var(--info-color);
}

/* 工具提示样式 */
.tooltip {
    font-size: 0.8rem;
}

.tooltip-inner {
    background: var(--dark-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
}

/* 模态框样式 */
.modal-content {
    border: none;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 0.0625rem solid var(--border-color);
    padding: 1.25rem;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    border-top: 0.0625rem solid var(--border-color);
    padding: 1.25rem;
}

/* 响应式设计 */
@media (max-width: 48rem) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .page-content {
        padding: 1.25rem;
    }
    
    .stats-card {
        margin-bottom: 0.9375rem;
    }
    
    .card-body {
        padding: 0.9375rem;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
}

@media (max-width: 36rem) {
    .page-content {
        padding: 0.9375rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stats-number {
        font-size: 1.8rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(1.25rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 0.1875rem solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 0.5rem;
    height: 0.5rem;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0.25rem;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 0.25rem;
}

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

/* 打印样式 */
@media print {
    .sidebar,
    .top-navbar,
    .btn,
    .pagination {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .page-content {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 0.0625rem solid #ddd !important;
    }
}

/* 修复白色字体和浅色字体可见性问题 */
.text-white-fix {
    color: #2c3e50 !important;
}

/* 在白色背景下确保文本可见 */
.bg-white .text-white,
.bg-light .text-white,
.card .text-white,
.modal-content .text-white {
    color: #2c3e50 !important;
}

/* 修复浅色文本 */
.text-muted {
    color: #6c757d !important;
}

.text-light {
    color: #6c757d !important;
}

.text-secondary {
    color: #6c757d !important;
}

/* 确保在白色背景下的对比度 */
.bg-white .text-muted,
.bg-light .text-muted,
.card .text-muted,
.modal-content .text-muted {
    color: #6c757d !important;
}

.bg-white .text-light,
.bg-light .text-light,
.card .text-light,
.modal-content .text-light {
    color: #6c757d !important;
}

.bg-white .text-secondary,
.bg-light .text-secondary,
.card .text-secondary,
.modal-content .text-secondary {
    color: #6c757d !important;
}

/* 修复特定的白色文本问题 */
.text-white:not(.btn):not(.badge):not(.alert) {
    color: #2c3e50 !important;
}

/* 确保按钮和徽章保持原有样式 */
.btn.text-white,
.badge.text-white,
.alert.text-white {
    color: white !important;
}

/* 修复内联样式的白色文本 */
[style*="color: white"],
[style*="color: #fff"],
[style*="color: #ffffff"],
[style*="color:#fff"],
[style*="color:#ffffff"] {
    color: #2c3e50 !important;
}

/* 修复浅色内联样式 */
[style*="color: #ccc"],
[style*="color: #ddd"],
[style*="color: #eee"],
[style*="color: lightgray"],
[style*="color: lightgrey"] {
    color: #6c757d !important;
}

/* 特殊情况：保持导航栏和侧边栏的白色文本 */
.navbar .text-white,
.sidebar .text-white,
.bg-primary .text-white,
.bg-dark .text-white,
.bg-success .text-white,
.bg-danger .text-white,
.bg-warning .text-white,
.bg-info .text-white {
    color: white !important;
}

/* 修复透明度过低的文本 */
[style*="opacity: 0.1"],
[style*="opacity: 0.2"],
[style*="opacity: 0.3"],
[style*="opacity: 0.4"],
[style*="opacity: 0.5"] {
    opacity: 0.8 !important;
}

/* 修复RGBA透明度过低的文本 */
[style*="rgba(255,255,255,0.1)"],
[style*="rgba(255,255,255,0.2)"],
[style*="rgba(255,255,255,0.3)"],
[style*="rgba(255,255,255,0.4)"],
[style*="rgba(255,255,255,0.5)"] {
    color: rgba(44, 62, 80, 0.8) !important;
}