/* GAG Recipes - 计算器布局专项优化 */

/* === 计算器整体布局增强 === */
.calculator-section {
    padding: var(--space-12) 0;
    background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);
    min-height: 80vh;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
    max-width: 1400px;
    margin: 0 auto;
}

/* === 面板基础样式增强 === */
.calculator-panel,
.results-panel {
    background: white;
    border-radius: var(--border-radius-2xl);
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: var(--space-8);
    transition: all 0.3s ease;
    border: 1px solid rgba(229, 231, 235, 0.8);
}

.calculator-panel:hover,
.results-panel:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* === 面板头部样式 === */
.panel-header {
    margin-bottom: var(--space-8);
    text-align: center;
    position: relative;
}

.panel-header::after {
    content: '';
    position: absolute;
    bottom: -var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-500), var(--secondary-500));
    border-radius: 2px;
}

.panel-header h2 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
    background: linear-gradient(135deg, var(--gray-900), var(--gray-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.panel-header p {
    color: var(--gray-600);
    font-size: var(--font-size-base);
    font-weight: 500;
}

/* === 表单输入组优化 === */
.input-group {
    margin-bottom: var(--space-6);
    position: relative;
}

.input-group label {
    display: block;
    font-weight: 600;
    color: var(--gray-800);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    
    /* 增强文字清晰度 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* === 表单控件增强 === */
.form-input,
.form-select {
    width: 100%;
    padding: var(--space-4) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    font-size: var(--font-size-base);
    font-weight: 500;
    background: white;
    transition: all 0.2s ease;
    
    /* 文字清晰度优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--gray-800);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.form-input:hover,
.form-select:hover {
    border-color: var(--gray-300);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* === 食材选择器优化 === */
.ingredients-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--space-4);
    background: var(--gray-50);
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--gray-200);
}

.ingredient-item {
    display: flex;
    align-items: center;
    padding: var(--space-3);
    background: white;
    border-radius: var(--border-radius-md);
    border: 2px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}

.ingredient-item:hover {
    border-color: var(--primary-200);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ingredient-item.special {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: var(--accent-500);
}

.ingredient-item input[type="checkbox"] {
    margin-right: var(--space-3);
    width: 18px;
    height: 18px;
    accent-color: var(--primary-500);
}

.ingredient-item label {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    flex: 1;
    margin-bottom: 0;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 500;
}

.ingredient-item img {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-md);
    object-fit: cover;
}

.quantity-input {
    width: 60px;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    text-align: center;
    font-size: var(--font-size-sm);
    margin-left: auto;
}

/* === 计算按钮超级增强 === */
.calculate-btn {
    width: 100%;
    padding: var(--space-5) var(--space-6);
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius-xl);
    font-size: var(--font-size-lg);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    
    /* 3D效果 */
    box-shadow: 
        0 4px 6px -1px rgba(59, 130, 246, 0.3),
        0 2px 4px -1px rgba(59, 130, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    
    /* 文字增强 */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* 图标和文字布局 */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    
    /* 动画效果 */
    position: relative;
    overflow: hidden;
}

.calculate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 15px -3px rgba(59, 130, 246, 0.4),
        0 4px 6px -2px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
}

.calculate-btn:hover::before {
    left: 100%;
}

.calculate-btn:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 4px -1px rgba(59, 130, 246, 0.4),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calculate-btn img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

/* === 结果区域优化 === */
.results-content {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--gray-500);
}

.empty-state img {
    width: 80px;
    height: 80px;
    margin-bottom: var(--space-6);
    opacity: 0.6;
}

.empty-state h3 {
    font-size: var(--font-size-xl);
    color: var(--gray-700);
    margin-bottom: var(--space-4);
}

.empty-state p {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    max-width: 300px;
    margin: 0 auto;
}

/* === 结果摘要增强 === */
.results-summary {
    margin-top: var(--space-6);
    padding: var(--space-6);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--secondary-50) 100%);
    border-radius: var(--border-radius-xl);
    border: 2px solid var(--primary-100);
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.stat {
    text-align: center;
    padding: var(--space-4);
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.stat-value {
    display: block;
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary-600);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* === 工具头部区域 === */
.tool-hero {
    padding: var(--space-16) 0 var(--space-8);
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.tool-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.03)"/><circle cx="20" cy="80" r="0.5" fill="rgba(255,255,255,0.03)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    position: relative;
    z-index: 1;
}

.tool-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-2xl);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.tool-icon img {
    width: 48px;
    height: 48px;
    filter: brightness(0) invert(1);
}

.tool-info h1 {
    font-size: var(--font-size-4xl);
    font-weight: 800;
    margin-bottom: var(--space-4);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tool-info p {
    font-size: var(--font-size-lg);
    opacity: 0.9;
    line-height: var(--line-height-relaxed);
    max-width: 600px;
}

/* === 响应式设计 === */
@media (max-width: 1024px) {
    .calculator-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
    
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .calculator-panel,
    .results-panel {
        padding: var(--space-6);
    }
    
    .tool-header {
        flex-direction: column;
        text-align: center;
        gap: var(--space-4);
    }
    
    .tool-info h1 {
        font-size: var(--font-size-3xl);
    }
    
    .ingredients-selector {
        grid-template-columns: 1fr;
        max-height: 300px;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
}

@media (max-width: 640px) {
    .calculator-section {
        padding: var(--space-8) 0;
    }
    
    .tool-hero {
        padding: var(--space-12) 0 var(--space-6);
    }
    
    .calculate-btn {
        padding: var(--space-4) var(--space-5);
        font-size: var(--font-size-base);
    }
    
    .ingredient-item {
        padding: var(--space-2);
    }
    
    .ingredient-item img {
        width: 24px;
        height: 24px;
    }
}

/* === 加载状态 === */
.calculate-btn.loading {
    background: var(--gray-400);
    cursor: not-allowed;
    transform: none;
}

.calculate-btn.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: var(--space-2);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === 暗色模式支持 === */
@media (prefers-color-scheme: dark) {
    .calculator-section {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    }
    
    .calculator-panel,
    .results-panel {
        background: #1f2937;
        border-color: #374151;
        color: white;
    }
    
    .form-input,
    .form-select {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
    
    .ingredients-selector {
        background: #374151;
        border-color: #4b5563;
    }
    
    .ingredient-item {
        background: #4b5563;
        color: white;
    }
}

/* === 高对比度模式 === */
@media (prefers-contrast: high) {
    .calculator-panel,
    .results-panel {
        border: 3px solid #000000;
    }
    
    .calculate-btn {
        background: #000000;
        border: 2px solid #ffffff;
    }
    
    .form-input,
    .form-select {
        border: 2px solid #000000;
    }
}

/* === 减少动画偏好 === */
@media (prefers-reduced-motion: reduce) {
    .calculator-panel,
    .results-panel,
    .calculate-btn,
    .form-input,
    .form-select,
    .ingredient-item {
        transition: none;
        transform: none;
    }
    
    .calculate-btn::before {
        display: none;
    }
    
    .loading {
        animation: none;
    }
}
