/* ====== 响应式设计 ====== */

/* 平板端样式 (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 0 var(--spacing-md);
    }
    
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--spacing-lg);
    }
    
    .hero-content h2 {
        font-size: 2.5rem;
    }
    
    .course-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
    
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .footer-content {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* 小平板端样式 (600px - 768px) */
@media (max-width: 768px) {
    /* 导航栏 */
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: var(--shadow-lg);
    }
    
    .nav-menu.active {
        display: block;
        animation: slideIn 0.3s ease-out;
    }
    
    .nav-menu ul {
        flex-direction: column;
        gap: 0;
    }
    
    .nav-menu li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .nav-menu a {
        display: block;
        padding: var(--spacing-md);
        border-radius: 0;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    /* 英雄区域 */
    .hero {
        padding: var(--spacing-lg) 0;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .tech-graphic {
        height: 250px;
    }
    
    .circuit-board {
        width: 200px;
        height: 200px;
    }
    
    .data-flow {
        width: 150px;
        height: 150px;
    }
    
    /* 课程区域 */
    .courses h2 {
        font-size: 2rem;
    }
    
    .course-filters {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .course-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .course-info {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
    
    .course-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* 特色功能 */
    .features h2 {
        font-size: 2rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    /* 表单 */
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* 模态框 */
    .modal.fade .modal-dialog {
        margin: 0.5rem auto;
        max-width: 95%;
    }
    
    .modal.fade .modal-content {
        width: 100%;
        margin: 0;
    }
    
    .modal.fade .modal-body {
        max-height: 60vh;
        padding: var(--spacing-md);
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* 手机端样式 (320px - 600px) */
@media (max-width: 600px) {
    :root {
        --spacing-xs: 0.25rem;
        --spacing-sm: 0.75rem;
        --spacing-md: 1rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
    }
    
    body {
        padding-top: 70px;
        min-width: 380px;
        overflow-x: auto;
    }
    
    /* 移动端非首页的主要内容区域 */
    .main-content {
        padding-top: var(--spacing-md);
    }
    
    /* 移动端首页不需要额外间距 */
    .home-page .main-content {
        padding-top: 0;
    }
    
    .container {
        padding: 0 var(--spacing-sm);
        min-width: 380px;
    }
    
    /* 导航栏 */
    .navbar {
        padding: var(--spacing-xs) 0;
    }
    
    .nav-brand h1 {
        font-size: 1.2rem;
    }
    
    .nav-brand span {
        font-size: 0.7rem;
    }
    
    /* 按钮 */
    .btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.8rem;
        min-height: 40px;
    }
    
    .btn-large {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.9rem;
        min-height: 48px;
    }
    
    /* 英雄区域 */
    .hero {
        padding: var(--spacing-md) 0;
    }
    
    .hero-content h2 {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .hero-content p {
        font-size: 0.9rem;
    }
    
    .tech-graphic {
        height: 200px;
    }
    
    .circuit-board {
        width: 150px;
        height: 150px;
    }
    
    .data-flow {
        width: 100px;
        height: 100px;
    }
    
    /* 培训信息区域小屏幕优化 */
    .bg-light.rounded.p-3.mb-3,
    div.bg-light.rounded.p-3.mb-3 {
        padding: var(--spacing-sm) !important;
        text-align: center;
        display: flex !important;
        flex-wrap: wrap;
        justify-content: space-around;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }
    
    .bg-light.rounded.p-3.mb-3 h6,
    div.bg-light.rounded.p-3.mb-3 h6.fw-bold.mb-3.text-center {
        font-size: 0.9rem !important;
        margin-bottom: var(--spacing-sm) !important;
        width: 100% !important;
        text-align: center !important;
        display: block !important;
        border-bottom: 1px solid #dee2e6 !important;
        padding-bottom: var(--spacing-xs) !important;
    }
    
    /* 培训信息水平布局 */
    .bg-light.rounded.p-3.mb-3 .text-center,
    div.bg-light.rounded.p-3.mb-3 .text-center {
        display: inline-block !important;
        margin-bottom: 0 !important;
        margin-right: var(--spacing-sm);
        text-align: center;
        min-width: 60px;
        flex: 1;
        min-width: 0;
        margin-top: var(--spacing-xs);
    }
    
    .bg-light.rounded.p-3.mb-3 .text-center:last-child,
    div.bg-light.rounded.p-3.mb-3 .text-center:last-child {
        margin-right: 0;
    }
    
    .bg-light.rounded.p-3.mb-3 .badge,
    div.bg-light.rounded.p-3.mb-3 .badge {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
        display: block !important;
        margin-top: 0.25rem;
    }
    
    .bg-light.rounded.p-3.mb-3 small,
    div.bg-light.rounded.p-3.mb-3 small {
        font-size: 0.7rem !important;
        display: block !important;
        margin-bottom: 0.25rem;
    }
    
    /* 特色标签小屏幕优化 */
    .d-flex.flex-wrap.gap-2.mb-3.justify-content-center {
        gap: 0.25rem !important;
        margin-bottom: var(--spacing-sm) !important;
    }
    
    .d-flex.flex-wrap.gap-2.mb-3.justify-content-center .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    .d-flex.flex-wrap.gap-2.mb-3.justify-content-center .badge i {
        font-size: 0.6rem;
    }
    
    /* 课程卡片内间距优化 */
    .card-body.p-4 {
        padding: var(--spacing-sm) !important;
    }
    
    .card-footer.bg-transparent.p-4 {
        padding: var(--spacing-sm) !important;
    }
    
    /* 课程区域 */
    .courses {
        padding: var(--spacing-lg) 0;
    }
    
    .courses h2 {
        font-size: 1.8rem;
        margin-bottom: var(--spacing-md);
    }
    
    .course-filters {
        margin-bottom: var(--spacing-lg);
    }
    
    .filter-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.8rem;
    }
    
    .course-card {
        border-radius: var(--radius-lg);
    }
    
    .course-image {
        height: 150px;
    }
    
    .placeholder-image {
        font-size: 3rem;
    }
    
    .course-content {
        padding: var(--spacing-md);
    }
    
    .course-content h3 {
        font-size: 1.2rem;
    }
    
    .course-chapters {
        padding: var(--spacing-sm);
    }
    
    /* 特色功能 */
    .features {
        padding: var(--spacing-lg) 0;
    }
    
    .features h2 {
        font-size: 1.8rem;
        margin-bottom: var(--spacing-lg);
    }
    
    .feature-item {
        padding: var(--spacing-md);
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .feature-item h3 {
        font-size: 1.1rem;
    }
    
    .feature-item p {
        font-size: 0.9rem;
    }
    
    /* 页脚 */
    .footer {
        padding: var(--spacing-lg) 0 var(--spacing-md);
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        text-align: center;
    }
    
    .footer-section h3 {
        font-size: 1.2rem;
    }
    
    .footer-section h4 {
        font-size: 1rem;
    }
}

/* ====== 用户中心页面响应式 ====== */
@media (max-width: 1024px) {
    .user-center-layout {
        grid-template-columns: 250px 1fr;
    }
}

@media (max-width: 768px) {
    .user-center-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        margin-bottom: var(--spacing-md);
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
    
    .user-profile {
        flex-direction: row;
        align-items: center;
        gap: var(--spacing-md);
    }
    
    .user-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.2rem;
    }
    
    .sidebar-nav ul {
        display: flex;
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }
    
    .sidebar-nav a {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.8rem;
        border-radius: var(--radius-md);
    }
    
    .sidebar-nav a span {
        display: none;
    }
    
    /* 统计卡片 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    .stat-card {
        padding: var(--spacing-sm);
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    /* 学习卡片 */
    .learning-cards {
        grid-template-columns: 1fr;
    }
    
    /* 订单表格 */
    .orders-table {
        overflow-x: auto;
    }
    
    .orders-table table {
        min-width: 600px;
    }
}

@media (max-width: 600px) {
    .sidebar {
        padding: var(--spacing-sm);
    }
    
    .user-profile {
        text-align: left;
    }
    
    .user-info h3 {
        font-size: 1rem;
    }
    
    .user-info p {
        font-size: 0.8rem;
    }
    
    .user-level {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    
    .sidebar-nav {
        margin-top: var(--spacing-sm);
    }
    
    .sidebar-nav ul {
        justify-content: space-around;
    }
    
    .sidebar-nav a {
        min-width: 40px;
        text-align: center;
    }
    
    /* 主内容 */
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .page-header p {
        font-size: 0.8rem;
    }
    
    /* 统计卡片 */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        flex-direction: row;
        align-items: center;
        text-align: left;
    }
    
    .stat-icon {
        margin-right: var(--spacing-sm);
        margin-bottom: 0;
    }
    
    /* 学习成就 */
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    /* 个人信息 */
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* ====== 课程详情页面响应式 ====== */
@media (max-width: 1024px) {
    .course-layout {
        grid-template-columns: 1fr;
    }
    
    .chapters-section {
        order: -1;
        max-height: 300px;
        overflow-y: auto;
        margin-bottom: var(--spacing-md);
    }
}

@media (max-width: 768px) {
    .offline-course-layout {
        grid-template-columns: 1fr;
    }
    
    .course-sidebar {
        order: -1;
        margin-bottom: var(--spacing-md);
    }
    
    .video-player {
        height: 250px;
    }
    
    .curriculum-day {
        margin-bottom: var(--spacing-md);
    }
    
    .locations {
        grid-template-columns: 1fr;
    }
    
    .instructors {
        grid-template-columns: 1fr;
    }
}

/* ====== 购买页面响应式 ====== */
@media (max-width: 1024px) {
    .purchase-layout {
        grid-template-columns: 1fr;
    }
    
    .order-summary {
        order: -1;
        margin-bottom: var(--spacing-lg);
    }
}

@media (max-width: 768px) {
    .payment-methods {
        flex-direction: column;
    }
    
    .payment-method {
        text-align: center;
    }
}

/* ====== 登录页面响应式 ====== */
@media (max-width: 768px) {
    .auth-page {
        padding: var(--spacing-md) 0;
    }
    
    .auth-container {
        padding: var(--spacing-md);
    }
    
    .social-login {
        flex-direction: column;
    }
}

/* ====== 关于我们页面响应式 ====== */
@media (max-width: 768px) {
    .page-hero {
        padding: var(--spacing-lg) 0;
    }
    
    .intro-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .mission-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

/* ====== 隐私页面响应式 ====== */
@media (max-width: 768px) {
    .privacy-content {
        padding: var(--spacing-md);
    }
    
    .privacy-header h1 {
        font-size: 1.8rem;
    }
    
    .privacy-section h2 {
        font-size: 1.3rem;
    }
    
    .privacy-section h3 {
        font-size: 1.1rem;
    }
}

/* ====== 通用响应式工具类 ====== */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-center {
        text-align: center;
    }
    
    .mobile-full-width {
        width: 100%;
    }
    
    .mobile-hide {
        display: none;
    }
}

/* ====== 触摸设备优化 ====== */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 48px;
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .nav-menu a {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    .filter-btn {
        min-height: 44px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 48px;
    }
}

/* ====== 高分辨率屏幕优化 ====== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero {
        background-attachment: scroll;
    }
    
    .tech-graphic {
        transform: translateZ(0);
        backface-visibility: hidden;
    }
}

/* ====== 横屏手机优化 ====== */
@media (max-width: 896px) and (orientation: landscape) and (max-height: 414px) {
    .hero {
        padding: var(--spacing-sm) 0;
    }
    
    .hero-content h2 {
        font-size: 1.5rem;
    }
    
    .tech-graphic {
        height: 150px;
    }
    
    .modal.fade .modal-dialog {
        margin: 0.25rem auto;
        max-width: 90%;
    }
    
    .modal.fade .modal-body {
        max-height: 50vh;
        padding: var(--spacing-sm);
    }
}

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

/* ====== 打印样式 ====== */
@media print {
    .navbar,
    .footer,
    .btn,
    .modal,
    .sidebar-nav {
        display: none !important;
    }
    
    body {
        padding-top: 0;
        color: #000;
        background: #fff;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .hero {
        background: none;
        color: #000;
    }
    
    .course-card,
    .feature-item {
        border: 1px solid #ccc;
        break-inside: avoid;
    }
} 

@media (max-width: 600px) {
  .training-title {
    margin-bottom: 0.5rem !important;
    width: 100%;
    text-align: center;
    display: block;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.25rem;
    font-size: 0.9rem;
  }
} 