/**
 * Modal Dialog Styles - 模态对话框样式
 * 支持缺陷记录、参数配置、登录注册等表单
 */

/* ============================================================================
   模态遮罩层
   ============================================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================================
   模态内容
   ============================================================================ */
.modal-content {
    background: var(--bg-dark);
    border: 3px solid var(--primary-orange);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        var(--shadow-lg),
        0 0 40px rgba(255, 107, 0, 0.4);
    animation: slideUp 0.3s ease;
}

.modal-content.modal-large {
    max-width: 900px;
}

.modal-content.modal-small {
    max-width: 400px;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================================================
   模态头部
   ============================================================================ */
.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #2a2a2a 0%, #1f1f1f 100%);
}

.modal-header h3 {
    color: var(--primary-orange);
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.btn-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-light);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-close:hover {
    background: var(--error-red);
    border-color: var(--error-red);
    transform: rotate(90deg);
}

/* ============================================================================
   模态表单
   ============================================================================ */
.modal-content form {
    padding: var(--spacing-lg);
}

/* 配置段落 */
.config-section {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--bg-medium);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-orange);
}

.config-section h4 {
    color: var(--primary-orange);
    font-size: 16px;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
}

.config-section small {
    display: block;
    color: var(--text-dim);
    font-size: 11px;
    margin-top: 4px;
}

/* 增益显示 */
#gain-display-1,
#gain-display-2 {
    display: inline-block;
    margin-left: 10px;
    padding: 4px 12px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    color: var(--success-green);
    font-family: var(--font-mono);
    font-weight: bold;
}

/* 滑块样式 */
input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-orange);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 107, 0, 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-orange);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(255, 107, 0, 0.6);
}

/* 严重程度选择器 */
.severity-selector {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.severity-selector label {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm);
    background: var(--bg-medium);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.severity-selector label:hover {
    border-color: var(--primary-orange);
    background: var(--bg-light);
}

.severity-selector input[type="radio"] {
    margin-right: var(--spacing-sm);
    accent-color: var(--primary-orange);
}

.severity-selector label:has(input:checked) {
    border-color: var(--primary-orange);
    background: var(--bg-light);
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.3);
}

/* ============================================================================
   缺陷列表
   ============================================================================ */
.defect-item {
    background: var(--bg-medium);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.defect-item:hover {
    border-color: var(--primary-orange);
    transform: translateX(4px);
}

.defect-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.defect-number {
    background: var(--primary-orange);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-weight: bold;
    font-size: 12px;
}

.defect-type {
    flex: 1;
    font-weight: 600;
    color: var(--text-light);
}

.defect-severity {
    font-size: 14px;
}

.defect-info {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.defect-desc {
    font-size: 12px;
    color: var(--text-light);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-dim);
}

/* ============================================================================
   统计卡片
   ============================================================================ */
.stat-card {
    background: var(--bg-medium);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: var(--spacing-xs);
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-light);
    font-family: var(--font-mono);
}

.stat-value.stat-good {
    color: var(--success-green);
}

.stat-value.stat-bad {
    color: var(--error-red);
}

/* ============================================================================
   图表容器
   ============================================================================ */
#defect-type-chart,
#defect-severity-chart {
    width: 100%;
    height: 300px;
    margin-top: var(--spacing-md);
}

/* ============================================================================
   响应式
   ============================================================================ */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-content.modal-large,
    .modal-content.modal-small {
        max-width: none;
    }
    
    .severity-selector {
        font-size: 12px;
    }
}