/* 🎯 当家十礼 - 班级纪律统计系统样式 */
/* 作者：老王 (暴躁技术流) */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 右上角实时时钟 */
.realtime-clock {
    position: fixed;
    top: 12px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9em;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.clock-date,
.clock-time,
.clock-week {
    display: inline;
}

.clock-time {
    font-weight: bold;
    font-family: 'Consolas', 'Monaco', monospace;
}

body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background: url('../xiaoyuanbeijingtu_11808131.jpg.400.jpg') no-repeat center top fixed;
    background-size: 100% auto;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header h1 {
    font-size: 2.8em;
    margin-bottom: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.header-logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 8px rgba(0,0,0,0.25);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 统计卡片 */
.stats-overview {
    display: none !important; /* 隐藏统计卡片 */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 3em;
    margin-right: 20px;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2.2em;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-top: 5px;
}

/* 扣分卡片 */
.deduction-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.deduction-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    border: 2px solid transparent;
}

.deduction-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: #3498db;
}

.deduction-card.active {
    border-color: #e74c3c;
    background: linear-gradient(45deg, #fff, #ffe6e6);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.subject-icon {
    font-size: 2em;
    margin-right: 15px;
}

.card-header h3 {
    font-size: 1.2em;
    color: #2c3e50;
}

.card-content {
    text-align: center;
}

.deduction-count {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.total-deduction {
    font-size: 1.5em;
    font-weight: bold;
    color: #e74c3c;
}

/* 控制面板 */
.controls {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.controls-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    flex: 1;
    min-width: 300px;
}

.filter-item {
    display: flex;
    flex-direction: column;
    min-width: 180px;
    flex: 1;
}

.filter-label {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.95em;
    font-weight: 600;
}

.time-filter,
.grade-filter {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid rgba(236, 240, 241, 0.8);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.time-filter:focus,
.grade-filter:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.date-range-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.date-input {
    padding: 10px 12px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 0.9em;
    transition: border-color 0.3s ease;
    flex: 1;
    min-width: 140px;
}

.date-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.date-separator {
    color: #7f8c8d;
    font-size: 0.9em;
    white-space: nowrap;
}

.date-range-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
    font-size: 0.9em;
    font-weight: 600;
    white-space: nowrap;
}

.date-range-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.search-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 300px;
}

.action-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
}

/* 按钮样式 */
.action-btn,
.yida-btn {
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    white-space: nowrap;
}

.yida-btn,
#viewYidaDataBtn {
    background: linear-gradient(45deg, #3498db, #2980b9) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3) !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.add-points-btn,
#addPointsBtn {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.yida-btn:hover,
#viewYidaDataBtn:hover {
    background: linear-gradient(45deg, #2980b9, #21618c) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4) !important;
}

.refresh-btn,
.export-btn,
.ranking-btn,
.search-btn,
.clear-search-btn,
.clear-data-btn,
.award-btn,
.history-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.refresh-btn:hover,
.search-btn:hover {
    background: linear-gradient(45deg, #2980b9, #21618c);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
}

.export-btn:hover {
    background: linear-gradient(45deg, #27ae60, #229954);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.ranking-btn:hover,
.award-btn:hover {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.clear-search-btn:hover,
.clear-data-btn:hover {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.history-btn:hover {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}

.add-points-btn {
    background: linear-gradient(45deg, #17a2b8, #138496);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
    white-space: nowrap;
}

.add-points-btn:hover {
    background: linear-gradient(45deg, #138496, #117a8b8);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
    transform: translateY(-2px);
}

/* 搜索框 */
.search-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
    min-width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-btn,
.clear-search-btn {
    padding: 10px 20px;
    white-space: nowrap;
}

/* 表格样式 */
.table-section {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

.table-header h3 {
    color: #2c3e50;
    font-size: 1.3em;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.record-count {
    color: #7f8c8d;
    font-size: 0.9em;
}

.clear-data-btn {
    width: auto;
    padding: 8px 15px;
    font-size: 0.9em;
    margin-bottom: 0;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #ecf0f1;
    max-width: 100%;
}

.deduction-table {
    width: 100%;
    min-width: 1650px; /* 调整最小宽度以容纳15列 */
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.9);
    table-layout: fixed; /* 固定布局，确保列宽一致 */
}

.deduction-table th,
.deduction-table td {
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid #ecf0f1;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    font-size: 0.9em;
    box-sizing: border-box;
}

/* 设置列宽 */
.col-date { width: 110px; min-width: 110px; max-width: 110px; } /* 日期 */
.col-class { width: 90px; min-width: 90px; max-width: 90px; } /* 班级 */
.col-subject { width: 75px; min-width: 75px; max-width: 75px; } /* 十礼科目 */
.col-total { width: 85px; min-width: 85px; max-width: 85px; } /* 总扣分 */
.col-bonus { width: 85px; min-width: 85px; max-width: 85px; } /* 今日加分 */
.col-score { width: 75px; min-width: 75px; max-width: 75px; } /* 周得分 */

.deduction-table th.col-date,
.deduction-table td.col-date { width: 110px !important; min-width: 110px !important; max-width: 110px !important; }
.deduction-table th.col-class,
.deduction-table td.col-class { width: 90px !important; min-width: 90px !important; max-width: 90px !important; }
.deduction-table th.col-subject,
.deduction-table td.col-subject { width: 75px !important; min-width: 75px !important; max-width: 75px !important; }
.deduction-table th.col-total,
.deduction-table td.col-total { width: 85px !important; min-width: 85px !important; max-width: 85px !important; }
.deduction-table th.col-bonus,
.deduction-table td.col-bonus { width: 85px !important; min-width: 85px !important; max-width: 85px !important; }
.deduction-table th.col-score,
.deduction-table td.col-score { width: 75px !important; min-width: 75px !important; max-width: 75px !important; font-size: 0.85em !important; }

.deduction-table th {
    background: linear-gradient(45deg, #34495e, #2c3e50);
    color: white;
    font-weight: bold;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.deduction-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.deduction-table tr:hover {
    background-color: #e3f2fd;
    transition: background-color 0.3s ease;
}

.deduction-table tr:last-child td {
    border-bottom: none;
}

.deduction-score-cell {
    font-weight: bold;
    font-size: 0.95em;
}

.score-cell {
    font-weight: bold;
    font-size: 0.95em;
}

/* 得分颜色样式 */
.score-excellent {
    color: #27ae60 !important;
}

.score-good {
    color: #f39c12 !important;
}

.score-warning {
    color: #e74c3c !important;
}

.deduction-score-cell[style*="color: red"],
.deduction-score-cell span[style*="color: red"] {
    color: #e74c3c !important;
}

/* 合计行样式 */
.total-row {
    background-color: #f0f8ff !important;
    font-weight: bold;
    border-top: 2px solid #4CAF50;
}

.total-row td {
    border-top: 2px solid #4CAF50 !important;
}

/* 加载状态 */
.loading {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 40px !important;
    font-size: 1.1em;
}

/* 分页控件 */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 25px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.pagination-left {
    display: flex;
    align-items: center;
}

.pagination-total {
    color: #7f8c8d;
    font-size: 0.9em;
}

.pagination-total strong {
    color: #2c3e50;
    font-weight: bold;
}

.pagination-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.pagination-btn:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    background: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.pagination-info {
    background: #3498db;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9em;
    min-width: 40px;
    text-align: center;
}

.pagination-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pagination-per-page {
    color: #7f8c8d;
    font-size: 0.9em;
}

.pagination-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9em;
    background: white;
    cursor: pointer;
    min-width: 60px;
}

.pagination-select:focus {
    outline: none;
    border-color: #3498db;
}

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

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 95%;
    max-width: 1400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(45deg, #34495e, #2c3e50);
    color: white;
    padding: 20px 25px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close {
    color: white;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
    line-height: 1;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px 25px;
    max-height: 85vh;
    overflow-y: auto;
}

.ranking-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.ranking-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.ranking-actions button {
    width: auto;
    padding: 12px 25px;
    margin-bottom: 0;
}

/* 页脚 */
.footer {
    text-align: center;
    color: white;
    padding: 20px;
    margin-top: 30px;
    opacity: 0.9;
    font-size: 0.95em;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 2.2em;
    }

    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .deduction-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .controls-row {
        flex-direction: column;
    }

    .filter-group {
        flex-direction: column;
        width: 100%;
    }

    .filter-item {
        width: 100%;
    }

    .date-range-group {
        flex-direction: column;
        align-items: stretch;
    }

    .date-input {
        width: 100%;
        min-width: auto;
    }

    .date-separator {
        display: none;
    }

    .search-group {
        width: 100%;
    }

    .search-container {
        flex-direction: column;
    }

    .action-group {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .action-btn {
        width: auto;
        min-width: 120px;
        flex: 0 0 auto;
    }
    
    #viewYidaDataBtn,
    #addPointsBtn {
        width: auto !important;
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .table-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .table-container {
        font-size: 0.9em;
    }

    .deduction-table th,
    .deduction-table td {
        padding: 10px 6px;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 10px;
    }

    .modal-content {
        margin: 1% auto;
        width: 98%;
        max-width: 100%;
    }

    .ranking-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    @media (max-width: 768px) {
        .ranking-grid {
            grid-template-columns: 1fr;
        }
    }

    .ranking-actions {
        flex-direction: column;
    }
}

/* 特殊效果 */
.info-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #3498db;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    z-index: 2000;
    font-size: 1em;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.4s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.error-message {
    background: #e74c3c;
}

.success-message {
    background: #27ae60;
}

/* 数据为空时的样式 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.empty-state-subtext {
    font-size: 1em;
    opacity: 0.7;
}