:root {
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius: 6px;
    --transition-speed: 0.2s;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 顶部栏 */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.top-bar h1 {
    font-size: 1.5rem;
    color: var(--accent-color);
}

.actions button {
    margin-left: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--button-bg);
    color: var(--button-text);
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.actions button:hover {
    background-color: var(--accent-color);
    color: white;
}

/* 主内容区 */
.main-content {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    padding: 1.5rem;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.sidebar h2 {
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--heading-color);
}

.sidebar h2:first-child {
    margin-top: 0;
}

.control-group {
    margin-bottom: 1.2rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.control-group input[type="number"],
.control-group input[type="search"],
.control-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--input-bg);
    color: var(--text-color);
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
    font-weight: normal;
}
.radio-group input {
    margin-right: 0.4rem;
}

.draw-action-btn {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.2rem;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s;
}
.draw-action-btn:active {
    transform: scale(0.98);
}

#reset-draw-btn {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--muted-bg);
    color: var(--muted-text);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

/* 主区域 */
.main-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow: hidden;
}

/* 结果展示区 */
.result-display-section {
    flex: 0 0 auto;
    min-height: 200px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    border: 2px dashed var(--border-color);
    overflow-y: auto;
}

.result-display-section .placeholder {
    font-size: 2rem;
    color: var(--muted-text);
}

.student-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.student-card .student-group {
    font-size: 1.2rem;
    font-weight: normal;
    color: var(--muted-text);
    margin-top: 0.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* 学生列表 */
.student-list-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

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

.table-container {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

thead {
    background-color: var(--sidebar-bg);
    position: sticky;
    top: 0;
}

tbody tr:hover {
    background-color: var(--hover-bg);
}

tbody tr.drawn {
    color: var(--muted-text);
    text-decoration: line-through;
}

.status-badge {
    padding: 0.2em 0.6em;
    border-radius: 1em;
    font-size: 0.9em;
    cursor: pointer;
}

.status-present { background-color: var(--status-present); color: white; }
.status-late { background-color: var(--status-late); color: white; }
.status-absent { background-color: var(--status-absent); color: white; }
.status-leave { background-color: var(--status-leave); color: white; }
.status-pending { background-color: var(--muted-bg); color: var(--muted-text); }

input.weight-input {
    width: 50px;
    text-align: center;
}

input.notes-input {
    width: 100%;
}
/* 底部状态栏 */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    background-color: var(--header-bg);
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--muted-text);
    flex-shrink: 0;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
}

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

.modal-actions button {
    padding: 0.6rem 1.2rem;
}

/* 投影模式 */
body.projection-mode .top-bar,
body.projection-mode .sidebar,
body.projection-mode .student-list-section,
body.projection-mode .status-bar {
    display: none;
}
body.projection-mode .main-content {
    padding: 0;
}
body.projection-mode .main-area {
    padding: 0;
}
body.projection-mode .result-display-section {
    height: 100vh;
    width: 100vw;
    margin: 0;
    border-radius: 0;
    border: none;
    font-size: 200%; /* Make everything bigger */
}
body.projection-mode .student-card {
    font-size: 5rem;
    padding: 2rem 3rem;
}
body.projection-mode .student-card .student-group {
    font-size: 2rem;
}
