/* 成分猫 - 主样式表 */

/* 全局样式 */
:root {
    --primary-color: rgb(61, 178, 233);
    --primary-light: rgba(61, 178, 233, 0.1);
    --primary-dark: rgb(45, 150, 210);
    --secondary-color: rgb(108, 117, 125);
    --accent-color: rgb(255, 107, 107);
    --light-color: #ffffff;
    --bg-color: #fafbfc;
    --dark-color: #1a1a1a;
    --text-color: #2d3748;
    --text-light: #718096;
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --box-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--text-color);
    line-height: 1.7;
    background-color: var(--bg-color);
    font-size: 16px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 链接样式 */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

/* 按钮样式 */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
    letter-spacing: 0.025em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(61, 178, 233, 0.39);
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(61, 178, 233, 0.5);
    color: white;
}

.btn-outline-primary {
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    border: 0px ;
    box-shadow: 0 6px 20px 0 rgba(61, 178, 233, 0.4);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* 导航栏样式 */
.navbar {
    padding: 1rem 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--dark-color) !important;
    display: flex;
    align-items: center;
}

.navbar-brand img {
    width: 220px;
    height: 80px;
    object-fit: contain;
}

.navbar .nav-link {
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    color: var(--text-color);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    margin: 0 0.25rem;
}

.navbar .nav-link:hover {
    color: var(--primary-color);
    background-color: var(--primary-light);
}

.navbar .nav-link.active {
    color: var(--primary-color);
    background-color: var(--primary-light);
    font-weight: 600;
}

.nav-search {
    width: 100%;
    max-width: 400px;
}

.nav-search .form-control {
    border-radius: 25px;
    border: 2px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    transition: var(--transition);
}

.nav-search .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(61, 178, 233, 0.1);
}

/* 卡片样式 */
.card {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    overflow: hidden;
    background: var(--light-color);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--box-shadow-lg);
    border-color: rgba(61, 178, 233, 0.2);
}

.card-header {
    background: linear-gradient(135deg, rgba(61, 178, 233, 0.05) 0%, rgba(61, 178, 233, 0.02) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-weight: 600;
    color: var(--light-color);
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.card-text {
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* 首页特色区域 */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 4rem 0;
    border-radius: var(--border-radius);
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    opacity: 0.3;
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-weight: 700;
    font-size: 2.75rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -0.025em;
}

.hero-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    line-height: 1.5;
    margin-bottom: 2.5rem;
    font-weight: 400;
}

/* 搜索表单样式 */
.hero-search-wrapper {
    max-width: 480px;
    margin: 0 auto;
}

.hero-search-form {
    width: 100%;
}

.search-input-wrapper {
    margin-bottom: 1.5rem;
}

.hero-search-input {
    border: none;
    border-radius: 50px;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.98);
    color: var(--dark-color);
    width: 100%;
    transition: var(--transition);
}

.hero-search-input:focus {
    outline: none;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
    background: white;
}

.hero-search-input::placeholder {
    color: #6c757d;
    opacity: 0.8;
}

.search-button-wrapper {
    display: flex;
    justify-content: center;
}

.hero-search-btn {
    /* border-radius: 50px; */
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: white;
    color: var(--primary-color);
    border: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.hero-search-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    color: var(--primary-dark);
}

.hero-search-btn:active {
    transform: translateY(-1px);
}

.hero-analyzer-btn {
    /* border-radius: 50px; */
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.hero-analyzer-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    color: white;
    border-color: white;
    text-decoration: none;
}

.hero-analyzer-btn:active {
    transform: translateY(-1px);
}

/* 成分卡片 */
.ingredient-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.ingredient-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--box-shadow-lg);
    border-color: var(--primary-color);
}

.ingredient-card .card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.ingredient-card .card-text {
    flex-grow: 1;
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
}

.ingredient-card .card-title {
    color: var(--dark-color);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.ingredient-card .card-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* 安全评级标签 */
.safety-badge {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.025em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.safety-low {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.safety-medium {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border: 1px solid #ffeaa7;
}

.safety-high {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 表单样式 */
.form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: var(--transition);
    background-color: var(--light-color);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(61, 178, 233, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-text {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-select {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    background-color: var(--light-color);
    transition: var(--transition);
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(61, 178, 233, 0.1);
}

/* 评论区样式 */
.comments-list {
    margin-bottom: 2rem;
}

.comment-item {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    transition: var(--transition);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-item:hover {
    background-color: rgba(61, 178, 233, 0.02);
    border-radius: var(--border-radius-sm);
    margin: 0 -1rem;
    padding: 1.5rem 1rem;
}

.comment-author {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.comment-date {
    font-size: 0.85rem;
    color: var(--text-light);
}

.comment-content {
    color: var(--text-color);
    line-height: 1.6;
    margin-top: 0.5rem;
}

/* 分页样式 */
.pagination {
    gap: 0.5rem;
}

.pagination .page-link {
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: var(--transition);
    margin: 0;
}

.pagination .page-link:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(61, 178, 233, 0.39);
}

.pagination .page-item.disabled .page-link {
    color: var(--text-light);
    background-color: var(--bg-color);
    border-color: var(--border-color);
}

/* 面包屑导航 */
.breadcrumb {
    background: transparent;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item {
    font-size: 0.9rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    color: var(--text-light);
}

.breadcrumb-item a {
    color: var(--text-light);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--text-color);
    font-weight: 500;
}

/* 警告框样式 */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-info {
    background: linear-gradient(135deg, rgba(61, 178, 233, 0.1) 0%, rgba(61, 178, 233, 0.05) 100%);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.alert-success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(40, 167, 69, 0.05) 100%);
    color: #155724;
    border-left-color: #28a745;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.05) 100%);
    color: #721c24;
    border-left-color: #dc3545;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
    color: #856404;
    border-left-color: #ffc107;
}

/* 响应式调整 */
@media (max-width: 767.98px) {
    .hero-section {
        padding: 3rem 0;
        margin-bottom: 2rem;
    }
    
    .hero-title {
        font-size: 2.2rem;
        margin-bottom: 1.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }
    
    .hero-search-wrapper {
        max-width: 100%;
        padding: 0 1rem;
    }
    
    .hero-search-input {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .hero-search-btn {
        padding: 0.875rem 2.5rem;
        font-size: 1rem;
    }
    
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar .nav-link {
        padding: 0.5rem 0.75rem;
        margin: 0.25rem 0;
    }
    
    .nav-search {
        margin: 1rem 0;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* 移动端navbar样式 */
@media (max-width: 991.98px) {
    .navbar {
        padding: 0.5rem 0;
    }
    
    .navbar .container {
        position: relative;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
    }
    
    .navbar-brand {
        flex: 1;
        justify-content: center;
        margin: 0;
        padding: 0.5rem 0;
        order: 2;
        width: 100%;
    }
    
    .navbar-brand img {
        width: 160px;
        height: 58px;
    }
    
    .navbar-toggler {
        position: absolute;
        right: 0;
        top: 0;
        z-index: 1000;
        border: none;
        padding: 0.5rem;
        order: 1;
    }
    
    .navbar-collapse {
        width: 100%;
        order: 3;
        margin-top: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand img {
        width: 160px;
        height: 58px;
    }
    
    .hero-section {
        padding: 2.5rem 0;
    }
    
    .hero-title {
        font-size: 1.9rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.75rem;
        padding: 0 0.5rem;
    }
    
    .hero-search-wrapper {
        padding: 0 0.5rem;
    }
    
    .search-input-wrapper {
        margin-bottom: 1.25rem;
    }
    
    .hero-search-input {
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
        border-radius: 40px;
    }
    
    .hero-search-btn {
        padding: 0.875rem 2rem;
        font-size: 0.95rem;
        border-radius: 40px;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .pagination .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 1.7rem;
        margin-bottom: 0.875rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        padding: 0 1rem;
    }
    
    .hero-search-wrapper {
        padding: 0;
    }
    
    .search-input-wrapper {
        margin-bottom: 1rem;
    }
    
    .hero-search-input {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    .hero-search-btn {
        padding: 0.75rem 1.75rem;
        font-size: 0.9rem;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}