/* mobile.css - 移动端全面适配样式 */
/* 适用于所有页面，触摸友好优化 */

/* ====== 基础设置 ====== */
@media (max-width: 768px) {
    /* 触摸优化 */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    input, textarea, select {
        -webkit-user-select: auto;
        user-select: auto;
    }
    
    /* 字体大小优化 */
    html {
        font-size: 16px; /* 防止 iOS 缩放 */
    }
    
    body {
        font-size: 15px;
        line-height: 1.6;
    }
    
    /* 容器优化 */
    .container {
        padding: 0 16px;
    }
    
    /* Header 优化 */
    .header {
        padding: 40px 0 30px;
    }
    
    .header h1 {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    .subtitle {
        font-size: 1rem;
        padding: 0 10px;
    }
}

/* ====== 按钮触摸优化 ====== */
@media (max-width: 768px) {
    .btn {
        min-height: 48px; /* 触摸友好最小高度 */
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn-lg {
        min-height: 52px;
        padding: 14px 24px;
        font-size: 16px;
    }
    
    /* 按钮组垂直排列 */
    .btn-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    /* 操作按钮间距 */
    .btn + .btn {
        margin-left: 0;
        margin-top: 12px;
    }
}

/* ====== 表单移动端优化 ====== */
@media (max-width: 768px) {
    /* 输入框优化 */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px; /* 防止 iOS 自动缩放 */
        min-height: 48px;
        padding: 12px 16px;
        border-radius: 10px;
    }
    
    textarea {
        min-height: 120px;
        resize: vertical;
    }
    
    /* 表单组 */
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        display: block;
        margin-bottom: 8px;
        font-size: 15px;
        font-weight: 600;
    }
    
    /* 表单行垂直排列 */
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    /* 单选/复选框 */
    .radio-group,
    .checkbox-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .radio-group label,
    .checkbox-group label {
        display: flex;
        align-items: center;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 8px;
        min-height: 48px;
    }
    
    .radio-group input,
    .checkbox-group input {
        width: 20px;
        height: 20px;
        margin-right: 12px;
    }
    
    /* 输入选项按钮 */
    .input-options {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .input-options button {
        min-height: 40px;
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* ====== 卡片移动端优化 ====== */
@media (max-width: 768px) {
    .card {
        padding: 20px;
        border-radius: 12px;
    }
    
    /* 卡片网格单列 */
    .cards-grid,
    .actions-grid,
    .stats-grid,
    .packages-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* 卡片内容 */
    .card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .card-body {
        padding: 16px 0 0;
    }
    
    /* 点数卡片 */
    .points-card {
        padding: 24px 20px;
    }
    
    .points-number {
        font-size: 2.5rem;
    }
    
    .points-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .points-actions .btn {
        width: 100%;
    }
}

/* ====== 表格移动端优化 ====== */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    table {
        min-width: 600px;
        font-size: 14px;
    }
    
    th, td {
        padding: 12px 8px;
        white-space: nowrap;
    }
    
    /* 表格操作列 */
    .table-actions {
        white-space: nowrap;
    }
    
    .table-actions .btn {
        padding: 6px 12px;
        font-size: 13px;
        min-height: 36px;
    }
}

/* ====== 导航栏移动端优化 ====== */
@media (max-width: 768px) {
    .navbar {
        padding: 12px 16px;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-toggle {
        display: block;
        min-height: 44px;
        min-width: 44px;
        padding: 10px;
    }
    
    .navbar-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .navbar-menu.active {
        max-height: 400px;
    }
    
    .navbar-nav {
        flex-direction: column;
        padding: 16px;
    }
    
    .navbar-nav li {
        margin: 0;
    }
    
    .navbar-nav a {
        display: block;
        padding: 14px 16px;
        min-height: 48px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .navbar-actions {
        flex-direction: column;
        padding: 16px;
        gap: 12px;
    }
    
    .navbar-actions .btn {
        width: 100%;
        min-height: 48px;
    }
}

/* ====== 侧边栏移动端优化（管理后台） ====== */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 100%;
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        z-index: 1000;
        transition: transform 0.3s ease;
        overflow-y: auto;
    }
    
    .admin-sidebar.active {
        transform: translateX(100%);
    }
    
    .admin-main {
        margin-left: 0;
        padding-top: 60px;
    }
    
    .admin-sidebar-toggle {
        display: block;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1001;
        min-height: 44px;
        min-width: 44px;
    }
    
    .admin-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .admin-sidebar-overlay.active {
        display: block;
    }
}

/* ====== 模态框移动端优化 ====== */
@media (max-width: 768px) {
    .modal-content {
        margin: 20px 16px;
        max-width: calc(100% - 32px);
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 16px;
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-body {
        padding: 20px 16px;
    }
    
    .modal-footer {
        flex-direction: column;
        padding: 16px;
        gap: 12px;
    }
    
    .modal-footer .btn {
        width: 100%;
        min-height: 48px;
    }
}

/* ====== 列表项移动端优化 ====== */
@media (max-width: 768px) {
    .list-item {
        flex-direction: column;
        padding: 16px;
        gap: 12px;
    }
    
    .list-item-content {
        width: 100%;
    }
    
    .list-item-actions {
        width: 100%;
        flex-direction: row;
        gap: 8px;
    }
    
    .list-item-actions .btn {
        flex: 1;
        min-height: 40px;
    }
}

/* ====== 进度条移动端优化 ====== */
@media (max-width: 768px) {
    .progress-container {
        padding: 20px 16px;
    }
    
    .progress-bar {
        height: 12px;
        border-radius: 6px;
    }
    
    .progress-fill {
        height: 100%;
        border-radius: 6px;
    }
}

/* ====== 分页移动端优化 ====== */
@media (max-width: 768px) {
    .pagination-controls {
        flex-direction: column;
        gap: 16px;
    }
    
    .pagination-info {
        text-align: center;
        width: 100%;
    }
    
    .page-size-group {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .pagination button {
        min-height: 40px;
        min-width: 40px;
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* ====== Toast 移动端优化 ====== */
@media (max-width: 768px) {
    .toast-container {
        left: 16px;
        right: 16px;
        top: 10px;
        max-width: none;
    }
    
    .toast {
        padding: 14px 16px;
        min-width: auto;
    }
    
    .toast-title {
        font-size: 14px;
    }
    
    .toast-message {
        font-size: 13px;
    }
    
    .toast-actions {
        flex-direction: column;
    }
    
    .toast-actions .btn {
        width: 100%;
        min-height: 40px;
    }
}

/* ====== 骨架屏移动端优化 ====== */
@media (max-width: 768px) {
    .skeleton-card {
        padding: 16px;
    }
    
    .skeleton-card-image {
        height: 120px;
    }
    
    .dashboard-skeleton .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .history-skeleton .history-item-skeleton {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .history-skeleton .skeleton-history-action {
        width: 100%;
    }
}

/* ====== 图片响应式加载 ====== */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
    
    .hero-image,
    .banner-image {
        height: auto;
        max-height: 300px;
        object-fit: cover;
    }
    
    .avatar {
        width: 48px;
        height: 48px;
    }
    
    .avatar.large {
        width: 64px;
        height: 64px;
    }
}

/* ====== 字体响应式 ====== */
@media (max-width: 768px) {
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    
    .text-lg { font-size: 1rem; }
    .text-xl { font-size: 1.1rem; }
    .text-2xl { font-size: 1.25rem; }
}

/* ====== 间距优化 ====== */
@media (max-width: 768px) {
    .section {
        padding: 40px 0;
    }
    
    .py-5 { padding-top: 32px !important; padding-bottom: 32px !important; }
    .py-6 { padding-top: 40px !important; padding-bottom: 40px !important; }
    
    .mb-4 { margin-bottom: 16px !important; }
    .mb-5 { margin-bottom: 20px !important; }
    .mb-6 { margin-bottom: 24px !important; }
    
    .mt-4 { margin-top: 16px !important; }
    .mt-5 { margin-top: 20px !important; }
    .mt-6 { margin-top: 24px !important; }
}

/* ====== 打印样式 ====== */
@media print {
    .navbar,
    .sidebar,
    .btn,
    .no-print,
    .toast-container {
        display: none !important;
    }
}

/* ====== 横屏优化 ====== */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        max-height: 90vh;
    }
    
    .navbar-menu {
        max-height: 300px;
    }
    
    .header {
        padding: 20px 0;
    }
}
