/* 移动端优化的CSS样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #FF9A8B 0%, #FF6A88 50%, #FF99AC 100%);
    min-height: 100vh;
    color: #2c3e50;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 4px solid #FFD166;
}

.header h1 {
    color: #EF476F;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.class-info {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-size: 1rem;
    color: #718096;
}

.class-name {
    font-weight: 700;
    color: #118AB2;
}

.student-count {
    font-weight: 600;
    color: #073B4C;
}

.btn-fullscreen {
    padding: 0;
    background: #073B4C;
    color: white;
    border: none;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1;
    min-width: 50px; /* 覆盖基础按钮的min-width */
    min-height: 50px; /* 确保最小高度 */
}

.btn-fullscreen:hover {
    background: #EF476F;
    transform: scale(1.1);
}

/* 悬浮全屏按钮 */
.btn-fullscreen.floating {
    position: fixed;
    bottom: 80px;
    left: 20px;
    width: 60px;
    height: 60px;
    padding: 0;
    flex-direction: column;
    border-radius: 50%;
    min-width: 60px; /* 覆盖基础按钮的min-width */
    min-height: 60px; /* 确保最小高度 */
}

.btn-fullscreen.floating .fullscreen-text {
    font-size: 12px;
    margin-top: 2px;
}

/* 全屏模式样式 */
:fullscreen .container {
    max-width: 100%;
}

:fullscreen .header {
    padding: 0.5rem;
}

:fullscreen .header h1 {
    font-size: 1.5rem;
}

:fullscreen .class-info {
    gap: 0.5rem;
    font-size: 0.9rem;
}

:fullscreen .roll-call-section {
    padding: 1rem;
    height: calc(100vh - 100px);
}

:fullscreen .roll-call-card {
    padding: 2rem;
    max-width: 95%;
    width: 95%;
    height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    border: 5px solid #FFD166;
}

:fullscreen .student-name {
    font-size: 5rem;
    margin: 2rem 0;
}

:fullscreen .student-date {
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

:fullscreen .btn {
    padding: 1.5rem 2.5rem;
    font-size: 1.8rem;
    min-width: 250px;
    margin: 0.5rem;
}

:fullscreen .bottom-nav {
    display: none !important;
}

:fullscreen .btn-fullscreen.floating {
    bottom: 30px;
    left: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    min-width: 70px; /* 覆盖基础按钮的min-width */
    min-height: 70px; /* 确保最小高度 */
    z-index: 9999; /* 确保按钮在最上层 */
}

/* 移动端全屏模式特殊处理 */
@media (max-width: 768px) {
    :fullscreen .btn-fullscreen.floating {
        bottom: 20px;
        left: 20px;
        width: 60px;
        height: 60px;
        min-width: 60px;
        min-height: 60px;
    }
}

/* 点名答题区域 */
.roll-call-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem;
}

.roll-call-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 4px solid #FFD166;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    flex-grow: 0;
    transition: all 0.3s ease;
}

.student-avatar {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #FFD166;
}

.student-info {
    margin-bottom: 1rem;
}

.student-name {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.student-date {
    font-size: 1.5rem;
    opacity: 0.9;
    font-weight: 600;
    color: #FFD166;
}

.roll-call-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.points-selector {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.points-dropdown {
    padding: 0.8rem 1.2rem;
    border: 2px solid #118AB2;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 700;
    background: white;
    color: #073B4C;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.points-dropdown:focus {
    outline: none;
    border-color: #EF476F;
    box-shadow: 0 0 0 3px rgba(239, 71, 111, 0.3);
}

/* 按钮样式 */
.btn {
    padding: 1rem 1.8rem;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 150px;
    justify-content: center;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #06D6A0 0%, #118AB2 100%);
    color: white;
    border: 3px solid #FFFFFF;
}

.btn-success {
    background: linear-gradient(135deg, #FFD166 0%, #FF9A8B 100%);
    color: #073B4C;
    border: 3px solid #FFFFFF;
}

.btn-danger {
    background: linear-gradient(135deg, #EF476F 0%, #FF99AC 100%);
    color: white;
    border: 3px solid #FFFFFF;
}

.btn-info {
    background: linear-gradient(135deg, #118AB2 0%, #073B4C 100%);
    color: white;
    border: 3px solid #FFFFFF;
}

.btn-warning {
    background: linear-gradient(135deg, #FF9A8B 0%, #FF6A88 100%);
    color: white;
    border: 3px solid #FFFFFF;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    border: 3px solid #FFFFFF;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #484e53 100%);
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

.btn-secondary:disabled {
    background: linear-gradient(135deg, #adb5bd 0%, #868e96 100%);
    transform: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: not-allowed;
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.btn:active {
    transform: translateY(1px);
}

.btn-sm {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    min-width: 70px;
}

/* 排行榜样式 */
.ranking-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 70px;
}

.ranking-card h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

.ranking-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.filter-btn:hover {
    background: linear-gradient(135deg, #e0e0e0 0%, #d0d0d0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.filter-btn.active {
    background: linear-gradient(135deg, #4a90e2 0%, #1c6bc8 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.ranking-list {
    min-height: 300px;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.ranking-item:last-child {
    border-bottom: none;
}

.rank-number {
    width: 50px;
    text-align: center;
    font-weight: bold;
    font-size: 1.2em;
}

.rank-1 {
    color: #FFD700;
    font-size: 1.5em;
}

.rank-2 {
    color: #C0C0C0;
    font-size: 1.5em;
}

.rank-3 {
    color: #CD7F32;
    font-size: 1.5em;
}

.rank-num {
    font-weight: bold;
    color: #666;
}

.student-info {
    flex: 1;
    padding: 0 15px;
}

.student-name {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

.points {
    display: flex;
    align-items: center;
    gap: 5px;
}

.points-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #4a90e2;
}

.points-label {
    color: #999;
    font-size: 0.9em;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 20px 0;
}

.page-info {
    font-weight: bold;
    color: #333;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 3px solid #FFD166;
    display: flex;
    justify-content: space-around;
    padding: 0.7rem 0;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.15);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.7rem;
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
}

.nav-btn.active {
    color: #118AB2;
    transform: scale(1.1);
}

.nav-btn i {
    font-size: 1.5rem;
}

.nav-btn:hover {
    color: #EF476F;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 25px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    border: 3px solid #FFD166;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid #EDEDED;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #118AB2 0%, #073B4C 100%);
    color: white;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: white;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.student-list {
    max-height: 400px;
    overflow-y: auto;
}

.student-item {
    display: flex;
    align-items: center;
    padding: 1.2rem;
    border-bottom: 2px solid #EDEDED;
    transition: background-color 0.3s ease;
    border-radius: 15px;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.student-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.student-item:hover {
    background-color: rgba(17, 138, 178, 0.15);
    transform: translateX(5px);
}

.student-item .student-info {
    flex: 1;
    margin: 0;
}

.student-item .student-name {
    font-weight: 700;
    color: #073B4C;
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
}

.student-item .student-id {
    font-size: 0.9rem;
    color: #718096;
}

.student-points {
    margin: 0 1rem;
    font-weight: 700;
    color: #073B4C;
    font-size: 1.1rem;
    background: #FFD166;
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.student-actions {
    display: flex;
    gap: 0.7rem;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.7rem;
    font-weight: 700;
    color: #073B4C;
    font-size: 1.1rem;
}

.form-control {
    width: 100%;
    padding: 1rem;
    border: 2px solid #118AB2;
    border-radius: 15px;
    font-size: 1.1rem;
    transition: border-color 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-control:focus {
    outline: none;
    border-color: #EF476F;
    box-shadow: 0 0 0 4px rgba(239, 71, 111, 0.2);
}

.modal-actions {
    display: flex;
    gap: 1.2rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .main-content {
        padding: 0.7rem;
        padding-bottom: 100px;
    }
    
    .roll-call-card {
        padding: 1.2rem;
        border-radius: 20px;
    }
    
    .selected-student {
        padding: 1.5rem;
        min-height: 180px;
        border-radius: 15px;
    }
    
    .student-name {
        font-size: 1.5rem;
    }
    
    .student-avatar {
        font-size: 3rem;
    }
    
    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        border-radius: 40px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        border-radius: 20px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
}

/* PC端适配 */
@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .main-content {
        padding: 2rem;
        padding-bottom: 100px;
    }
    
    .roll-call-card {
        padding: 2.5rem;
        border-radius: 30px;
    }
    
    .selected-student {
        min-height: 300px;
        padding: 3rem;
        border-radius: 25px;
    }
    
    .student-name {
        font-size: 2.5rem;
    }
    
    .student-id {
        font-size: 1.5rem;
    }
    
    .student-avatar {
        font-size: 5rem;
    }
    
    .roll-call-buttons {
        gap: 2rem;
    }
    
    .btn {
        padding: 1.2rem 2.5rem;
        font-size: 1.3rem;
        min-width: 180px;
        border-radius: 50px;
    }
    
    .ranking-item {
        padding: 1.5rem;
    }
    
    .ranking-item .student-name {
        font-size: 1.3rem;
    }
    
    .points-value {
        font-size: 1.8rem;
    }
    
    .action-buttons {
        gap: 1.8rem;
    }
    
    .modal-content {
        width: 60%;
        max-width: 800px;
        border-radius: 30px;
    }
    
    .student-item {
        padding: 1.5rem;
    }
    
    .student-item .student-name {
        font-size: 1.2rem;
    }
    
    .student-item .student-id {
        font-size: 1rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 60%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    80% {
        transform: translateY(-5px);
    }
}

.ranking-item {
    animation: fadeIn 0.4s ease;
}

.selected-student {
    animation: bounce 2s infinite;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 25px;
    height: 25px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 学生列表样式 */
.student-list {
    max-height: 60vh;
    overflow-y: auto;
}

.student-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s ease;
}

.student-item:hover {
    background-color: #f8f9fa;
}

.student-info {
    flex: 1;
}

.student-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: #073B4C;
}

.student-id {
    font-size: 0.9rem;
    color: #718096;
}

.student-points {
    margin: 0 1rem;
    font-weight: 700;
    color: #073B4C;
}

.student-actions {
    display: flex;
    gap: 0.5rem;
}

.add-student-form {
    padding: 1rem;
    border-bottom: 2px solid #FFD166;
    margin-bottom: 1rem;
}

.add-student-form h4 {
    margin-top: 0;
    color: #073B4C;
    margin-bottom: 1rem;
}

.add-student-form .form-group {
    margin-bottom: 0.8rem;
}

.add-student-form input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.add-student-form input:focus {
    border-color: #118AB2;
    outline: none;
}

.edit-form {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.edit-form .form-group {
    margin-bottom: 0.8rem;
}

.edit-form input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.edit-form input:focus {
    border-color: #118AB2;
    outline: none;
}

.btn-edit, .btn-delete, .btn-save, .btn-cancel {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-edit {
    background-color: #118AB2;
    color: white;
}

.btn-edit:hover {
    background-color: #0a6c8c;
}

.btn-delete {
    background-color: #EF476F;
    color: white;
}

.btn-delete:hover {
    background-color: #d4325d;
}

.btn-save {
    background-color: #073B4C;
    color: white;
}

.btn-save:hover {
    background-color: #052a38;
}

.btn-cancel {
    background-color: #718096;
    color: white;
}

.btn-cancel:hover {
    background-color: #5a677a;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: #118AB2;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #073B4C;
}

/* 学生姓名显示 */
.student-name {
    font-size: 2.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

/* 学生日期显示 */
.student-date {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 20px;
}

/* 全屏模式下的学生姓名 */
.fullscreen .student-name {
    font-size: 4rem;
}

/* 全屏模式下的学生日期 */
.fullscreen .student-date {
    font-size: 2rem;
}

/* 非全屏模式下增大显示 */
@media (min-width: 768px) {
    .student-name {
        font-size: 3rem;
    }
    
    .student-date {
        font-size: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .student-name {
        font-size: 4rem;
    }
    
    .student-date {
        font-size: 2rem;
    }
}
