/* 移动端优化样式 */

/* 基础移动端优化 */
@media (max-width: 768px) {
    /* 全局字体和间距优化 */
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* 按钮优化 */
    .btn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 44px; /* 符合触摸标准 */
    }
    
    .btn-sm {
        padding: 8px 16px;
        font-size: 14px;
        min-height: 36px;
    }
    
    /* 表单优化 */
    .form-control {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 12px 15px;
        min-height: 44px;
        border-radius: 0.375rem;
        border: 1px solid #ced4da;
        transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    }
    
    .form-control:focus {
        border-color: #86b7fe;
        outline: 0;
        box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    }
    
    .form-label {
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: #495057;
    }
    
    .form-text {
        font-size: 0.875rem;
        color: #6c757d;
    }
    
    .form-select {
        font-size: 16px;
        padding: 12px 15px;
        min-height: 44px;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 16px 12px;
    }
    
    /* 表单组优化 */
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .input-group {
        position: relative;
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        width: 100%;
    }
    
    .input-group .form-control {
        position: relative;
        flex: 1 1 auto;
        width: 1%;
        min-width: 0;
    }
    
    .input-group-text {
        display: flex;
        align-items: center;
        padding: 12px 15px;
        font-size: 1rem;
        font-weight: 400;
        line-height: 1.5;
        color: #495057;
        text-align: center;
        white-space: nowrap;
        background-color: #e9ecef;
        border: 1px solid #ced4da;
        border-radius: 0.375rem;
    }
    
    /* 复选框和单选框优化 */
    .form-check {
        display: block;
        min-height: 1.5rem;
        padding-left: 1.5em;
        margin-bottom: 0.125rem;
    }
    
    .form-check-input {
        width: 1.2em;
        height: 1.2em;
        margin-top: 0.25em;
        vertical-align: top;
        background-color: #fff;
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        border: 1px solid rgba(0, 0, 0, 0.25);
        appearance: none;
    }
    
    .form-check-input[type="checkbox"] {
        border-radius: 0.25em;
    }
    
    .form-check-input[type="radio"] {
        border-radius: 50%;
    }
    
    .form-check-input:checked {
        background-color: #0d6efd;
        border-color: #0d6efd;
    }
    
    .form-check-label {
        color: #495057;
        cursor: pointer;
        font-size: 16px;
    }
    
    /* 卡片优化 */
    .card {
        margin-bottom: 20px;
        border-radius: 12px;
    }
    
    .card-body {
        padding: 20px 15px;
    }
    
    /* 导航栏优化 */
    .navbar-nav .nav-link {
        padding: 15px 20px;
        font-size: 16px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .navbar-toggler {
        padding: 8px 12px;
        border: none;
    }
    
    /* 英雄区域优化 */
    .hero-section {
        padding: 60px 0;
        text-align: center;
    }
    
    .hero-section .display-4 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-section .lead {
        font-size: 1.1rem;
        margin-bottom: 30px;
    }
    
    .hero-section .btn {
        margin-bottom: 10px;
        width: 100%;
        max-width: 280px;
    }
    
    /* 特色卡片优化 */
    .feature-card {
        margin-bottom: 30px;
        text-align: center;
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    /* 活动卡片优化 */
    .activity-card {
        margin-bottom: 20px;
    }
    
    .activity-card .card-body {
        padding: 15px;
    }
    
    .activity-status {
        position: static;
        margin-bottom: 10px;
        text-align: center;
    }
}

/* 小屏幕优化 (手机竖屏) */
@media (max-width: 576px) {
    /* 更小的字体和间距 */
    .hero-section .display-4 {
        font-size: 1.75rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 30px;
    }
    
    /* 按钮全宽 */
    .btn-group-vertical .btn,
    .d-grid .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* 表格优化 */
    .table-responsive {
        border: none;
        margin-bottom: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
        margin-bottom: 0;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        vertical-align: middle;
        border-top: 1px solid #dee2e6;
    }
    
    .table thead th {
        border-bottom: 2px solid #dee2e6;
        font-weight: 600;
        background-color: #f8f9fa;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    /* 隐藏不重要的列 */
    .table .d-none.d-md-table-cell {
        display: none !important;
    }
    
    /* 表格行悬停效果 */
    .table tbody tr:hover {
        background-color: #f5f5f5;
    }
    
    /* 操作按钮优化 */
    .table .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
        margin: 0 0.125rem;
    }
    
    .table .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    /* 状态标签优化 */
    .table .badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }

/* 超小屏幕表格优化 */
@media (max-width: 576px) {
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
    }
    
    /* 将表格转换为卡片式布局 */
    .table-mobile-cards {
        display: none;
    }
    
    .table-mobile-cards.show {
        display: block;
    }
    
    .table-mobile-cards .card {
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
    }
    
    .table-mobile-cards .card-body {
        padding: 1rem;
    }
    
    .table-mobile-cards .card-title {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        color: #495057;
    }
    
    .table-mobile-cards .card-text {
        margin-bottom: 0.25rem;
        font-size: 0.875rem;
    }
    
    .table-mobile-cards .card-text strong {
        color: #6c757d;
        display: inline-block;
        min-width: 80px;
    }
}
    
    /* 模态框优化 */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-body {
        padding: 15px;
    }
    
    /* 分页优化 */
    .pagination {
        justify-content: center;
    }
    
    .pagination .page-link {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* 管理后台移动端优化 */
@media (max-width: 768px) {
    /* 侧边栏优化 */
    .sidebar {
        position: fixed;
        top: 56px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 56px);
        transition: left 0.3s ease;
        z-index: 1050;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .sidebar .nav-link {
        padding: 15px 20px;
        font-size: 16px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    /* 主内容区域 */
    main {
        margin-left: 0;
        padding-top: 56px;
    }
    
    /* 顶部导航栏 */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* 卡片标题 */
    .card-header h5,
    .card-header h4 {
        font-size: 1.1rem;
        margin-bottom: 0;
    }
    
    /* 表单组优化 */
    .row .col-md-6,
    .row .col-md-4,
    .row .col-md-3 {
        margin-bottom: 15px;
    }
    
    /* 操作按钮组 */
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        margin-bottom: 5px;
        border-radius: 6px !important;
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    /* 移除悬停效果，添加触摸反馈 */
    .btn:hover {
        transform: none;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    .card:hover {
        transform: none;
    }
    
    .nav-link:hover {
        background-color: transparent;
    }
    
    .nav-link:active {
        background-color: rgba(255,255,255,0.1);
    }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        padding: 40px 0;
    }
    
    .hero-section .display-4 {
        font-size: 1.8rem;
    }
    
    .sidebar {
        width: 240px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 320px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .card-body {
        padding: 15px 10px;
    }
    
    .btn {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .hero-section .display-4 {
        font-size: 1.5rem;
    }
}

/* 可访问性优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid;
    }
    
    .card {
        border: 1px solid #000;
    }
    
    .nav-link {
        border-bottom: 1px solid;
    }
}

/* 高分辨率屏幕优化 - 解决高DPI手机显示大屏幕样式的问题 */
@media only screen and (max-device-width: 768px) {
    /* 强制移动端样式，即使在高分辨率屏幕上 */
    body {
        font-size: 14px !important;
        line-height: 1.5 !important;
    }
    
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .btn {
        padding: 12px 20px !important;
        font-size: 16px !important;
        min-height: 44px !important;
    }
    
    .form-control {
        font-size: 16px !important;
        padding: 12px 15px !important;
        min-height: 44px !important;
    }
    
    /* 管理后台移动端强制样式 */
    .sidebar {
        position: fixed !important;
        top: 56px !important;
        left: -100% !important;
        width: 280px !important;
        height: calc(100vh - 56px) !important;
        transition: left 0.3s ease !important;
        z-index: 1050 !important;
    }
    
    .sidebar.show {
        left: 0 !important;
    }
    
    main {
        margin-left: 0 !important;
        padding-top: 56px !important;
    }
}

/* 针对高分辨率但小屏幕的设备 */
@media only screen and (max-device-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
    /* 确保在高DPI设备上也使用移动端样式 */
    html {
        -webkit-text-size-adjust: 100% !important;
        -ms-text-size-adjust: 100% !important;
    }
    
    body {
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
    }
}