* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.settings-panel {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

/* 折叠区域样式 */
.foldable-section {
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0 15px;
}

.foldable-summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    padding: 12px 16px;
    list-style: none;
    color: #495057;
    transition: color 0.2s, background 0.2s;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 8px;
}

.foldable-summary:hover {
    color: #667eea;
    background: linear-gradient(135deg, #667eea25 0%, #764ba225 100%);
}

.foldable-summary::before {
    content: '▶ ';
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s;
}

.foldable-section[open] .foldable-summary::before {
    transform: rotate(90deg);
}

.foldable-summary::-webkit-details-marker {
    display: none;
}

.foldable-content {
    padding-bottom: 15px;
}

/* 自动登录区域样式 */
.auto-login-section {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 10px;
    border: 2px solid #667eea;
}

.auto-login-section h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1rem;
}

.auto-login-section .form-row {
    gap: 15px;
}

.auto-login-section .form-group {
    flex: 1;
}

.auto-login-section #autoLoginBtn {
    margin-top: 10px;
}

.settings-panel h3 {
    margin-bottom: 18px;
    color: #444;
    font-size: 1.1rem;
    font-weight: 600;
    border-left: 4px solid #667eea;
    padding-left: 12px;
}

/* 快速登录区域 */
.login-embed-section {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 10px;
    border: 2px solid #667eea;
}

/* 快速登录区域 - 新版本 */
.quick-login-section {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 10px;
    border: 2px solid #667eea;
}

.login-hint {
    color: #555;
    margin-bottom: 15px;
    font-size: 14px;
}

.login-steps {
    margin: 0 0 20px 20px;
    padding: 0;
}

.login-steps li {
    margin: 8px 0;
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

.login-steps kbd {
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 12px;
    font-family: monospace;
}

.login-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.login-hint {
    color: #555;
    margin-bottom: 15px;
    font-size: 14px;
}

.login-status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
}

.login-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.login-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.login-status.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 自动登录 loading 样式 */
.auto-login-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    margin-top: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.auto-login-loading .spinner {
    width: 24px;
    height: 24px;
}

/* 凭证区域 */
.credential-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* 按钮样式 */
.btn-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.4);
}

.btn-small {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-top: 10px;
    transition: background 0.2s, transform 0.2s;
}

.btn-small:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

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

.date-inputs input {
    flex: 1;
}

.date-inputs span {
    color: #999;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fff5f5;
    color: #c00;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #dc3545;
}

.success {
    background: #f0fff4;
    color: #0a0;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #28a745;
}

/* 今日请假汇总样式 */
.today-summary {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #667eea;
}

.today-summary h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
}

.today-summary-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    line-height: 1.8;
}

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

.today-summary-period {
    color: #667eea;
    font-weight: 600;
    margin-right: 8px;
}

.today-summary-names {
    color: #333;
}

.today-summary-list {
    padding: 10px 0;
}

.today-summary-line {
    padding: 6px 0;
    line-height: 1.8;
    font-size: 14px;
    border-bottom: 1px dashed #eee;
}

.today-summary-line:last-child {
    border-bottom: none;
}

.today-summary-line .today-summary-period {
    display: inline-block;
    min-width: 100px;
    color: #667eea;
    font-weight: 600;
}

.today-summary-line .today-summary-names {
    color: #333;
}

.calendar-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #ddd;
}

.calendar-header h2 {
    font-size: 1.2rem;
    color: #333;
    font-weight: 600;
}

.btn-nav {
    background: white;
    border: 1px solid #ddd;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-nav:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

.schedule-grid {
    display: flex;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #ddd;
}

.time-column {
    width: 100px;
    flex-shrink: 0;
}

.time-column.header-column {
    background: #f0f0f0;
}

.time-cell {
    padding: 10px 5px;
    font-weight: 600;
    color: #666;
    text-align: center;
    border-right: 1px solid #ddd;
    font-size: 12px;
    line-height: 1.4;
}

.time-cell .period-name {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.time-cell .period-time {
    display: block;
    font-size: 10px;
    color: #999;
}

.days-header {
    display: flex;
    flex: 1;
}

.day-cell {
    flex: 1;
    padding: 12px;
    text-align: center;
    border-right: 1px solid #ddd;
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.day-cell:last-child {
    border-right: none;
}

.day-cell.weekend {
    color: #dc3545;
}

/* 今天高亮 */
.day-cell.today {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
}

/* 时间列今天高亮 */
.hour-row.today {
    background: #667eea15;
    border-left: 3px solid #667eea;
}

.schedule-body {
    display: flex;
    max-height: 900px;
    overflow-y: auto;
}

#timeColumn {
    width: 100px;
    flex-shrink: 0;
}

.hour-row {
    height: 60px;
    border-bottom: 1px solid #ddd;
    border-right: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #999;
    flex-shrink: 0;
}

.hour-row.class-period {
    background: linear-gradient(135deg, #e8f0ff 0%, #f0f4ff 100%);
    font-weight: 600;
    color: #333;
    flex-direction: column;
    padding: 6px 0;
    border-bottom: 1px solid #ddd;
}

.hour-row.class-period .period-label {
    font-size: 13px;
    color: #667eea;
    margin-bottom: 3px;
    font-weight: 700;
}

.hour-row.class-period .period-time {
    font-size: 10px;
    color: #888;
    font-weight: normal;
}

.schedule-content {
    display: flex;
    flex: 1;
    position: relative;
}

.day-column {
    flex: 1;
    border-right: 1px solid #ddd;
    position: relative;
    height: 1440px;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 59px,
            #ddd 60px
        );
}

.day-column:last-child {
    border-right: none;
}

.day-column.weekend {
    background-color: #fff5f5;
}

/* 今日列特殊高亮 */
.day-column.today {
    background-color: #f0f7ff;
}

.day-column.today.weekend {
    background-color: #fff0f5;
}

.leave-block {
    position: absolute;
    color: white;
    border-radius: 8px;
    padding: 4px 6px;
    font-size: 12px;
    overflow: visible;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.leave-block:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    z-index: 100;
}

.leave-block .name {
    font-weight: 600;
    margin-bottom: 3px;
    font-size: 13px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 姓名居中显示（简化模式） */
.leave-block .name-only {
    display: block;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
    white-space: nowrap;
    overflow: visible;
}

.leave-block .time {
    font-size: 11px;
    opacity: 0.95;
    font-weight: 500;
}

.leave-block .class-info {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 2px;
    font-weight: 500;
}

/* 网格线覆盖层（确保在请假块上层） */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

/* 统计弹窗样式 */
.stats-tooltip {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 18px;
    z-index: 1000;
    max-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    animation: tooltipFadeIn 0.2s ease-out;
}

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

.stats-popup h4 {
    margin: 0 0 14px 0;
    color: #333;
    font-size: 16px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.stats-summary {
    text-align: center;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    margin-bottom: 14px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.stats-count {
    font-size: 36px;
    font-weight: bold;
    color: white;
    display: inline-block;
}

.stats-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.95);
    margin-left: 8px;
    display: inline-block;
}

.stats-list {
    max-height: 280px;
    overflow-y: auto;
}

.stats-list::-webkit-scrollbar {
    width: 6px;
}

.stats-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.stats-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.stats-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.stats-day {
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #ddd;
}

.stats-day strong {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 13px;
}

.stats-day ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stats-day li {
    padding: 5px 0;
    font-size: 13px;
    color: #555;
    border-bottom: 1px solid #eee;
}

.stats-day li:last-child {
    border-bottom: none;
}

.stats-day li:last-child {
    border-bottom: none;
}

/* 今日统计特殊样式 */
.stats-day-today {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px solid #667eea;
    border-left: 4px solid #667eea;
    margin-bottom: 14px;
}

.stats-day-today strong {
    color: #667eea;
    font-size: 14px;
    font-weight: 700;
}

.stats-day-today .today-student {
    color: #333;
    font-weight: 600;
}

/* 详情弹窗样式 */
.leave-detail-popup {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 18px;
    z-index: 1000;
    min-width: 300px;
    max-width: 380px;
    border: 1px solid #e9ecef;
    animation: tooltipFadeIn 0.2s ease-out;
}

.leave-detail-popup h4 {
    margin: 0 0 14px 0;
    color: #333;
    font-size: 16px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.leave-detail-popup .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    align-items: center;
}

.leave-detail-popup .detail-row:last-child {
    border-bottom: none;
}

.leave-detail-popup .detail-row .label {
    color: #888;
    font-weight: 500;
}

.leave-detail-popup .detail-row .value {
    color: #333;
    font-weight: 600;
    text-align: right;
    max-width: 65%;
    word-break: break-word;
}

.leave-detail-popup .detail-row .value.approved {
    color: #28a745;
    background: #d4edda;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

.leave-detail-popup .detail-row .value.pending {
    color: #856404;
    background: #fff3cd;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

.leave-detail-popup .detail-row .value.rejected {
    color: #721c24;
    background: #f8d7da;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

.leave-records {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 25px;
}

.leave-records h3 {
    margin-bottom: 18px;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    border-left: 4px solid #667eea;
    padding-left: 12px;
}

#recordsTable {
    width: 100%;
    border-collapse: collapse;
}

#recordsTable th,
#recordsTable td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

#recordsTable th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 600;
    color: #555;
    font-size: 13px;
}

#recordsTable tbody tr:hover {
    background: #f8f9fa;
}

.status-approved {
    color: #28a745;
    font-weight: 600;
    background: #d4edda;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

.status-pending {
    color: #856404;
    font-weight: 600;
    background: #fff3cd;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

.status-rejected {
    color: #721c24;
    font-weight: 600;
    background: #f8d7da;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

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

    .form-row .form-group {
        width: 100%;
    }

    .date-inputs {
        flex-direction: column;
    }

    .calendar-header {
        flex-direction: column;
        gap: 10px;
    }

    .days-header {
        overflow-x: auto;
    }

    .day-cell {
        min-width: 80px;
    }

    .time-column {
        width: 70px;
    }

    .time-cell {
        font-size: 10px;
    }
}
