/* ============================================
   Yongchi Auto - 响应式 & 美化增强样式
   ============================================ */

/* --- 语言切换器带图标 --- */
.lang-switch {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.lang-switch .sep {
    color: rgba(255,255,255,0.25);
    font-size: 12px;
    user-select: none;
}

.lang-switch a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    background: rgba(255,255,255,0.1);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.25s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.lang-switch a:hover {
    background: #E3682E;
    transform: translateY(-1px);
}

.lang-switch a.active {
    background: #E3682E;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(227,104,46,0.3);
}

.flag-icon {
    font-size: 16px;
    line-height: 1;
}

/* --- 页面加载动画 --- */
.page-loader {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 9999;
    background: transparent;
    pointer-events: none;
}

.page-loader::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #E3682E, #f5a623, #E3682E);
    background-size: 200% 100%;
    animation: loader-progress 1.5s ease-in-out infinite;
}

@keyframes loader-progress {
    0% { width: 0; left: 0; }
    50% { width: 40%; left: 30%; }
    100% { width: 0; left: 100%; }
}

/* --- 图片懒加载过渡 --- */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.4s ease-in;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([src=""]) {
    opacity: 1;
}

/* --- 平滑滚动 --- */
html {
    scroll-behavior: smooth;
}

/* --- 卡片悬停效果提升 --- */
.feature-card,
.vehicle-card,
.blog-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover,
.vehicle-card:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.vehicle-image {
    position: relative;
    overflow: hidden;
}

.vehicle-image img {
    transition: transform 0.5s ease;
}

.vehicle-card:hover .vehicle-image img {
    transform: scale(1.08);
}

/* --- 按钮动画 --- */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.btn:active::after {
    width: 200px;
    height: 200px;
    opacity: 1;
}

/* --- 移动端菜单动画 --- */
.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    cursor: pointer;
    padding: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    transition: background 0.2s;
    border: none;
}

.mobile-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.mobile-toggle span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #fff;
    margin: 2.5px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* --- 移动端导航抽屉 --- */
@media (max-width: 991px) {
    .header .container {
        position: relative;
    }

    .mobile-toggle {
        display: flex !important;
    }

    .nav {
        display: none;
        position: fixed;
        top: 66px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(21, 49, 96, 0.98);
        z-index: 999;
        padding: 20px 0;
        overflow-y: auto;
        animation: slideDown 0.3s ease;
    }

    .nav.active {
        display: block;
    }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0 20px;
    }

    .nav ul li {
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .nav ul li a {
        display: block;
        padding: 15px 10px;
        font-size: 16px;
        color: rgba(255,255,255,0.85);
    }

    .nav ul li a:hover,
    .nav ul li a.active {
        color: #E3682E;
        background: rgba(255,255,255,0.05);
        border-radius: 4px;
    }

    .lang-switch {
        padding: 15px 10px;
        justify-content: center;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: 10px;
        gap: 6px;
    }

    .lang-switch a {
        font-size: 12px;
        padding: 6px 8px;
    }

    .lang-switch .sep {
        display: none;
    }

    /* 移动端 header 紧凑 */
    .header {
        padding: 10px 0;
    }

    .logo h1 {
        font-size: 20px;
    }

    .logo img {
        max-height: 35px;
    }
}

/* --- 平板端适配 (768-1024px) --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .vehicles-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .blog-layout {
        grid-template-columns: 1fr 250px;
        gap: 25px;
    }

    .vehicle-detail-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .vehicles-layout {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 20px;
    }

    .hero {
        padding: 70px 0;
    }

    .hero h2 {
        font-size: 38px;
    }

    .features,
    .featured-vehicles {
        padding: 60px 0;
    }

    .section-title {
        font-size: 28px;
        margin-bottom: 35px;
    }
}

/* --- 大屏手机 (480-768px) --- */
@media (max-width: 768px) {
    .nav {
        top: 56px;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .feature-card {
        padding: 25px 15px;
    }

    .feature-icon {
        font-size: 36px;
    }

    .vehicles-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .vehicle-image {
        height: 200px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .footer {
        padding: 40px 0 0;
    }

    .blog-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .vehicle-detail-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .vehicles-layout {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 60px 0;
    }

    .hero h2 {
        font-size: 28px;
    }

    .hero p {
        font-size: 16px;
    }

    .hero-slider .hero-content {
        padding: 60px 15px !important;
    }

    .hero-slider .hero-content h2 {
        font-size: 24px;
    }

    .features,
    .featured-vehicles,
    .cta {
        padding: 50px 0;
    }

    .section-title {
        font-size: 24px;
        margin-bottom: 30px;
    }

    .cta h2 {
        font-size: 24px;
    }

    .page-header {
        padding: 30px 0;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .error-page h1 {
        font-size: 80px;
    }

    .sidebar-widget {
        padding: 18px;
    }

    .vehicle-sidebar .sidebar-widget {
        position: static;
    }

    .btn {
        padding: 10px 24px;
    }

    .container {
        padding: 0 12px;
    }
}

/* --- 小屏手机 (<480px) --- */
@media (max-width: 479px) {
    .features-grid {
        grid-template-columns: 1fr;
    }

    .hero h2 {
        font-size: 24px;
    }

    .lang-switch a {
        font-size: 11px;
        padding: 4px 6px;
    }

    .flag-icon {
        font-size: 14px;
    }

    .logo h1 {
        font-size: 17px;
    }

    .vehicle-card .vehicle-info {
        padding: 15px;
    }

    .vehicle-info h3 {
        font-size: 16px;
    }

    .price {
        font-size: 18px;
    }

    .section-title {
        font-size: 20px;
    }

    .error-page h1 {
        font-size: 60px;
    }

    .error-page h2 {
        font-size: 24px;
    }

    .btn {
        padding: 8px 18px;
        font-size: 14px;
    }
}

/* --- 打印样式优化 --- */
@media print {
    .header,
    .footer,
    .mobile-toggle,
    .lang-switch,
    .sidebar,
    .cta {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
    }

    a {
        color: #000 !important;
        text-decoration: underline;
    }
}

/* --- 可访问性增强 --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus 可见性 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #E3682E;
    outline-offset: 2px;
}

/* --- 触摸设备优化 --- */
@media (hover: none) and (pointer: coarse) {
    .nav ul li a {
        padding: 14px 10px; /* 更大的触控区域 */
    }

    .btn {
        padding: 14px 30px;
    }

    .lang-switch a {
        padding: 8px 12px;
    }
}
