/* ==========================================
   Responsive Design
   普慧康泰 - 响应式媒体查询
   ========================================== */

/* 浏览器缩放支持 - 针对缩放后的等效宽度调整布局 */
@media (max-width: 1400px) {
    .header-container {
        padding: 0 1.5rem;
    }

    .nav-list {
        gap: 1.25rem;
    }

    .nav-link {
        font-size: 1rem;
    }

    .header-search {
        width: 11rem;
    }
}

@media (max-width: 1200px) {
    .header-container {
        padding: 0 1.25rem;
        gap: 1rem;
    }

    .nav-list {
        gap: 1rem;
    }

    .nav-dropdown-menu {
        min-width: 32rem;
        max-width: 48rem;
    }

    .header-search {
        width: 10rem;
    }
}

/* Extra Large Devices (Large Desktops) */
@media (max-width: 1399px) {
    :root {
        --max-width: 1140px;
    }
}

/* Large Devices (Desktops) */
@media (max-width: 1199px) {
    :root {
        --max-width: 960px;
    }

    .hero-title {
        font-size: var(--font-size-5xl);
    }

    .section-title {
        font-size: var(--font-size-3xl);
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium Devices (Tablets) */
@media (max-width: 991px) {
    :root {
        --max-width: 720px;
        --header-height: 70px;
    }

    .hero {
        min-height: 70vh;
    }

    .hero-title {
        font-size: var(--font-size-4xl);
    }

    .hero-subtitle {
        font-size: var(--font-size-xl);
    }

    .section {
        padding: var(--spacing-16) 0;
    }

    .section-title {
        font-size: var(--font-size-2xl);
    }

    /* Grid Adjustments */
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* About Grid */
    .about-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-8);
    }

    /* Contact Grid */
    .contact-grid {
        grid-template-columns: 1fr;
    }

    /* Footer Grid */
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
        gap: var(--spacing-6);
    }

    /* Navigation */
    .nav-toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        width: 24px;
        height: 20px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    .nav-toggle span {
        display: block;
        width: 20px;
        height: 2px;
        background: var(--color-gray-900);
        margin: 2px 0;
        transition: all 0.3s ease;
        border-radius: 2px;
    }

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

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

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

    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--header-height));
        background: var(--color-white);
        flex-direction: column;
        padding: var(--spacing-6);
        transition: left 0.3s ease;
        box-shadow: var(--shadow-lg);
        z-index: 999;
    }

    .nav-menu.active {
        left: 0;
    }

    /* Hero Carousel on mobile */
    .hero-carousel {
        height: 400px !important;
    }

    .hero-slide {
        background-position: center center !important;
    }

    .nav-list {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .nav-item {
        width: 100%;
        border-bottom: 1px solid var(--color-gray-200);
    }

    .nav-link {
        display: block;
        padding: var(--spacing-4) 0;
    }
}

/* Small Devices (Landscape Phones) */
@media (max-width: 767px) {
    :root {
        --max-width: 100%;
        --header-height: 65px;
    }

    .container {
        padding: 0 1rem;
    }

    /* Hero Section */
    .hero {
        min-height: 60vh;
        text-align: center;
    }

    .hero-content {
        margin: 0 auto;
    }

    .hero-title {
        font-size: var(--font-size-3xl);
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: var(--font-size-lg);
    }

    .hero-description {
        font-size: var(--font-size-base);
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-4);
    }

    .hero-trust {
        flex-direction: column;
        gap: var(--spacing-6);
    }

    /* Hero Carousel */
    .hero-carousel {
        height: 350px !important;
    }

    .hero-slide {
        background-position: center center !important;
        background-size: cover !important;
    }

    /* Section Spacing */
    .section {
        padding: var(--spacing-12) 0;
    }

    /* Section Header */
    .section-title {
        font-size: var(--font-size-2xl);
        line-height: 1.3;
    }

    .section-subtitle {
        font-size: var(--font-size-base);
    }

    /* Grid System */
    .grid,
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-6 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Column System */
    .col-1,
    .col-2,
    .col-3,
    .col-4,
    .col-5,
    .col-6,
    .col-7,
    .col-8,
    .col-9,
    .col-10,
    .col-11,
    .col-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .offset-1,
    .offset-2,
    .offset-3,
    .offset-4,
    .offset-5,
    .offset-6 {
        margin-left: 0;
    }

    /* Cards */
    .card-body {
        padding: var(--spacing-4);
    }

    /* Products Grid */
    .products-grid {
        grid-template-columns: 1fr;
    }

    /* Honors Grid */
    .honors-grid {
        grid-template-columns: 1fr;
    }

    .patents-grid {
        grid-template-columns: 1fr;
    }

    .patents-wall {
        padding: var(--spacing-8) 0;
    }

    /* Form */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer {
        padding: var(--spacing-8) 0 var(--spacing-6);
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-6);
        text-align: center;
    }

    .footer-brand {
        text-align: center;
    }

    .footer-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .footer-links li {
        margin-bottom: 0.5rem;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
        padding-top: var(--spacing-6);
    }

    .footer-copyright {
        font-size: 0.75rem;
    }

    /* Buttons */
    .btn {
        padding: 0.625rem 1.5rem;
        font-size: var(--font-size-sm);
    }

    .btn-lg {
        padding: 0.75rem 2rem;
        font-size: var(--font-size-base);
    }

    /* Stats */
    .stat-value {
        font-size: var(--font-size-4xl);
    }

    .value-number {
        font-size: var(--font-size-3xl);
    }
}

/* Extra Small Devices (Portrait Phones) */
@media (max-width: 575px) {
    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }

    .hero-title {
        font-size: var(--font-size-2xl);
        line-height: 1.2;
    }

    /* Spacing */
    .section {
        padding: var(--spacing-10) 0;
    }

    /* Navigation */
    .header-container {
        flex-direction: row;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0 1rem;
    }

    .header-search {
        display: none;
    }

    .header-right {
        justify-content: flex-end;
    }

    .logo {
        gap: 0.5rem;
    }

    .logo-img {
        width: 45px !important;
        height: 45px !important;
    }

    .logo-text {
        display: none;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
    }

    .header-search {
        display: none;
    }

    /* 汉堡菜单按钮 */
    .nav-toggle {
        width: 24px;
        height: 20px;
    }

    .nav-toggle span {
        width: 20px;
        margin: 2px 0;
    }

    /* 移动端导航菜单 */
    .nav-menu {
        padding: 1rem 0;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-link {
        font-size: 1rem;
        padding: 0.875rem 0;
    }

    /* Hero Carousel - smaller height for phones */
    .hero-carousel {
        height: 250px !important;
    }

    /* 英雄区域 */
    .hero {
        min-height: 50vh;
        padding: var(--spacing-8) 0;
    }

    /* 产品卡片 */
    .product-image {
        height: 200px;
    }

    .product-content {
        padding: 1rem;
    }

    .product-title {
        font-size: 1.125rem;
    }

    .product-description {
        font-size: 0.875rem;
    }

    /* 标签 */
    .feature-tag,
    .section-tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
    }

    /* Cards */
    .card,
    .product-card,
    .solution-card {
        border-radius: var(--border-radius-sm);
    }

    .product-content,
    .solution-card {
        padding: var(--spacing-4);
    }

    /* 服务卡片 */
    .service-card {
        padding: 1.25rem;
    }

    .service-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .service-description {
        font-size: 0.875rem;
    }

    /* Testimonials */
    .testimonial-card {
        padding: var(--spacing-5);
    }

    .testimonial-card::before {
        font-size: 2.5rem;
    }

    .testimonial-content {
        font-size: var(--font-size-base);
    }

    /* FAQ */
    .faq-question {
        padding: var(--spacing-4);
        font-size: var(--font-size-base);
    }

    .faq-item.active .faq-answer {
        padding: 0 var(--spacing-4) var(--spacing-4);
    }

    /* Contact */
    .contact-info-card,
    .contact-form {
        padding: var(--spacing-5);
    }

    /* Patents Wall */
    .patents-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-6);
    }

    /* Value Metrics */
    .value-metrics {
        grid-template-columns: 1fr;
        gap: var(--spacing-6);
    }

    /* Trust Items */
    .trust-value {
        font-size: var(--font-size-3xl);
    }

    /* News Cards */
    .news-card {
        padding: var(--spacing-4);
    }

    .news-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-3);
    }

    /* Touch-friendly buttons */
    .btn,
    .btn-primary,
    .btn-outline,
    .btn-secondary {
        min-height: 44px;
        /* iOS touch target minimum */
        padding: 0.75rem 1.5rem;
        font-size: var(--font-size-base);
    }

    /* Service Cards */
    .service-card {
        padding: var(--spacing-5);
    }

    /* Honor Cards */
    .honor-card {
        padding: var(--spacing-4);
    }

    /* Gallery Images */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Touch-friendly optimizations for all touch devices */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets for touch devices */
    a,
    button,
    .btn,
    .nav-link {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .card:hover,
    .btn:hover,
    .nav-link:hover {
        transform: none;
    }

    /* Add active states for touch */
    .btn:active,
    .nav-link:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* Landscape Orientation */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
    }

    .hero-title {
        font-size: var(--font-size-4xl);
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .hero-buttons,
    .contact-section {
        display: none;
    }

    .section {
        page-break-inside: avoid;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Optimizations for retina displays can be added here */
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support (Future) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here when needed */
}

/* ==========================================
   Mobile Navigation Enhancement
   ========================================== */

/* 移动端导航菜单 */
@media (max-width: 991px) {
    /* 隐藏桌面端下拉菜单 */
    .nav-dropdown-menu {
        display: none !important;
    }

    /* 移动端菜单项样式 */
    .nav-dropdown {
        position: static;
    }

    /* 创建移动端可展开的下拉菜单 */
    .nav-dropdown > .nav-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }

    .nav-dropdown-icon {
        transition: transform 0.3s ease;
        flex-shrink: 0;
        margin-left: auto;
    }

    /* 下拉菜单展开时的图标旋转 */
    .nav-dropdown.expanded .nav-dropdown-icon {
        transform: rotate(180deg);
    }

    /* 移动端下拉内容容器 */
    .nav-dropdown-content {
        display: none;
        background: var(--color-gray-50);
        padding-left: 1rem;
        border-bottom: 1px solid var(--color-gray-200);
    }

    .nav-dropdown.expanded .nav-dropdown-content {
        display: block;
        animation: slideDown 0.3s ease;
    }

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

    /* 移动端下拉分区标题 */
    .nav-mobile-section-title {
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--color-gray-500);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        padding: 0.75rem 0 0.5rem;
        margin: 0;
    }

    /* 移动端下拉链接 */
    .nav-mobile-item {
        display: block;
        padding: 0.75rem 0;
        color: var(--color-gray-700);
        text-decoration: none;
        font-size: 0.9375rem;
        border-bottom: 1px solid var(--color-gray-100);
        transition: color 0.2s ease;
    }

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

    .nav-mobile-item:active {
        color: var(--color-primary);
    }
}
