﻿/* ========================================
   Mobile Responsive Styles
   ======================================== */
@media (max-width: 768px) {
    .app-header {
        padding: var(--spacing-md);
        flex-direction: column;
        gap: var(--spacing-md);
    }

    /* Bottom Navigation for Mobile */
    .header-right {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        background: var(--bg-card);
        padding: 12px;
        z-index: 9999;
        display: flex;
        justify-content: space-between;
        gap: 10px;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(10px);
    }

    .header-right .btn {
        flex: 1;
        margin: 0 !important;
        font-size: 13px;
        padding: 0;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }

    .header-right .btn svg {
        margin-right: 6px;
    }

    .app-container {
        padding-bottom: 80px;
    }

    /* Mobile Master-Detail Layout */
    .main-content {
        display: block;
        padding: var(--spacing-md);
    }

    .sidebar {
        display: block;
        width: 100%;
        height: auto;
        max-height: none;
        position: static;
        margin-bottom: 80px;
        padding-bottom: 20px;
    }

    .student-list {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
    }

    .main-panel {
        display: none;
    }

    /* Show Detail State */
    body.show-detail .sidebar {
        display: none;
    }

    body.show-detail .main-panel {
        display: flex;
    }

    body.show-detail .mobile-back-btn {
        display: flex !important;
    }

    /* Compact Student Info Card for Mobile */
    .student-info-card {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 12px;
        padding: 16px;
        text-align: left;
        justify-items: start;
        align-items: center;
    }

    .student-avatar {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
        grid-row: 1;
        grid-column: 1;
        margin: 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

    .student-details {
        grid-row: 1;
        grid-column: 2;
        text-align: left;
        width: 100%;
    }

    .student-details h2 {
        font-size: 1.25rem;
        margin-bottom: 4px;
    }

    .student-meta {
        justify-content: flex-start;
        font-size: 0.85rem;
        gap: 12px;
    }

    .student-stats {
        grid-row: 2;
        grid-column: 1 / -1;
        width: 100%;
        display: flex;
        justify-content: space-around;
        background: rgba(255, 255, 255, 0.03);
        padding: 12px;
        border-radius: 12px;
        margin-top: 4px;
        gap: 0;
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .stat-item {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .stat-label {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .subject-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }

    /* Card Layout for Table on Mobile */
    #examHistoryTable thead {
        display: none;
    }

    #examHistoryTable tbody tr {
        display: block;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 12px;
        margin-bottom: 16px;
        padding: 12px;
    }

    #examHistoryTable tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        text-align: right;
    }

    #examHistoryTable tbody td:last-child {
        border-bottom: none;
    }

    #examHistoryTable tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #a0a0b0;
        margin-right: 16px;
        text-align: left;
    }

    /* 移动端筛选框并排显示 */
    .sidebar-header {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
        align-items: center !important;
    }

    .sidebar-header h3 {
        display: none;
    }

    .sidebar-header .search-box,
    .sidebar-header .class-filter-box {
        flex: 1 !important;
        margin: 0 !important;
        padding: 0 !important;
        min-width: 0 !important;
        position: relative !important;
        height: 36px !important;
        display: flex !important;
        align-items: center !important;
        border: none !important;
        background: transparent !important;
    }

    .sidebar-header .class-filter-box label {
        display: none !important;
    }

    .sidebar-header .search-box input,
    .sidebar-header .class-filter-box input {
        font-size: 13px !important;
        padding: 0 10px !important;
        padding-left: 32px !important;
        height: 100% !important;
        line-height: normal !important;
        border-radius: 8px !important;
        margin: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        background: #f5f7fa !important;
        color: #333333 !important;
        /* 强制深色文字以配合浅色背景 */
        box-shadow: none !important;
    }

    .sidebar-header .class-filter-box input {
        padding-left: 10px !important;
    }

    .sidebar-header .search-box svg,
    .sidebar-header .class-filter-box .select-icon {
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 2 !important;
    }

    .sidebar-header .search-box svg {
        width: 14px !important;
        height: 14px !important;
        left: 10px !important;
    }

    .sidebar-header .class-filter-box .select-icon {
        right: 10px !important;
        left: auto !important;
        width: 12px !important;
        height: 12px !important;
    }
}