/* Custom Styles for Automotive Parts Supplier Website */
/* Built on top of Bootstrap 5.3.0 */

/* Custom Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* CSS Custom Properties for Easy Adjustments */
:root {
    --primary-color: #4a5568;
    --primary-blue: #1b365d;
    --primary-dark: #2d3748;
    --secondary-color: #718096;
    --success-color: #38a169;
    --light-bg: #f7fafc;
    --white: #ffffff;
    --text-dark: #2d3748;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --search-bg: #f7fafc;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 0.5rem;
    --transition: all 0.2s ease;
}

/* 防止水平滚动的全局设置 */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Stock Status Classes */
.stock-in {
    color: #00A86B;
}

.stock-out {
    color: #dc3545;
}

.stock-discontinued {
    color: #6c757d;
}

/* Global Styles */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 120px; /* Account for fixed navbar + top contact bar */
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Hero Section Customizations */
.hero-section {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    position: relative;
    overflow: hidden;
    min-height: 33vh;
    padding-top: 2rem; /* Reduced since body now has padding-top */
}

.custom-hero-height {
    min-height: 33vh;
    padding: 3rem 0;
}

.hero-overlay {
    background: url('https://images.unsplash.com/photo-1486262715619-67b85e0b08d3?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.hero-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, 
        rgba(255, 255, 255, 1) 35%, 
        rgba(255, 255, 255, 0.7) 60%, 
        rgba(255, 255, 255, 0.3) 80%, 
        transparent 100%);
    z-index: 1;
}

.hero-section .container {
    z-index: 3;
    position: relative;
}

.hero-section h1 {
    color: var(--text-dark);
    line-height: 1.2;
    font-size: 2.5rem;
    font-weight: 700;
}

.hero-section p {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.6;
}

.hero-section .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}

.hero-section .btn-light {
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
}

.hero-section .btn-light:hover {
    background-color: var(--primary-dark);
    color: var(--white);
}

.hero-section .btn-outline-light {
    background-color: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.hero-section .btn-outline-light:hover {
    background-color: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
}

/* Hero buttons symmetry fix */
.hero-buttons-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.hero-buttons-container .hero-main-btn {
    flex: 1 1 auto;
    min-width: 200px;
    max-width: 280px;
    text-align: center;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

/* Ensure equal button sizes on desktop */
@media (min-width: 768px) {
    .hero-buttons-container .hero-main-btn {
        flex: 0 0 auto;
        width: 240px;
    }
}

/* Product Cards */
.product-card {
    border-radius: 1rem !important;
}

/* Product icon styles will be added here when needed */

/* Custom Button Styles */
.btn {
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: var(--transition);
    letter-spacing: 0.025em;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-outline-light:hover {
    transform: translateY(-1px);
}

/* Feature Cards */
.card {
    border-radius: 1rem !important;
    transition: var(--transition);
}



/* Responsive Adjustments */
@media (max-width: 1400px) {
    .display-3 {
        font-size: 2.5rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .hero-section {
        min-height: 10vh !important;
        padding: 2rem 0 0 0 !important; /* Reduced since body now has padding-top */
    }
    
    .custom-hero-height {
        min-height: 10vh !important;
        padding: 3rem 0 !important;
        display: flex;
        align-items: center;
    }
    
    .hero-section h1 {
        font-size: 2.2rem !important;
        font-weight: 800 !important;
        line-height: 1.1 !important;
        margin-bottom: 1.5rem !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    /* Mobile Typewriter Adjustments */
    .typewriter-text {
        white-space: normal; /* Allow text wrapping on mobile if needed */
        word-break: break-word;
        min-height: 1.1em;
    }
    
    .typewriter-text::after {
        right: -6px;
        font-size: 0.9em;
    }
    
    .hero-section p {
        font-size: 1.1rem !important;
        line-height: 1.5 !important;
        margin-bottom: 2rem !important;
        color: var(--text-muted) !important;
        font-weight: 400;
    }
    
    .hero-section .btn {
        padding: 0.625rem 0.75rem !important;
        font-size: 0.875rem !important;
        font-weight: 600 !important;
        margin: 0.25rem 0 !important;
        flex: 1 1 auto !important;
        min-width: 130px !important;
        max-width: none !important;
        border-radius: var(--border-radius) !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        /* Touch optimization */
        min-height: 44px !important;
        touch-action: manipulation !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .hero-section .container {
        padding: 0 1.5rem !important;
    }
    
    /* Mobile button container - 同一行显示 */
    .hero-section .d-flex,
    .hero-section .d-flex.gap-3,
    .hero-section .d-flex.gap-2,
    .hero-section .hero-buttons-container {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 1rem !important;
        width: 100% !important;
        flex-wrap: wrap !important;
    }
    
    /* Ensure button wrapper 同一行显示 */
    .hero-section .btn-group,
    .hero-section .button-group,
    .hero-section .buttons {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        width: 100% !important;
        gap: 0.75rem !important;
        flex-wrap: wrap !important;
    }
    
    /* Enhanced mobile background overlay for better text readability */
    .hero-overlay::before {
        background: linear-gradient(to right, 
            rgba(255, 255, 255, 0.95) 0%, 
            rgba(255, 255, 255, 0.9) 70%, 
            rgba(255, 255, 255, 0.7) 100%) !important;
    }
}

/* Extra small screens - keep buttons side by side with smaller size */
@media (max-width: 420px) {
    .hero-buttons-container {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        flex-wrap: wrap !important; /* Allow wrap for very long text */
    }
    
    .hero-buttons-container .hero-main-btn {
        flex: 1 1 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: 110px !important;
        padding: 0.5rem 0.5rem !important;
        font-size: 0.75rem !important;
        white-space: normal !important; /* Allow text wrapping */
        overflow: visible !important; /* Allow text to show */
        text-overflow: clip !important; /* Remove ellipsis */
        line-height: 1.2 !important;
        text-align: center !important;
        word-break: break-word !important; /* Break long words if needed */
    }
}

/* Very small screens - even more compact */
@media (max-width: 360px) {
    .hero-buttons-container {
        gap: 0.375rem !important;
    }
    
    .hero-buttons-container .hero-main-btn {
        min-width: 100px !important;
        padding: 0.5rem 0.375rem !important;
        font-size: 0.7rem !important;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .display-3 {
        font-size: 2rem;
    }
    
    .display-4 {
        font-size: 1.75rem;
    }
    
    .card-body {
        padding: 1.5rem !important;
    }
    
    /* Hero section button optimization for small screens */
    .hero-section .btn {
        padding: 0.5rem 0.5rem !important;
        font-size: 0.75rem !important;
        width: calc(50% - 0.375rem) !important;
        min-width: 110px !important;
        max-width: 130px !important;
        min-height: 40px !important;
    }
    
    .hero-section h1 {
        font-size: 1.9rem !important;
        margin-bottom: 1.25rem !important;
    }
    
    /* Small Mobile Typewriter Adjustments */
    .typewriter-text {
        white-space: normal;
        word-break: break-word;
        min-height: 1em;
        line-height: 1.1;
    }
    
    .typewriter-text::after {
        right: -5px;
        font-size: 0.85em;
    }
    
    .hero-section p {
        font-size: 1rem !important;
        margin-bottom: 1.75rem !important;
    }
}

/* Animation Classes for Future Use */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.fade-in.active {
    opacity: 1;
    transform: translateY(0);
}



/* Main Hero Section Animations */
.hero-main-title {
    opacity: 1;
    transform: translateY(0);
    /* Remove fade animation for typewriter effect */
}

/* Typewriter Effect */
.typewriter-text {
    display: inline-block;
    position: relative;
    color: var(--text-dark);
    min-height: 1.2em; /* Prevent layout shift */
    white-space: nowrap;
}

.typewriter-text::after {
    content: '|';
    position: absolute;
    right: -8px;
    top: 0;
    color: var(--primary-blue);
    animation: typewriterCursor 1s infinite;
    font-weight: 400;
    font-size: 1em;
    line-height: inherit;
}

@keyframes typewriterCursor {
    0%, 45% {
        opacity: 1;
    }
    46%, 100% {
        opacity: 0;
    }
}

/* Enhanced typewriter animation states */
.typewriter-text.typing::after {
    animation: typewriterCursor 0.5s infinite;
}

.typewriter-text.deleting::after {
    animation: typewriterCursor 0.3s infinite;
}

.typewriter-text.paused::after {
    animation: typewriterCursor 1.2s infinite;
}

.hero-main-description {
    opacity: 0;
    transform: translateY(20px);
    animation: heroDescFadeIn 1s ease-out 0.6s forwards;
}

.hero-main-btn {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    animation: heroBtnFadeIn 0.8s ease-out forwards;
}

.hero-main-btn:nth-child(1) { animation-delay: 0.9s; }
.hero-main-btn:nth-child(2) { animation-delay: 1.1s; }

@keyframes heroTitleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroDescFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes heroBtnFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    60% {
        opacity: 0.8;
        transform: translateY(5px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Section Title Animations - Official Style */
.animated-section-title {
    opacity: 0;
    transform: translateY(-20px);
    animation: sectionTitleFadeIn 0.8s ease-out forwards;
}

.animated-section-subtitle {
    opacity: 0;
    transform: translateY(20px);
    animation: sectionSubtitleFadeIn 0.8s ease-out 0.2s forwards;
}

@keyframes sectionTitleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sectionSubtitleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Product Category Card Animations - Official Style */
.animated-product-card {
    opacity: 0;
    transform: translateX(-50px);
    animation: productCardSlideIn 0.7s ease-out forwards;
}

.animated-product-card:nth-child(1) { animation-delay: 0.1s; }
.animated-product-card:nth-child(2) { animation-delay: 0.2s; }
.animated-product-card:nth-child(3) { animation-delay: 0.3s; }
.animated-product-card:nth-child(4) { animation-delay: 0.4s; }

/* Simple, professional hover effect */
.animated-product-card:hover {
    transform: translateY(-5px);
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

@keyframes productCardSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Simple hover effects for category links */
.product-category-link:hover {
    color: var(--primary-blue);
    transition: all 0.2s ease;
}

.product-category-link:hover i {
    transform: translateX(3px);
    transition: all 0.2s ease;
}

/* Clean section styling */
.product-categories-section {
    position: relative;
}

/* Professional card styling */
.product-category-card {
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.product-category-card:hover {
    border-color: rgba(27, 54, 93, 0.1);
}

/* Performance optimizations */
.product-category-card,
.animated-product-card {
    will-change: transform;
    backface-visibility: hidden;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .animated-product-card {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile optimizations */
@media (max-width: 1400px) {
    .animated-product-card:hover {
        transform: translateY(-3px);
    }
    
    /* Simplified animations on mobile */
    .animated-product-card {
        animation-duration: 0.5s;
        transform: translateX(-30px); /* 移动端滑入距离稍微减少 */
    }
    
    @keyframes productCardSlideIn {
        0% {
            opacity: 0;
            transform: translateX(-30px);
        }
        100% {
            opacity: 1;
            transform: translateX(0);
        }
    }
}

/* Why Choose Us Card Animations */
.animated-why-choose-card {
    opacity: 0;
    transform: translateX(-30px);
    animation: whyChooseCardSlideIn 0.8s ease-out forwards;
}

.animated-why-choose-card:nth-child(1) { animation-delay: 0.3s; }
.animated-why-choose-card:nth-child(2) { animation-delay: 0.5s; }
.animated-why-choose-card:nth-child(3) { animation-delay: 0.7s; }

@keyframes whyChooseCardSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Hot Products Card Animations */
.animated-hot-product-card {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
    animation: hotProductCardFadeIn 1s ease-out forwards;
}

.animated-hot-product-card:nth-child(1) { animation-delay: 0.2s; }
.animated-hot-product-card:nth-child(2) { animation-delay: 0.4s; }
.animated-hot-product-card:nth-child(3) { animation-delay: 0.6s; }

@keyframes hotProductCardFadeIn {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    60% {
        opacity: 0.7;
        transform: translateY(15px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Statistics Animation */
.animated-statistic-item {
    opacity: 0;
    transform: translateY(30px);
    animation: statisticItemFadeIn 0.8s ease-out forwards;
}

.animated-statistic-item:nth-child(1) { animation-delay: 0.1s; }
.animated-statistic-item:nth-child(2) { animation-delay: 0.3s; }
.animated-statistic-item:nth-child(3) { animation-delay: 0.5s; }
.animated-statistic-item:nth-child(4) { animation-delay: 0.7s; }

@keyframes statisticItemFadeIn {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Number Counter Animation */
.animated-number {
    display: inline-block;
    animation: numberPulse 0.6s ease-out forwards;
}

@keyframes numberPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Contact Section Animations */
.animated-contact-info {
    opacity: 0;
    transform: translateX(-20px);
    animation: contactInfoSlideIn 0.8s ease-out forwards;
}

.animated-contact-form {
    opacity: 0;
    transform: translateX(20px);
    animation: contactFormSlideIn 0.8s ease-out 0.3s forwards;
}

@keyframes contactInfoSlideIn {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes contactFormSlideIn {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* More Products Button Animation */
.animated-more-btn {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    animation: moreBtnFadeIn 0.8s ease-out 0.9s forwards;
}

@keyframes moreBtnFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    60% {
        opacity: 0.8;
        transform: translateY(5px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Pause all animations initially */
.hero-main-title,
.hero-main-description,
.hero-main-btn,
.animated-section-title,
.animated-section-subtitle,
.animated-product-card,
.animated-why-choose-card,
.animated-hot-product-card,
.animated-statistic-item,
.animated-contact-info,
.animated-contact-form,
.animated-more-btn {
    animation-play-state: paused;
}

/* Utility Classes */
.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.border-primary-soft {
    border: 1px solid rgba(13, 110, 253, 0.2);
}

/* Icon Adjustments */
.fas.fa-brake-system::before {
    content: "\f1b9"; /* Using disc icon as fallback */
}

.fas.fa-car-suspension::before {
    content: "\f013"; /* Using cog icon as fallback */
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading Animation (Optional) */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 语言切换加载覆盖层 */
.language-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 0.3s ease;
}

.language-loading-overlay.show {
    display: flex;
    opacity: 1;
}

.language-loading-content {
    text-align: center;
    color: #333;
}

.language-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1b365d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.language-loading-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 10px;
    color: #333;
}

.language-loading-subtext {
    font-size: 14px;
    color: #666;
    opacity: 0.8;
}

/* 语言切换动画 */
.language-switching {
    opacity: 0.7;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    .language-loading-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .language-loading-text {
        color: #fff;
    }
    
    .language-loading-subtext {
        color: #ccc;
    }
    
    .language-loading-spinner {
        border-color: #333;
        border-top-color: #1b365d;
    }
}
