/**
 * 分配验证功能样式文件
 * allocation-validation.css
 * 
 * 专门用于管辖区分配比例验证功能的样式
 * 配合 page-interactions.js 中的分配验证逻辑使用
 */

/* ===== 🎯 分配状态面板样式 ===== */

.allocation-status-panel {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.allocation-status-panel:hover {
    border-color: #3b82f6;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.1);
}

/* ===== 状态面板头部 ===== */

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.status-header h5 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== 验证指示器 ===== */

.validation-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.validation-indicator.pending {
    background: rgba(255, 255, 255, 0.2);
    color: #f1f5f9;
}

.validation-indicator.valid {
    background: rgba(16, 185, 129, 0.2);
    color: #ecfdf5;
    animation: pulse-success 2s ease-in-out infinite;
}

.validation-indicator.invalid {
    background: rgba(239, 68, 68, 0.2);
    color: #fef2f2;
    animation: pulse-error 2s ease-in-out infinite;
}

@keyframes pulse-success {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

@keyframes pulse-error {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.95; }
}

/* ===== 状态内容区域 ===== */

.status-content {
    padding: 1.5rem;
}

/* ===== 分配摘要网格 ===== */

.allocation-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
}

.summary-item label {
    font-weight: 600;
    color: #374151;
}

.summary-item span {
    font-weight: 700;
    color: #1f2937;
}

/* ===== 验证消息 ===== */

.validation-message {
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
    line-height: 1.5;
    border-left: 4px solid;
}

.validation-message.success {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}

.validation-message.error {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}

.validation-message.warning {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}

/* ===== 🎯 分配配置区域样式 ===== */

/* 分配配置区域 */
.allocation-config-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e5e7eb;
}

.section-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-subtitle i {
    color: #3b82f6;
}

/* 分配网格 */
.allocation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* 必填字段标识 */
.form-label.required::after {
    content: ' *';
    color: #ef4444;
    font-weight: bold;
}

/* 分配输入字段特殊样式 */
.allocation-input {
    border: 2px solid #d1d5db;
    transition: all 0.3s ease;
}

.allocation-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.allocation-input[data-validation="allocation"]:valid {
    border-color: #10b981;
}

.allocation-input[data-validation="allocation"]:invalid {
    border-color: #ef4444;
}

/* 表单提示文本 */
.form-hint {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
    font-style: italic;
}

/* ===== 🎯 管辖区分配状态显示 ===== */

/* 管辖区分配状态 */
.jurisdiction-allocation-status {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-item label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

/* 分配范围显示 */
.allocation-range-display {
    font-weight: 700;
    color: #1f2937;
    font-family: 'Courier New', monospace;
}

/* 分配状态显示 */
.allocation-status-display {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.allocation-status-display.pending {
    background: #f3f4f6;
    color: #6b7280;
}

.allocation-status-display.valid {
    background: #dcfce7;
    color: #166534;
}

.allocation-status-display.error {
    background: #fee2e2;
    color: #991b1b;
}

.allocation-status-display.warning {
    background: #fef3c7;
    color: #92400e;
}

/* ===== 🎯 增强的管辖区卡片样式 ===== */

/* 管辖区卡片包装器 */
.jurisdiction-card-wrapper {
    margin-bottom: 2rem;
    position: relative;
    animation: jurisdictionSlideIn 0.4s ease-out;
}

/* 增强的管辖区卡片 */
.jurisdiction-card.enhanced-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e3e8ee;
    border-radius: 16px;
    padding: 0;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.jurisdiction-card.enhanced-card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.12),
        0 4px 8px rgba(0, 0, 0, 0.08);
    border-color: #2563eb;
}

/* 增强的头部区域 */
.enhanced-header {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.enhanced-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4);
    border-radius: 16px 16px 0 0;
}

/* 标题区域 */
.jurisdiction-title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.jurisdiction-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.jurisdiction-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 增强的操作按钮区域 */
.enhanced-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* 增强的操作按钮样式 */
.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 2px solid;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    min-width: 100px;
    justify-content: center;
    background: white;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before {
    left: 100%;
}

/* 重置按钮样式 */
.btn-reset-enhanced {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: #f59e0b;
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-reset-enhanced:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    border-color: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

/* 删除按钮样式 */
.btn-remove-enhanced {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #ef4444;
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-remove-enhanced:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

/* 按钮图标 */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

/* 增强的分隔线 */
.jurisdiction-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
    margin: 0;
}

/* 内容区域 */
.jurisdiction-content {
    padding: 2rem;
}

/* ===== 🎯 动画效果 ===== */

/* 状态变化动画 */
.allocation-status-display,
.validation-indicator,
.summary-item span {
    transition: all 0.3s ease;
}

/* 输入焦点动画 */
.allocation-input {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* 面板悬停效果 */
.jurisdiction-allocation-status:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* 成功状态脉冲动画 */
.allocation-status-display.valid {
    animation: gentle-pulse 3s ease-in-out infinite;
}

@keyframes gentle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* 管辖区卡片滑入动画 */
@keyframes jurisdictionSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 🎯 响应式设计 ===== */

@media (max-width: 768px) {
    /* 分配状态面板 */
    .allocation-status-panel {
        margin-bottom: 1.5rem;
    }
    
    .status-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .status-header h5 {
        font-size: 1.1rem;
    }
    
    .validation-indicator {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* 分配摘要 */
    .allocation-summary {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .summary-item {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    /* 分配网格 */
    .allocation-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* 管辖区状态 */
    .jurisdiction-allocation-status {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .status-item {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }
    
    /* 管辖区卡片 */
    .jurisdiction-card-wrapper {
        margin-bottom: 1.5rem;
    }
    
    .enhanced-header {
        padding: 1rem 1.5rem;
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .jurisdiction-title-section {
        justify-content: center;
    }
    
    .enhanced-actions {
        justify-content: center;
        gap: 0.5rem;
    }
    
    .action-btn {
        flex: 1;
        min-width: auto;
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .jurisdiction-content {
        padding: 1.5rem;
    }
    
    .jurisdiction-content .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .status-content {
        padding: 1rem;
    }
    
    .allocation-config-section {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .form-hint {
        font-size: 0.75rem;
    }
    
    .action-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
}

/* ===== 🎯 辅助工具类 ===== */

/* 隐藏元素 */
.allocation-hidden {
    display: none !important;
}

/* 禁用状态 */
.allocation-disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* 强调状态 */
.allocation-highlight {
    background: #fef3c7 !important;
    border-color: #f59e0b !important;
    animation: highlight-fade 2s ease-out;
}

@keyframes highlight-fade {
    0% { background: #fbbf24; }
    100% { background: #fef3c7; }
}

/* 错误状态强调 */
.allocation-error-highlight {
    background: #fee2e2 !important;
    border-color: #ef4444 !important;
    animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ===== 🎯 无障碍设计 ===== */

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .jurisdiction-card.enhanced-card {
        border-width: 3px;
        border-color: #000;
    }
    
    .action-btn {
        border-width: 3px;
    }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    .jurisdiction-card.enhanced-card,
    .action-btn,
    .jurisdiction-card-wrapper,
    .allocation-status-display,
    .validation-indicator {
        transition: none;
        animation: none;
    }
    
    .jurisdiction-card.enhanced-card:hover,
    .action-btn:hover {
        transform: none;
    }
}

/* 聚焦指示器增强 */
.action-btn:focus-visible,
.allocation-input:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* ===== 🎯 加载和状态指示 ===== */

/* 加载状态 */
.jurisdiction-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.jurisdiction-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* 成功/错误状态指示 */
.jurisdiction-card.success {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.jurisdiction-card.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ===== 🎯 深色模式支持（可选） ===== */
@media (prefers-color-scheme: dark) {
    .allocation-status-panel {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-color: #374151;
    }
    
    .summary-item {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .jurisdiction-allocation-status {
        background: #374151;
        border-color: #4b5563;
    }
    
    .allocation-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .form-hint {
        color: #9ca3af;
    }
}

/* ===== 🎯 打印样式 ===== */
@media print {
    .allocation-status-panel {
        background: white !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
    
    .enhanced-actions {
        display: none !important;
    }
    
    .jurisdiction-card.enhanced-card {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}