/**
 * 学员端统一响应式样式 - 全面优化版
 * 支持手机、平板、电脑全设备适配
 * 修复页面显示一半、内容截断等问题
 */

/* ========== 基础布局 ========== */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

/* 顶部导航栏 */
.student-navbar {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.student-brand {
    font-size: 20px;
    font-weight: bold;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.student-nav {
    display: flex;
    list-style: none;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.student-nav a {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.student-nav a:hover,
.student-nav a.active {
    background: rgba(0, 242, 255, 0.1);
    color: var(--primary-color);
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    background: var(--gradient-1);
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 主内容区 */
.student-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ========== 平板端适配 (768px - 1023px) ========== */
@media (min-width: 768px) and (max-width: 1023px) {
    .student-navbar {
        padding: 15px 20px;
    }
    
    .student-container {
        padding: 20px;
    }
    
    .dashboard {
        padding: 20px !important;
    }
    
    .student-nav {
        gap: 10px;
    }
    
    .student-nav a {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* ========== 移动端适配 (< 768px) ========== */
@media (max-width: 767px) {
    .student-navbar {
        padding: 12px 15px !important;
        flex-wrap: wrap !important;
    }
    
    .student-brand {
        font-size: 16px !important;
        max-width: 60% !important;
    }
    
    .student-nav {
        display: none !important;
        width: 100% !important;
        flex-direction: column !important;
        gap: 8px !important;
        margin-top: 12px !important;
        padding-top: 12px !important;
        border-top: 1px solid rgba(0, 242, 255, 0.2) !important;
    }
    
    .student-nav.show {
        display: flex !important;
    }
    
    .student-nav a {
        padding: 12px 15px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
    
    .student-container {
        padding: 15px !important;
        width: 100% !important;
    }
    
    /* 仪表盘适配 */
    .dashboard {
        padding: 15px !important;
    }
    
    .welcome-banner {
        padding: 20px 15px !important;
    }
    
    .welcome-banner h2 {
        font-size: 20px !important;
    }
    
    /* 网格布局适配 - 防止内容溢出 */
    .dashboard [style*="grid-template-columns"],
    [style*="display: grid"] {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* 卡片适配 */
    .card, .glass-card {
        padding: 15px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* 模态框适配 */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 5% auto !important;
        padding: 20px 15px !important;
        max-height: 90vh !important;
        max-height: 90dvh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .modal-footer {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .modal-footer button {
        width: 100% !important;
        min-height: 44px !important;
    }
    
    /* 表单适配 */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important; /* 防止iOS自动缩放 */
        padding: 12px 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        -webkit-appearance: none !important;
        min-height: 44px !important;
    }
    
    /* 按钮适配 */
    .btn, button {
        min-height: 44px !important;
        padding: 12px 16px !important;
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }
    
    /* 表格适配 - 防止横向溢出 */
    table, .data-table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* 警告框适配 */
    .alert {
        padding: 12px !important;
        font-size: 14px !important;
        word-break: break-word !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* 预约卡片适配 */
    .booking-card {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    /* 考试状态卡片适配 */
    .exam-status-card {
        padding: 15px !important;
    }
    
    /* 个人中心适配 */
    .profile-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }
    
    .profile-avatar {
        width: 80px !important;
        height: 80px !important;
    }
    
    .profile-name {
        font-size: 20px !important;
        margin-top: 10px !important;
    }
}

/* ========== 小屏手机适配 (< 480px) ========== */
@media (max-width: 479px) {
    .student-navbar {
        padding: 10px 12px;
    }
    
    .student-brand {
        font-size: 14px;
        max-width: 55%;
    }
    
    .student-container {
        padding: 10px;
    }
    
    .dashboard {
        padding: 10px !important;
    }
    
    .welcome-banner h2 {
        font-size: 18px !important;
    }
    
    .card, .glass-card {
        padding: 12px !important;
    }
    
    .modal-content {
        padding: 15px 12px !important;
    }
    
    .form-group input,
    .form-group select {
        padding: 10px 8px;
    }
}

/* ========== 横屏手机适配 ========== */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-menu-btn {
        width: 36px;
        height: 36px;
        padding: 0;
    }
    
    .student-nav {
        margin-top: 8px;
        padding-top: 8px;
    }
    
    .student-container {
        padding: 10px;
    }
    
    .modal-content {
        margin: 2% auto !important;
        max-height: 95vh;
        max-height: 95dvh;
    }
}

/* ========== 触摸设备优化 ========== */
@media (hover: none) and (pointer: coarse) {
    .student-nav a {
        min-height: 44px;
    }
    
    .btn, .card {
        min-height: 44px;
    }
    
    /* 增大表单元素触控区域 */
    input[type="date"],
    input[type="time"],
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="tel"],
    select,
    textarea {
        min-height: 44px;
    }
}

/* ========== 打印优化 ========== */
@media print {
    .student-navbar,
    .mobile-menu-btn {
        display: none !important;
    }
    
    .student-container {
        padding: 0 !important;
    }
    
    body {
        background: #fff !important;
        color: #000 !important;
    }
}

/* ========== 底部备案号 ========== */
.student-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 1px solid rgba(0, 242, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    width: 100%;
    box-sizing: border-box;
}

.student-footer .icp-license {
    font-size: 13px;
    color: var(--text-secondary);
}

.student-footer .icp-license a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.student-footer .icp-license a:hover {
    color: var(--text-color);
    text-decoration: underline;
}

@media (max-width: 767px) {
    .student-footer {
        padding: 15px;
        margin-top: 20px;
    }
    
    .student-footer .icp-license {
        font-size: 12px;
    }
}

/* ========== 全局防溢出修复 ========== */
.student-container * {
    max-width: 100%;
    box-sizing: border-box;
}

/* 图片响应式 */
.student-container img {
    max-width: 100%;
    height: auto;
}

/* 修复 flex 容器溢出 */
.student-container > div {
    width: 100%;
    max-width: 100%;
}

/* 修复长文本溢出 */
.student-container p,
.student-container span,
.student-container div {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 修复 iOS Safari 视口问题 */
@supports (-webkit-touch-callout: none) {
    .student-container {
        min-height: -webkit-fill-available;
    }
}

/* ========== 取消通知弹窗适配 ========== */
@media (max-width: 767px) {
    .cancel-notice-card {
        padding: 20px;
        width: 95%;
        max-width: 95%;
    }
    
    .cancel-notice-header h3 {
        font-size: 18px;
    }
    
    .cancel-notice-details p {
        font-size: 13px;
    }
    
    .cancel-notice-btn {
        padding: 12px 20px;
        width: 100%;
    }
}
