/* 基础变量定义 */
:root {
    --primary-color: #0071e3;
    --primary-hover: #0077ed;
    --secondary-color: #6e6e73;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --border-color: #e0e0e0;
    --radius-small: 4px;
    --radius-medium: 8px;
    --radius-large: 12px;
    --shadow: 0 2px 15px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.05);
    --primary-glow: 0 0 15px rgba(0, 113, 227, 0.5);
    --category-delay: 0.1s;
}

/* 全局样式重置与基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: #f5f5f7;
    padding: 0;
    margin: 0;
    -webkit-overflow-scrolling: touch;
}

/* 页面容器样式 */
.page-container {
    opacity: 0;
    animation: pageFadeIn 1s ease forwards;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 导航栏样式 */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.03);
}

.navbar.scrolled {
    padding: 10px 0;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.navbar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo span:last-child {
    white-space: nowrap;
    transition: all 0.3s ease;
}

.logo:hover span:last-child {
    color: var(--primary-hover);
    text-shadow: var(--primary-glow);
}

/* 头部区域样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0 30px;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle at 50% 50%, rgba(0, 113, 227, 0.1) 0%, rgba(0, 113, 227, 0) 70%);
    z-index: -1;
    animation: pulseBackground 8s infinite alternate;
}

@keyframes pulseBackground {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.header h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, var(--text-primary) 0%, #333 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
    display: inline-block;
}

.header h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 10%;
    width: 80%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    border-radius: 2px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s ease;
}

.header:hover h1::after {
    opacity: 1;
    transform: translateY(0);
}

.header p {
    font-size: 22px;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
    font-weight: 400;
    line-height: 1.6;
}

/* 搜索框样式 */
.search-container {
    margin: 0 auto 50px;
    max-width: 650px;
    position: relative;
    transition: all 0.4s ease;
}

.search-box {
    width: 100%;
    padding: 18px 24px;
    border: 1px solid var(--border-color);
    border-radius: 36px;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.02);
}

.search-box:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 5px rgba(0, 113, 227, 0.15), 0 10px 30px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.8);
}

.search-icon {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
    font-size: 20px;
    transition: all 0.3s ease;
}

.search-box:focus + .search-icon {
    color: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

/* 分类区域样式 */
.wrapper.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.category {
    margin-bottom: 40px;
    padding: 25px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: var(--radius-large);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(30px);
    animation: categoryFadeIn 0.7s ease forwards;
}

@keyframes categoryFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-5px);
    border-color: rgba(0, 113, 227, 0.2);
    background: rgba(255, 255, 255, 0.7);
}

.category-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 25px;
    color: var(--text-primary);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.category:hover .category-title::after {
    width: 100%;
}

.category-title:hover {
    color: var(--primary-color);
}

/* 工具列表样式 */
.tool-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    width: 100%;
}

/* 工具项样式 */
.tool-item {
    padding: 20px;
    border-radius: var(--radius-medium);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(15px);
    animation: toolItemFadeIn 0.4s ease forwards;
}

@keyframes toolItemFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), transparent);
    transform: translateX(-100%);
    transition: transform 0.4s ease;
}

.tool-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 113, 227, 0.3);
    background: rgba(255, 255, 255, 0.8);
}

.tool-item:hover::before {
    transform: translateX(0);
}

.tool-item a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    line-height: 1.4;
}

.tool-item:hover a {
    color: var(--primary-color);
    transform: translateX(5px);
}

.tool-tag {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    display: inline-block;
    align-self: flex-start;
    transition: all 0.3s ease;
    margin-top: auto;
}

.tool-item:hover .tool-tag {
    background: rgba(0, 113, 227, 0.15);
    color: var(--primary-color);
    transform: translateY(3px);
}

/* 页脚样式 */
.footer {
    margin-top: auto;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid var(--border-color);
    padding: 30px 0 20px;
    color: var(--text-secondary);
    transition: all 0.4s ease;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    margin-bottom: 15px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    transition: all 0.3s ease;
    position: relative;
    padding-bottom: 5px;
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-links a:hover::after {
    width: 100%;
}

.copyright {
    font-size: 14px;
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    line-height: 1.8;
}

/* 滚动到顶部按钮样式 */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    box-shadow: 0 5px 15px rgba(0, 113, 227, 0.4);
    z-index: 99;
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    animation: pulse 2s infinite;
}

.scroll-top:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 113, 227, 0.5);
}

@keyframes pulse {
    0% {
        box-shadow: 0 5px 15px rgba(0, 113, 227, 0.4);
    }
    50% {
        box-shadow: 0 5px 25px rgba(0, 113, 227, 0.6);
    }
    100% {
        box-shadow: 0 5px 15px rgba(0, 113, 227, 0.4);
    }
}

/* 分类动画延迟设置 */
#civil-law { animation-delay: 0.1s; }
#criminal-law { animation-delay: 0.2s; }
#administrative-law { animation-delay: 0.3s; }
#civil-procedure-law { animation-delay: 0.4s; }
#tax-law { animation-delay: 0.5s; }
#social-security { animation-delay: 0.55s; }
#environmental-law { animation-delay: 0.6s; }
#disciplinary-inspection { animation-delay: 0.65s; }

/* 工具项动画延迟设置 */
.tool-item:nth-child(3n+1) { animation-delay: 0.1s; }
.tool-item:nth-child(3n+2) { animation-delay: 0.15s; }
.tool-item:nth-child(3n) { animation-delay: 0.2s; }

/* 法律声明弹窗样式 */
.legal-notice-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.legal-notice-modal.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.modal-text {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 30px;
}

.modal-confirm {
    display: block;
    margin: 0 auto;
    padding: 12px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-confirm:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 113, 227, 0.3);
}

/* 响应式设计 - 大屏设备（1400px以上） */
@media (min-width: 1400px) {
    .wrapper.container {
        max-width: 1350px;
    }
    .tool-list {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* 响应式设计 - 中大屏设备（1200px-1399px） */
@media (min-width: 1200px) and (max-width: 1399px) {
    .tool-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 响应式设计 - 中屏设备（992px-1199px） */
@media (min-width: 992px) and (max-width: 1199px) {
    .tool-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 响应式设计 - 小屏设备（768px-991px） */
@media (min-width: 768px) and (max-width: 991px) {
    .tool-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 响应式设计 - 移动设备（767px以下） */
@media (max-width: 767px) {
    /* 基础样式调整 */
    .page-container {
        transform: translateZ(0);
    }
    
    .header h1 {
        font-size: 36px;
    }
    
    .header p {
        font-size: 18px;
    }
    
    .tool-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .category {
        padding: 20px;
    }
    
    .category-title {
        font-size: 24px;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .scroll-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .modal-title {
        font-size: 20px;
    }
    
    .modal-text {
        font-size: 15px;
    }
    
    /* 性能优化：简化毛玻璃效果 */
    .navbar,
    .search-box,
    .tool-item,
    .footer,
    .category {
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        background: rgba(255, 255, 255, 0.95) !important;
    }
    
    .tool-item {
        transition: box-shadow 0.3s ease !important;
    }
    
    .tool-item:hover {
        transform: none !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    }
    
    .tool-item::before {
        display: none !important;
    }
    
    .tool-item a,
    .tool-tag {
        transition: color 0.3s ease !important;
    }
}

/* 响应式设计 - 小屏手机（480px以下） */
@media (max-width: 480px) {
    .header h1 {
        font-size: 28px;
    }
    
    .header p {
        font-size: 16px;
    }
    
    .category-title {
        font-size: 22px;
    }
    
    .tool-tag {
        font-size: 12px;
        padding: 3px 10px;
    }
    
    .tool-list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 进一步简化背景 */
    .navbar,
    .search-box,
    .tool-item,
    .footer,
    .category {
        background: rgba(255, 255, 255, 0.98) !important;
    }
}