/* 作文批改在线 - 响应式样式 */

/* 超小屏幕 (手机, 575px 及以下) */
@media (max-width: 575.98px) {
    /* 导航栏 */
    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
        border-bottom: 1px solid var(--gray-light);
    }

    .navbar-collapse {
        background-color: #fff;
        padding: 1rem 0;
        box-shadow: var(--shadow-md);
    }

    /* 主要内容 */
    .main-content {
        padding-top: 60px;
    }

    /* 英雄区域 */
    .hero-section {
        padding: 3rem 1rem !important;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .hero-section .lead {
        font-size: 1rem;
    }

    .stat-item h3 {
        font-size: 1.25rem;
    }

    /* 功能卡片 */
    .card {
        margin-bottom: 1rem;
    }

    .feature-icon {
        width: 50px;
        height: 50px;
    }

    .feature-icon i {
        font-size: 1.5rem;
    }

    /* 表单 */
    .form-control,
    .form-select {
        font-size: 16px; /* 防止 iOS Safari 缩放 */
    }

    /* 按钮 */
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    /* 标签页 */
    .nav-tabs .nav-link {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    /* 模态框 */
    .modal-dialog {
        margin: 1rem;
    }

    /* 表格 */
    .table-responsive {
        font-size: 0.875rem;
    }

    /* 统计数据 */
    .row.g-3 .col-4 {
        flex: 0 0 auto;
        width: 33.333333%;
    }
}

/* 小屏幕 (平板, 576px 至 767.98px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* 导航栏 */
    .navbar {
        padding: 0.75rem 1rem;
    }

    /* 主要内容 */
    .main-content {
        padding-top: 70px;
    }

    /* 英雄区域 */
    .hero-section {
        padding: 4rem 1rem !important;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    /* 功能卡片 */
    .feature-icon {
        width: 55px;
        height: 55px;
    }

    /* 表格 */
    .table-responsive {
        font-size: 0.9rem;
    }
}

/* 中等屏幕 (平板横屏, 768px 至 991.98px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* 主要内容 */
    .main-content {
        padding-top: 76px;
    }

    /* 英雄区域 */
    .hero-section {
        padding: 5rem 2rem !important;
    }

    .hero-section h1 {
        font-size: 2.5rem;
    }

    /* 功能卡片 */
    .card-body {
        padding: 1.5rem;
    }

    /* 标签页 */
    .nav-tabs .nav-link {
        padding: 0.75rem 1rem;
    }

    /* 表格 */
    .table {
        font-size: 0.9rem;
    }
}

/* 大屏幕 (桌面, 992px 至 1199.98px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    /* 英雄区域 */
    .hero-section {
        padding: 6rem 3rem !important;
    }

    .hero-section h1 {
        font-size: 3rem;
    }

    /* 功能展示 */
    .features-section {
        padding: 4rem 0;
    }

    /* 用户评价 */
    .testimonials-section {
        padding: 4rem 0;
    }
}

/* 超大屏幕 (大桌面, 1200px 及以上) */
@media (min-width: 1200px) {
    /* 英雄区域 */
    .hero-section {
        padding: 8rem 0 !important;
    }

    .hero-section h1 {
        font-size: 3.5rem;
    }

    /* 功能展示 */
    .features-section {
        padding: 6rem 0;
    }

    .features-section .lead {
        font-size: 1.125rem;
    }

    /* 用户评价 */
    .testimonials-section {
        padding: 6rem 0;
    }

    /* 容器最大宽度 */
    .container {
        max-width: 1140px;
    }
}

/* 横屏模式调整 */
@media screen and (orientation: landscape) and (max-height: 600px) {
    .hero-section {
        min-height: auto;
        padding: 2rem 0 !important;
    }

    .hero-section h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .hero-section .lead {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .main-content {
        padding-top: 60px;
    }

    /* 减少垂直间距 */
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .mb-5 {
        margin-bottom: 2rem !important;
    }
}

/* 高分辨率屏幕 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* 图标和字体优化 */
    .feature-icon i {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    /* 图片优化 */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 按钮触摸区域增大 */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* 链接触摸区域增大 */
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* 卡片点击效果 */
    .card {
        cursor: pointer;
    }

    .card:active {
        transform: scale(0.98);
    }
}

/* 可访问性 - 减少动画 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 可访问性 - 高对比度模式 */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }

    .card {
        border: 2px solid var(--dark-color);
    }

    .form-control {
        border-width: 2px;
    }

    .nav-link {
        font-weight: 700;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #212529;
        --dark-color: #f8f9fa;
        --gray-color: #adb5bd;
        --gray-light: #495057;
    }

    body {
        background-color: var(--light-color);
        color: var(--dark-color);
    }

    .navbar {
        background-color: var(--light-color) !important;
    }

    .card {
        background-color: var(--gray-light);
        color: var(--dark-color);
    }

    .form-control {
        background-color: var(--gray-light);
        border-color: var(--gray-color);
        color: var(--dark-color);
    }

    .form-control:focus {
        background-color: var(--gray-light);
        color: var(--dark-color);
    }
}

/* 打印样式优化 */
@media print {
    /* 确保分页合理 */
    .card,
    .section {
        page-break-inside: avoid;
    }

    /* 移除所有背景色 */
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* 确保文字清晰 */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    /* 链接显示URL */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }

    /* 隐藏导航和页脚 */
    .navbar,
    .footer,
    .btn,
    .modal {
        display: none !important;
    }
}

/* 特定组件响应式调整 */

/* 批改页面响应式 */
@media (max-width: 991.98px) {
    .correction-page .col-lg-2,
    .correction-page .col-lg-4 {
        margin-bottom: 1rem;
    }

    .correction-page .card {
        height: auto !important;
    }

    .editor-toolbar {
        flex-wrap: wrap;
    }

    .editor-toolbar .btn-group {
        margin-bottom: 0.5rem;
    }
}

/* 学习报告页面响应式 */
@media (max-width: 767.98px) {
    .report-page .col-lg-3 {
        margin-bottom: 1rem;
    }

    .report-page canvas {
        max-height: 200px;
    }

    .report-page .table-responsive {
        font-size: 0.8rem;
    }
}

/* 会员中心响应式 */
@media (max-width: 767.98px) {
    .member-page .auth-left {
        display: none !important;
    }

    .member-page .auth-right {
        min-height: 100vh;
    }

    .member-page .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .member-page .nav-tabs .nav-link {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* 认证页面响应式 */
@media (max-width: 991.98px) {
    .auth-left {
        display: none !important;
    }

    .auth-right {
        min-height: 100vh;
    }

    .auth-form-wrapper {
        max-width: 100% !important;
        padding: 1rem;
    }
}

/* 小屏幕上的表格处理 */
@media (max-width: 767.98px) {
    .table-responsive-stack {
        display: block;
    }

    .table-responsive-stack thead {
        display: none;
    }

    .table-responsive-stack tbody,
    .table-responsive-stack tr,
    .table-responsive-stack td {
        display: block;
        width: 100%;
    }

    .table-responsive-stack tr {
        border: 1px solid #ccc;
        margin-bottom: 10px;
        padding: 10px;
    }

    .table-responsive-stack td {
        border: none;
        position: relative;
        padding-left: 50%;
    }

    .table-responsive-stack td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 45%;
        font-weight: bold;
    }
}

/* 网格系统微调 */
@media (min-width: 576px) {
    .g-sm-4,
    .gx-sm-4 {
        --bs-gutter-x: 1.5rem;
    }

    .g-sm-4,
    .gy-sm-4 {
        --bs-gutter-y: 1.5rem;
    }
}

@media (min-width: 768px) {
    .g-md-4,
    .gx-md-4 {
        --bs-gutter-x: 1.5rem;
    }

    .g-md-4,
    .gy-md-4 {
        --bs-gutter-y: 1.5rem;
    }
}

@media (min-width: 992px) {
    .g-lg-4,
    .gx-lg-4 {
        --bs-gutter-x: 1.5rem;
    }

    .g-lg-4,
    .gy-lg-4 {
        --bs-gutter-y: 1.5rem;
    }
}

@media (min-width: 1200px) {
    .g-xl-4,
    .gx-xl-4 {
        --bs-gutter-x: 1.5rem;
    }

    .g-xl-4,
    .gy-xl-4 {
        --bs-gutter-y: 1.5rem;
    }
}

/* 字体大小响应式调整 */
@media (max-width: 575.98px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
    h4 { font-size: 1rem; }
    h5 { font-size: 0.875rem; }
    h6 { font-size: 0.75rem; }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.875rem; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    h5 { font-size: 1.125rem; }
    h6 { font-size: 1rem; }
}