/* CSS for mobile optimization */

/* PC端结果网格优化 - 处理少量结果时的布局 */
@media (min-width: 1280px) {
    /* 基础网格设置 */
    #results-grid {
        justify-items: center;
    }
    
    /* 少量结果时的布局优化 */
    #results-grid.results-1 {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }
    
    #results-grid.results-2 {
        grid-template-columns: repeat(2, 1fr);
        max-width: 800px;
        margin: 0 auto;
    }
    
    #results-grid.results-3 {
        grid-template-columns: repeat(3, 1fr);
        max-width: 1200px;
        margin: 0 auto;
    }
    
    /* 4个或更多结果时保持默认布局 */
    #results-grid.results-many {
        grid-template-columns: repeat(3, 1fr);
        max-width: none;
        margin: 0;
    }
}

/* 确保酒店卡片在所有情况下都有合适的最大宽度 */
.hotel-card {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}

/* 中等屏幕的优化 */
@media (min-width: 768px) and (max-width: 1279px) {
    #results-grid.results-1 {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }
    
    #results-grid.results-2 {
        grid-template-columns: repeat(2, 1fr);
        max-width: 800px;
        margin: 0 auto;
    }
    
    #results-grid.results-3 {
        grid-template-columns: repeat(2, 1fr);
        max-width: 800px;
        margin: 0 auto;
    }
}

/* 移动端头部优化 */
@media (max-width: 768px) {
    /* 头部布局调整 */
    .mobile-header {
        padding: 12px 16px;
    }
    
    .mobile-header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
    }
    
    .mobile-header-bottom {
        display: flex;
        gap: 8px;
        align-items: center;
    }
    
    /* 隐藏副标题 */
    .mobile-hide-subtitle {
        display: none;
    }
    
    /* 搜索栏移动端优化 */
    .mobile-search-input {
        flex: 1;
        padding: 10px 12px;
        padding-left: 40px;
        border-radius: 8px;
        font-size: 16px; /* 防止iOS自动缩放 */
        min-height: 44px; /* 触摸友好 */
    }
    
    /* 语言切换按钮 */
    .mobile-language-btn {
        padding: 10px 14px;
        border-radius: 8px;
        font-size: 14px;
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 筛选器切换按钮优化 */
    .mobile-filter-toggle {
        padding: 14px 16px;
        border-radius: 12px;
        font-size: 16px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
    }
    
    .mobile-filter-toggle:active {
        transform: translateY(1px);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }
    
    /* 筛选器图标 */
    .mobile-filter-icon {
        width: 20px;
        height: 20px;
        transition: transform 0.3s ease;
    }
    
    .mobile-filter-toggle.active .mobile-filter-icon {
        transform: rotate(180deg);
    }
}

/* 平板端优化 */
@media (max-width: 1023px) and (min-width: 769px) {
    /* 平板端保持原有布局，稍作调整 */
    .tablet-header {
        padding: 16px;
    }
    
    .tablet-search-input {
        width: 200px;
    }
}

/* 原有样式 - PC端和平板端 */
@media (max-width: 1023px) {
    .lg\:grid-cols-12 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .lg\:col-span-3,
    .lg\:col-span-9 {
        grid-column: span 1 / span 1;
    }

    #filters-container {
        position: static;
        max-height: none;
        margin-bottom: 1rem;
        overflow: hidden;
        transition: max-height 0.5s ease-in-out;
    }

    .filters-hidden #filters-container {
        max-height: 0;
        margin-bottom: 0;
        padding: 0;
        border: none;
    }
}

/* 移动端筛选器抽屉化 - 确保PC端完全隐藏 */
/* PC端强制隐藏移动端抽屉 */
@media (min-width: 769px) {
    .mobile-drawer-overlay,
    .mobile-drawer,
    #mobile-filter-drawer-overlay,
    #mobile-filter-drawer,
    #mobile-filters-content {
        display: none !important;
        visibility: hidden !important;
    }
}

@media (max-width: 768px) {
    /* 隐藏原有筛选器容器 */
    .mobile-hide-filters #filters-container {
        display: none;
    }
    
    /* 抽屉式筛选器遮罩 */
    .mobile-drawer-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 100;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-drawer-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* 抽屉式筛选器容器 */
    .mobile-drawer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        max-height: 95vh;
        z-index: 101;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
        transform: translateY(100%);
        transition: transform 0.3s ease;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .mobile-drawer.active {
        transform: translateY(0);
    }
    
    /* 抽屉头部 */
    .mobile-drawer-header {
        padding: 16px 20px;
        border-bottom: 1px solid #e5e7eb;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: white;
        flex-shrink: 0;
        z-index: 10;
    }
    
    .mobile-drawer-title {
        font-size: 18px;
        font-weight: 600;
        color: #1f2937;
    }
    
    .mobile-drawer-close {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: #f3f4f6;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .mobile-drawer-close:hover {
        background: #e5e7eb;
    }
    
    .mobile-drawer-close:active {
        transform: scale(0.95);
    }
    
    /* 抽屉内容区域 */
    .mobile-drawer-content {
        padding: 0 20px 20px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }
    
    /* 改善移动端滚动条显示 */
    .mobile-drawer-content::-webkit-scrollbar {
        width: 6px;
    }
    
    .mobile-drawer-content::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    .mobile-drawer-content::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
    }
    
    .mobile-drawer-content::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
    
    /* 抽屉底部操作区 */
    .mobile-drawer-footer {
        padding: 16px 20px;
        background: white;
        border-top: 1px solid #e5e7eb;
        display: flex;
        gap: 12px;
        flex-shrink: 0;
        bottom: 0;
        z-index: 10;
    }
    
    .mobile-drawer-btn {
        flex: 1;
        padding: 12px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 500;
        transition: all 0.2s ease;
        border: none;
        cursor: pointer;
        min-height: 44px;
    }
    
    .mobile-drawer-btn-reset {
        background: #f3f4f6;
        color: #4b5563;
    }
    
    .mobile-drawer-btn-reset:hover {
        background: #e5e7eb;
    }
    
    .mobile-drawer-btn-apply {
        background: #0ea5e9;
        color: white;
    }
    
    .mobile-drawer-btn-apply:hover {
        background: #0284c7;
    }
    
    .mobile-drawer-btn:active {
        transform: translateY(1px);
    }
    
    /* 抽屉内筛选器样式优化 */
    .mobile-drawer-content .space-y-4 > * {
        margin-bottom: 20px;
    }
    
    .mobile-drawer-content details {
        margin-bottom: 16px;
    }
    
    .mobile-drawer-content details summary {
        font-size: 16px;
        font-weight: 600;
        padding: 12px 0;
        cursor: pointer;
        user-select: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .mobile-drawer-content details summary::after {
        content: '+';
        font-size: 18px;
        font-weight: bold;
        color: #6b7280;
        transition: transform 0.2s ease;
    }
    
    .mobile-drawer-content details[open] summary::after {
        transform: rotate(45deg);
    }
    
    /* 筛选器输入框优化 */
    .mobile-drawer-content input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin-right: 12px;
    }
    
    .mobile-drawer-content input[type="range"] {
        height: 8px;
        margin: 8px 0;
    }
    
    .mobile-drawer-content label {
        display: flex;
        align-items: center;
        padding: 8px 0;
        font-size: 15px;
        line-height: 1.4;
        cursor: pointer;
        user-select: none;
        min-height: 44px;
    }
    
    .mobile-drawer-content select {
        min-height: 44px;
        font-size: 16px;
        padding: 10px 12px;
    }
    
    .mobile-drawer-content input[type="number"] {
        min-height: 44px;
        font-size: 16px;
        padding: 10px 12px;
    }
}

/* 移动端搜索结果优化 */
@media (max-width: 768px) {
    /* 结果区域布局 */
    .mobile-results-container {
        padding: 0 12px;
    }
    
    /* 结果网格优化 */
    .mobile-results-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
        max-width: none !important;
        margin: 0 !important;
    }
    
    /* 移动端强制覆盖PC端的results-1, results-2, results-3类 */
    #results-grid.results-1,
    #results-grid.results-2, 
    #results-grid.results-3,
    #results-grid.results-many {
        grid-template-columns: 1fr !important;
        max-width: none !important;
        margin: 0 !important;
    }
    
    /* 酒店卡片移动端优化 */
    .mobile-hotel-card {
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        transition: all 0.3s ease;
        background: white;
    }
    
    .mobile-hotel-card:active {
        transform: translateY(1px);
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
    }
    
    /* 酒店图片优化 */
    .mobile-hotel-image {
        height: 200px;
        object-fit: cover;
        width: 100%;
    }
    
    /* 酒店信息区域 */
    .mobile-hotel-content {
        padding: 16px;
    }
    
    .mobile-hotel-title {
        font-size: 16px;
        font-weight: 600;
        line-height: 1.4;
        margin-bottom: 8px;
        color: #1f2937;
    }
    
    .mobile-hotel-group {
        font-size: 13px;
        color: #6b7280;
        margin-bottom: 12px;
    }
    
    /* 酒店操作区域 */
    .mobile-hotel-actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .mobile-hotel-price {
        font-size: 16px;
        font-weight: 600;
        color: #0ea5e9;
    }
    
    /* 移动端按钮优化 */
    .mobile-btn {
        min-height: 44px;
        min-width: 44px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        padding: 10px 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        cursor: pointer;
        user-select: none;
    }
    
    .mobile-btn:active {
        transform: translateY(1px);
    }
    
    .mobile-btn-primary {
        background: #0ea5e9;
        color: white;
        border: none;
    }
    
    .mobile-btn-primary:hover {
        background: #0284c7;
    }
    
    .mobile-btn-secondary {
        background: #f3f4f6;
        color: #4b5563;
        border: 1px solid #d1d5db;
    }
    
    .mobile-btn-secondary:hover {
        background: #e5e7eb;
    }
    
    /* 收藏和对比按钮 */
    .mobile-action-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(8px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
        position: absolute;
        top: 12px;
    }
    
    .mobile-action-btn:active {
        transform: scale(0.95);
    }
    
    .mobile-favorite-btn {
        right: 12px;
    }
    
    .mobile-compare-btn {
        right: 12px;
    }
    
    .mobile-action-btn.active {
        background: #ef4444;
        color: white;
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    }
    
    /* 对比按钮选中状态 */
    .mobile-compare-btn.selected {
        background: #0ea5e9 !important;
        color: white !important;
        box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
        transform: scale(1.05);
    }
    
    .mobile-favorite-btn.active {
        background: #ef4444;
        color: white;
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    }
    
    /* 排序和筛选区域 */
    .mobile-sort-filter-bar {
        padding: 12px 16px;
        background: white;
        border-bottom: 1px solid #e5e7eb;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }
    
    .mobile-results-count {
        font-size: 14px;
        color: #4b5563;
        flex: 1;
    }
    
    .mobile-sort-select {
        padding: 8px 12px;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        background: white;
        font-size: 14px;
        min-height: 36px;
    }
    
    /* 加载更多按钮 */
    .mobile-load-more {
        margin: 20px auto;
        display: block;
        width: calc(100% - 32px);
        max-width: 280px;
        background: #f8fafc;
        color: #4b5563;
        border: 1px solid #e2e8f0;
    }
    
    .mobile-load-more:hover {
        background: #f1f5f9;
    }
    
    /* 没有结果提示 */
    .mobile-no-results {
        text-align: center;
        padding: 40px 20px;
        color: #6b7280;
    }
    
    .mobile-no-results-icon {
        font-size: 48px;
        margin-bottom: 16px;
        opacity: 0.5;
    }
    
    .mobile-no-results-title {
        font-size: 18px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #374151;
    }
    
    .mobile-no-results-desc {
        font-size: 14px;
        line-height: 1.5;
    }
}

/* Pro restriction styles */
.blurred-card {
    filter: blur(5px);
    pointer-events: none;
    opacity: 0.6;
}
