/**
 * Apply页面移动端响应式样式
 * 作者: System
 * 日期: 2025-12-15
 */

/* ==================== 断点定义 ==================== */
/* 
 * 移动端: < 768px
 * 平板端: 768px - 1024px
 * 桌面端: > 1024px
 */

/* ==================== 基础重置 ==================== */
* {
    box-sizing: border-box;
}

/* ==================== 响应式工具类 ==================== */
.mobile-only {
    display: none !important;
}

.tablet-only {
    display: none !important;
}

.desktop-only {
    display: block !important;
}

@media (max-width: 767px) {
    .mobile-only {
        display: block !important;
    }
    .mobile-hide {
        display: none !important;
    }
    .desktop-only {
        display: none !important;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .tablet-only {
        display: block !important;
    }
    .tablet-hide {
        display: none !important;
    }
}

/* ==================== 基础网格系统 ==================== */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col {
    flex: 1;
    padding-right: 15px;
    padding-left: 15px;
}

/* 移动端单列布局 */
@media (max-width: 767px) {
    .col {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ==================== 容器自适应 ==================== */
.apply-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

@media (max-width: 767px) {
    .apply-container {
        padding: 15px;
    }
}

/* ==================== 表单响应式 ==================== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 767px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.form-group {
    margin-bottom: 20px;
}

@media (max-width: 767px) {
    .form-group {
        margin-bottom: 15px;
    }
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px; /* 防止iOS自动缩放 */
}

@media (max-width: 767px) {
    .form-control {
        padding: 10px 12px;
    }
}

/* ==================== 卡片响应式 ==================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

@media (max-width: 767px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

@media (max-width: 767px) {
    .card {
        padding: 15px;
        border-radius: 8px;
    }
}

/* ==================== 导航响应式 ==================== */
.apply-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

@media (max-width: 767px) {
    .apply-nav {
        flex-wrap: wrap;
        padding: 0 15px;
    }
}

.apply-nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
}

@media (max-width: 767px) {
    .apply-nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
    }
    
    .apply-nav-menu.active {
        display: flex;
    }
}

/* ==================== 按钮响应式 ==================== */
.btn {
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
}

@media (max-width: 767px) {
    .btn {
        padding: 10px 20px;
        font-size: 14px;
        width: 100%; /* 移动端全宽按钮 */
    }
    
    .btn-group .btn {
        width: auto; /* 按钮组除外 */
    }
}

/* ==================== 表格响应式 ==================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
    table {
        font-size: 14px;
    }
    
    table th,
    table td {
        padding: 8px;
    }
}

/* ==================== 文字响应式 ==================== */
h1 {
    font-size: 2.5em;
}

h2 {
    font-size: 2em;
}

h3 {
    font-size: 1.5em;
}

@media (max-width: 767px) {
    h1 {
        font-size: 1.8em;
    }
    
    h2 {
        font-size: 1.5em;
    }
    
    h3 {
        font-size: 1.3em;
    }
}

/* ==================== 间距响应式 ==================== */
.section {
    padding: 60px 0;
}

@media (max-width: 767px) {
    .section {
        padding: 40px 0;
    }
}

/* ==================== 图片响应式 ==================== */
img {
    max-width: 100%;
    height: auto;
}

/* ==================== 触摸优化 ==================== */
@media (max-width: 767px) {
    /* 增大可点击区域 */
    a, button, input[type="submit"], input[type="button"] {
        min-height: 44px; /* iOS推荐最小触摸目标 */
        min-width: 44px;
    }
    
    /* 移除点击高亮 */
    * {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ==================== 输入框优化 ==================== */
@media (max-width: 767px) {
    /* 防止iOS输入框放大 */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* ==================== 模态框响应式 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal-content {
    max-width: 600px;
    margin: 50px auto;
    padding: 30px;
}

@media (max-width: 767px) {
    .modal-content {
        max-width: 100%;
        margin: 0;
        padding: 20px;
        height: 100%;
        border-radius: 0;
    }
}

/* ==================== 加载动画 ==================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.1);
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 工具类 ==================== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

@media (max-width: 767px) {
    .mobile-text-center {
        text-align: center;
    }
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* ==================== 侧边栏导航 ==================== */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background: #fff;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1001;
    overflow-y: auto;
}

.mobile-sidebar.active {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==================== 菜单遮罩层 ==================== */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

body.menu-open,
body.sidebar-open {
    overflow: hidden;
}

/* ==================== 底部导航栏 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: none;
    z-index: 998;
}

@media (max-width: 767px) {
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        padding: 10px 0;
    }
    
    .bottom-nav a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 8px;
        color: #666;
        text-decoration: none;
        font-size: 12px;
    }
    
    .bottom-nav a.active {
        color: #667eea;
    }
    
    .bottom-nav a i {
        font-size: 24px;
        margin-bottom: 4px;
    }
    
    /* 为底部导航留出空间 */
    body {
        padding-bottom: 60px;
    }
}

/* ==================== 面包屑导航 ==================== */
.breadcrumb {
    display: flex;
    align-items: center;
    padding: 10px 0;
    font-size: 14px;
    overflow: hidden;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
}

.breadcrumb span {
    margin: 0 8px;
    color: #999;
}

@media (max-width: 767px) {
    .breadcrumb {
        white-space: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .breadcrumb:not(.expanded) {
        max-width: 200px;
    }
    
    .breadcrumb.expanded {
        max-width: 100%;
    }
}

/* ==================== 返回按钮 ==================== */
.back-button {
    display: none;
    align-items: center;
    padding: 10px;
    color: #667eea;
    cursor: pointer;
}

@media (max-width: 767px) {
    .back-button {
        display: flex;
    }
}

/* ==================== 固定顶部导航 ==================== */
@media (max-width: 767px) {
    .apply-nav {
        position: sticky;
        top: 0;
        z-index: 997;
        transition: transform 0.3s ease;
    }
}

/* ==================== 菜单动画 ==================== */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

.mobile-sidebar.active {
    animation: slideInLeft 0.3s ease;
}

/* ==================== 触摸反馈 ==================== */
.touch-active {
    opacity: 0.7;
    transform: scale(0.98);
}

/* ==================== 平板端优化 ==================== */
@media (min-width: 768px) and (max-width: 1024px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
