/* 云易数字色卡系统 - 精简优化版样式 */
/* 版本: 2.0.2 */

/* 基础样式重置 */
body {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: pan-y pinch-zoom;
    margin: 0;
    padding: 0;
}

/* 玻璃拟态效果 */
.glass-effect {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border-radius: 16px;
}

/* 颜色预览区域 */
.color-preview {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.4s ease;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
}

/* 按钮主样式 */
.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

/* 输入框增强 */
.input-enhanced {
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.9);
}

.input-enhanced:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: white;
}

/* 网格背景 */
.grid-pattern {
    background-color: #f8fafc;
    background-image: 
        linear-gradient(#e2e8f0 1px, transparent 1px),
        linear-gradient(90deg, #e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
}

/* 动画效果 */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 卡片悬停效果 */
.card-hover {
    transition: all 0.3s ease;
}

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

/* 光源选择器 */
.illuminant-option {
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.illuminant-option.active {
    background-color: #6366f1;
    color: white;
    border-color: #6366f1;
}

.illuminant-option:not(.active):hover {
    background-color: #f3f4f6;
}

/* 颜色对比响应式布局 */
.color-comparison-responsive {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.color-sample-responsive {
    flex: 1;
    min-height: 120px;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.color-sample-content {
    text-align: center;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 2;
    position: relative;
}

.color-sample-title {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 8px;
    display: block;
}

.color-sample-lab {
    font-size: 0.9em;
    opacity: 0.9;
    display: block;
    margin-bottom: 4px;
}

.color-sample-info {
    font-size: 0.8em;
    opacity: 0.8;
    display: block;
}

.color-sample-range {
    font-size: 0.7rem;
    opacity: 0.8;
    margin-top: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 色差指示器 */
.delta-e-indicator {
    position: relative;
    height: 8px;
    background: linear-gradient(to right, #10b981, #f59e0b, #f97316, #ef4444);
    border-radius: 4px;
    margin: 8px 0;
}

.delta-e-marker {
    position: absolute;
    top: -4px;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid #374151;
    border-radius: 50%;
    transform: translateX(-50%);
    transition: left 0.5s ease;
}

/* 自定义滚动条 */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Lab输入行布局 */
.lab-input-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 徽章样式 */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* 加载动画 */
.loader {
    border: 4px solid rgba(243, 244, 246, 0.8);
    border-top: 4px solid #6366f1;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1.5s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 结果项样式 - 统一匹配和检索结果 */
.result-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 80px;
}

.result-item:hover {
    background-color: rgba(99, 102, 241, 0.08);
    transform: translateX(8px);
    border-color: rgba(99, 102, 241, 0.2);
}

/* 颜色块样式 */
.color-block-large {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    flex-shrink: 0;
    margin-right: 1rem;
    position: relative;
    overflow: hidden;
}

.color-block-mobile {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    flex-shrink: 0;
    margin-right: 0.75rem;
    position: relative;
    overflow: hidden;
}

/* Lab值行布局 */
.lab-values-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lab-values-mobile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lab-value-item {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-radius: 0.3rem;
    padding: 0.2rem 0.3rem;
    border: 1px solid #e5e7eb;
}

.lab-value-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-right: 0.25rem;
    font-weight: 500;
}

.lab-value-number {
    font-size: 0.8rem;
    color: #1f2937;
    font-weight: 700;
}

/* 结果项第二行（移动端） */
.result-item-second-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.card-info-mobile {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 0.5rem;
}

/* 色差徽章颜色 */
.badge.bg-gradient-to-r.from-green-500.to-green-600 {
    background: linear-gradient(135deg, #10b981, #059669);
}

.badge.bg-gradient-to-r.from-green-400.to-yellow-500 {
    background: linear-gradient(135deg, #34d399, #eab308);
}

.badge.bg-gradient-to-r.from-yellow-500.to-orange-500 {
    background: linear-gradient(135deg, #eab308, #f97316);
}

.badge.bg-gradient-to-r.from-orange-500.to-red-500 {
    background: linear-gradient(135deg, #f97316, #ef4444);
}

/* 色卡选择指示器 */
#cardSelectionIndicator {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 12px;
}

/* 响应式设计 */
@media (min-width: 768px) {
    .color-comparison-responsive {
        flex-direction: row;
    }
    
    .lab-input-row {
        flex-direction: row;
    }
    
    /* 桌面端结果项布局 */
    .result-item.expanded-layout {
        padding: 1.25rem;
    }
    
    .result-item.expanded-layout .color-block-large {
        width: 100px;
        height: 100px;
        margin-right: 1.5rem;
    }
}

@media (max-width: 768px) {
    /* 移动端优化 */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .glass-effect {
        padding: 1.25rem;
        border-radius: 1rem;
    }
    
    .color-preview {
        height: 100px;
    }
    
    .result-item {
        padding: 0.75rem;
        min-height: 70px;
    }
    
    .btn-primary {
        padding: 0.75rem;
        font-size: 0.875rem;
        min-height: 44px;
    }
    
    /* 移动端Lab输入框紧凑布局 */
    .lab-input-compact {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    /* 超小屏幕优化 */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .glass-effect {
        padding: 1rem;
    }
    
    .result-item {
        padding: 0.6rem;
        min-height: 60px;
    }
    
    .color-block-mobile {
        width: 40px;
        height: 40px;
        margin-right: 0.6rem;
    }
    
    .lab-values-mobile {
        gap: 0.3rem;
    }
    
    .lab-value-item {
        padding: 0.15rem 0.25rem;
    }
    
    .lab-value-label {
        font-size: 0.65rem;
    }
    
    .lab-value-number {
        font-size: 0.7rem;
    }
}

/* Safari特定修复 */
@media not all and (min-resolution:.001dpcm) { 
    .glass-effect {
        -webkit-backdrop-filter: blur(12px);
    }
}

/* 确保按钮可点击 */
button {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* 输入框数字调整按钮隐藏 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}