/* 组件化CSS - 可扩展的UI组件样式 */

/* ==================== 按钮组件 ==================== */
.btn-group-custom {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon i {
    font-size: 0.875em;
}

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

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==================== 卡片组件 ==================== */
.card-enhanced {
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card-enhanced:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-enhanced .card-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

.card-stats {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    border: none;
}

.card-stats .card-body {
    position: relative;
    overflow: hidden;
}

.card-stats::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

.card-stats:hover::before {
    top: -25%;
    right: -25%;
}

/* ==================== 表单组件 ==================== */
.form-group-enhanced {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-control-enhanced {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control-enhanced:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.form-floating-custom {
    position: relative;
}

.form-floating-custom label {
    position: absolute;
    top: 0.75rem;
    left: 1rem;
    padding: 0 0.5rem;
    background: white;
    color: #6c757d;
    font-size: 1rem;
    transition: all 0.3s ease;
    pointer-events: none;
}

.form-floating-custom input:focus + label,
.form-floating-custom input:not(:placeholder-shown) + label {
    top: -0.5rem;
    font-size: 0.875rem;
    color: var(--primary-color);
}

/* ==================== 选项组件 ==================== */
.option-group {
    display: grid;
    gap: 1rem;
    margin: 1.5rem 0;
}

.option-item {
    position: relative;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.option-item:hover {
    border-color: #c6d3e8;
    background-color: #f8f9fa;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-item input:checked + .option-content {
    color: var(--primary-color);
    font-weight: 600;
}

.option-item input:checked {
    & ~ .option-indicator::before {
        transform: scale(1);
        opacity: 1;
    }
}

.option-item.selected {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
}

.option-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    font-size: 1.1rem;
    line-height: 1.5;
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: #e9ecef;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.875rem;
    color: #495057;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.option-item.selected .option-letter {
    background: var(--primary-color);
    color: white;
}

/* ==================== 统计组件 ==================== */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0.5rem 0;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

/* ==================== 进度组件 ==================== */
.progress-enhanced {
    height: 1.5rem;
    background: #e9ecef;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
}

.progress-bar-enhanced {
    height: 100%;
    background: linear-gradient(45deg, var(--primary-color), #0056b3);
    border-radius: 1rem;
    position: relative;
    overflow: hidden;
    transition: width 0.8s ease;
}

.progress-bar-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
}

/* ==================== 徽章组件 ==================== */
.badge-enhanced {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-difficulty-1 { background: rgba(40, 167, 69, 0.1); color: #28a745; }
.badge-difficulty-2 { background: rgba(255, 193, 7, 0.1); color: #ffc107; }
.badge-difficulty-3 { background: rgba(220, 53, 69, 0.1); color: #dc3545; }

/* ==================== 导航组件 ==================== */
.nav-tabs-custom {
    border: none;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 0.25rem;
}

.nav-tabs-custom .nav-link {
    border: none;
    border-radius: var(--border-radius);
    color: #6c757d;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-tabs-custom .nav-link:hover {
    color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

.nav-tabs-custom .nav-link.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

/* ==================== 模态框组件 ==================== */
.modal-enhanced .modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    overflow: hidden;
}

.modal-enhanced .modal-header {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    border: none;
}

.modal-enhanced .modal-title {
    font-weight: 600;
}

.modal-enhanced .btn-close {
    filter: brightness(0) invert(1);
}

/* ==================== 列表组件 ==================== */
.list-group-enhanced .list-group-item {
    border: none;
    border-left: 4px solid transparent;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.list-group-enhanced .list-group-item:hover {
    border-left-color: var(--primary-color);
    background-color: #f8f9fa;
    transform: translateX(4px);
}

.list-group-enhanced .list-group-item.active {
    border-left-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
}

/* ==================== 分页组件 ==================== */
.pagination-enhanced .page-link {
    border: none;
    margin: 0 0.125rem;
    border-radius: var(--border-radius);
    color: #6c757d;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination-enhanced .page-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.pagination-enhanced .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

/* ==================== 响应式工具 ==================== */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .option-group {
        gap: 0.75rem;
    }
    
    .option-item {
        padding: 0.75rem;
    }
    
    .option-content {
        font-size: 1rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .btn-group-custom {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group-custom .btn {
        width: 100%;
    }
}

/* ==================== 工具类 ==================== */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.shadow-custom {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.shadow-custom-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
