/* Mobile-Optimized Styles */
/* 移动端优化专用样式文件 */

/* 基础移动端优化 */
@media (max-width: 768px) {

    /* 禁用双击缩放，优化触摸体验 */
    html {
        touch-action: manipulation;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }

    /* 基础字体和行高优化 */
    body {
        font-size: 16px;
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    /* 标题响应式大小 */
    h1 {
        font-size: 1.75rem;
        line-height: 2.25rem;
    }

    h2 {
        font-size: 1.5rem;
        line-height: 2rem;
    }

    h3 {
        font-size: 1.25rem;
        line-height: 1.75rem;
    }

    h4 {
        font-size: 1.125rem;
        line-height: 1.75rem;
    }

    /* 段落间距优化 */
    p {
        margin-bottom: 1rem;
        line-height: 1.6;
    }

    /* 触摸目标最小尺寸 */
    .btn,
    button,
    a.btn,
    input[type="submit"],
    input[type="button"],
    input[type="reset"] {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1.5rem;
    }


    /* 表单元素优化 */
    input,
    textarea,
    select {
        font-size: 16px;
        /* 防止iOS缩放 */
        padding: 0.75rem;
        border-radius: 0.5rem;
        border: 1px solid #d1d5db;
        width: 100%;
    }

    input:focus,
    textarea:focus,
    select:focus {
        outline: 2px solid #ea9427;
        outline-offset: 2px;
        border-color: #ea9427;
    }

    /* 表格响应式处理 */
    table {
        width: 100%;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }

    table thead,
    table tbody,
    table tr,
    table th,
    table td {
        display: block;
    }

    table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    table tr {
        border: 1px solid #ccc;
        margin-bottom: 1rem;
    }

    table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        white-space: normal;
        text-align: left;
    }

    table td:before {
        position: absolute;
        top: 6px;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        content: attr(data-title);
    }

    /* 图片响应式 */
    img {
        max-width: 100%;
        height: auto;
        border-radius: 0.5rem;
    }

    /* 视频响应式 */
    video,
    iframe {
        max-width: 100%;
        height: auto;
        border-radius: 0.5rem;
    }

    /* 卡片优化 */
    .card {
        border-radius: 1rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        margin-bottom: 1.5rem;
        padding: 1.5rem;
    }

    /* 列表优化 */
    ul,
    ol {
        padding-left: 1.5rem;
        margin-bottom: 1rem;
    }


    /* 导航菜单优化 */
    .nav-menu {
        background-color: #fff;
        border-radius: 1rem;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        margin: 1rem;
        padding: 1rem;
    }

    .nav-menu a {
        display: block;
        padding: 1rem;
        border-radius: 0.5rem;
        margin-bottom: 0.5rem;
        color: #374151;
        text-decoration: none;
        transition: all 0.2s;
    }

    .nav-menu a:hover {
        background-color: #f3f4f6;
        color: #ea9427;
    }

    /* 轮播图移动端优化 */
    .hero-section {
        height: 50vh !important;
        min-height: 300px !important;
    }

    .hero-content {
        text-align: center;
        padding: 2rem 1rem;
    }

    .hero-title {
        font-size: 1.75rem !important;
        margin-bottom: 1rem;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    }

    .hero-subtitle {
        font-size: 1rem !important;
        margin-bottom: 1.5rem;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    }

    .hero-btn {
        display: inline-block;
        padding: 0.75rem 2rem;
        background-color: #ea9427;
        color: white;
        border-radius: 2rem;
        text-decoration: none;
        font-weight: 600;
        transition: all 0.3s;
    }

    .hero-btn:hover {
        background-color: #d17d1f;
        transform: translateY(-2px);
    }

    /* 手风琴菜单优化 */
    .accordion-item {
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 0.5rem;
    }

    .accordion-toggle {
        width: 100%;
        text-align: left;
        background: none;
        border: none;
        padding: 1rem;
        font-size: 1rem;
        font-weight: 600;
        color: #374151;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: all 0.2s;
    }

    .accordion-toggle:hover {
        background-color: #f9fafb;
    }

    .accordion-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
        background-color: #f9fafb;
    }

    .accordion-content.active {
        max-height: 500px;
    }

    .accordion-content-inner {
        padding: 1rem;
    }

    /* 横向滚动优化 */
    .horizontal-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        scroll-behavior: smooth;
    }

    .horizontal-scroll::-webkit-scrollbar {
        display: none;
    }

    .horizontal-scroll>* {
        flex-shrink: 0;
    }

    /* 滑动指示器 */
    .swipe-indicator {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        margin: 1rem 0;
    }

    .swipe-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: #d1d5db;
        transition: all 0.2s;
    }

    .swipe-dot.active {
        width: 24px;
        border-radius: 4px;
        background-color: #eab308;
    }

    /* Tab 组件移动端优化 */
    .tab-container {
        width: 100%;
        overflow: hidden;
    }

    .tab-nav {
        display: flex;
        border-bottom: 2px solid #e5e7eb;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .tab-nav::-webkit-scrollbar {
        display: none;
    }

    .tab-button {
        flex: 1;
        min-width: 100px;
        padding: 1rem;
        background: none;
        border: none;
        border-bottom: 2px solid transparent;
        color: #6b7280;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
        white-space: nowrap;
    }

    .tab-button.active {
        color: #eab308;
        border-bottom-color: #eab308;
    }

    .tab-content {
        padding: 1.5rem 0;
    }

    .tab-panel {
        display: none;
    }

    .tab-panel.active {
        display: block;
    }

    /* 模态框移动端优化 */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.8);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1000;
    }

    .modal-content {
        width: 95%;
        max-width: 500px;
        max-height: 90vh;
        overflow-y: auto;
        background-color: white;
        border-radius: 1rem;
        padding: 2rem;
        margin: 1rem;
    }

    .modal-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        width: 32px;
        height: 32px;
        background: #f3f4f6;
        border: none;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 1.5rem;
        color: #6b7280;
    }

    /* 分页组件优化 */
    .pagination {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        margin: 2rem 0;
        flex-wrap: wrap;
    }

    .pagination button,
    .pagination a {
        min-width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #d1d5db;
        background: white;
        color: #374151;
        text-decoration: none;
        border-radius: 0.5rem;
        transition: all 0.2s;
    }

    .pagination button:hover,
    .pagination a:hover {
        background-color: #f3f4f6;
        border-color: #ea9427;
        color: #ea9427;
    }

    .pagination .active {
        background-color: #eab308;
        color: white;
        border-color: #eab308;
    }

    /* 按钮组优化 */
    .button-group {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .button-group .btn {
        width: 100%;
    }

    /* 表单组优化 */
    .form-group {
        margin-bottom: 1.5rem;
    }

    .form-label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
        color: #374151;
    }

    .form-input,
    .form-textarea,
    .form-select {
        width: 100%;
        padding: 0.75rem;
        border: 1px solid #d1d5db;
        border-radius: 0.5rem;
        font-size: 16px;
        transition: border-color 0.2s;
    }

    .form-input:focus,
    .form-textarea:focus,
    .form-select:focus {
        outline: none;
        border-color: #ea9427;
        box-shadow: 0 0 0 3px rgba(234, 148, 39, 0.1);
    }

    /* 面包屑导航优化 */
    .breadcrumb {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 1rem;
        padding: 1rem;
        background-color: #f9fafb;
        border-radius: 0.5rem;
        flex-wrap: wrap;
    }

    .breadcrumb a {
        color: #6b7280;
        text-decoration: none;
    }

    .breadcrumb a:hover {
        color: #ea9427;
    }

    .breadcrumb .separator {
        color: #d1d5db;
    }

    .breadcrumb .current {
        color: #374151;
        font-weight: 500;
    }

    /* 加载动画 */
    .loading {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100px;
    }

    .loading::after {
        content: "";
        width: 30px;
        height: 30px;
        border: 3px solid #f3f4f6;
        border-top-color: #ea9427;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    @keyframes spin {
        to {
            transform: rotate(360deg);
        }
    }

    /* 空状态 */
    .empty-state {
        text-align: center;
        padding: 3rem 1rem;
        color: #6b7280;
    }

    .empty-state-icon {
        width: 64px;
        height: 64px;
        margin: 0 auto 1rem;
        opacity: 0.5;
    }

    .empty-state-title {
        font-size: 1.125rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }

    .empty-state-description {
        color: #9ca3af;
        margin-bottom: 1.5rem;
    }

    /* 工具类 */
    .mobile-only {
        display: block !important;
    }

    .desktop-only {
        display: none !important;
    }

    .text-break {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .text-ellipsis {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .text-ellipsis-2 {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .text-ellipsis-3 {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

/* 平板设备优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 1.875rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    .hero-section {
        height: 60vh !important;
    }
}

/* 大屏设备 */
@media (min-width: 1025px) {
    .mobile-only {
        display: none !important;
    }

    .desktop-only {
        display: block !important;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        height: 80vh !important;
    }

    .nav-menu {
        max-height: 50vh;
        overflow-y: auto;
    }
}

/* 触摸设备特定优化 */
@media (hover: none) and (pointer: coarse) {

    /* 移除悬停效果 */
    .hover\:bg-gray-50:hover {
        background-color: transparent !important;
    }

    .hover\:shadow-lg:hover {
        box-shadow: none !important;
    }

    /* 增强触摸反馈 */
    .btn:active,
    button:active,
    a.btn:active {
        transform: scale(0.98);
        background-color: #d17d1f;
    }

    /* 增大可点击区域 */
    .clickable {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1f2937;
        --bg-secondary: #111827;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --border-color: #374151;
    }

    body {
        background-color: var(--bg-primary);
        color: var(--text-primary);
    }

    .card {
        background-color: var(--bg-secondary);
        border-color: var(--border-color);
    }

    .form-input,
    .form-textarea,
    .form-select {
        background-color: var(--bg-secondary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }

    .nav-menu {
        background-color: var(--bg-secondary);
        border-color: var(--border-color);
    }

    .nav-menu a {
        color: var(--text-secondary);
    }

    .nav-menu a:hover {
        background-color: var(--bg-primary);
        color: var(--text-primary);
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --border-width: 2px;
        --focus-outline: 3px;
    }

    .btn,
    button,
    input,
    textarea,
    select {
        border-width: var(--border-width);
    }

    .btn:focus,
    button:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: var(--focus-outline) solid currentColor;
        outline-offset: 2px;
    }
}

/* 减少动画支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}