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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    font-weight: 700;
}

@media (max-width: 768px) {
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
}

/* 标签导航 */
.tab-nav {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.tab-btn {
    flex: 1;
    padding: 20px;
    border: none;
    background: transparent;
    font-size: 1.1em;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #e9ecef;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

/* 标签内容 */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@media (max-width: 768px) {
    .tab-content {
        padding: 15px;
    }
}

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

/* 学生管理页面 */
.management-section {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    min-height: 600px;
}

@media (max-width: 968px) {
    .management-section {
        grid-template-columns: 1fr;
        gap: 15px;
        min-height: auto;
    }
    
    .student-list-section {
        order: 2;
    }
    
    .add-student-section {
        order: 1;
    }
}

/* 卡片样式 */
.section-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 20px;
    border: 2px solid #f0f0f0;
    transition: all 0.3s;
}

.section-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: #e0e0e0;
}

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

.card-header h2 {
    font-size: 1.2em;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

@media (max-width: 768px) {
    .card-header {
        padding: 12px 15px;
    }
    
    .card-header h2 {
        font-size: 1.1em;
    }
    
    .card-body {
        padding: 15px;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 700;
    min-width: 30px;
    text-align: center;
}

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

@media (max-width: 768px) {
    .header-buttons {
        gap: 8px;
    }
}


/* 快速添加表单 */
.quick-add-form {
    display: flex;
    gap: 10px;
}

.quick-add-form input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s;
}

@media (max-width: 768px) {
    .quick-add-form input {
        padding: 10px 14px;
        font-size: 0.95em;
    }
}

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

/* 表单元素 */
#student-name {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s;
}

#student-name:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.file-hint {
    margin-top: 10px;
    color: #6c757d;
    font-size: 0.85em;
    text-align: center;
}


/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85em;
    border-radius: 8px;
}

.btn-full {
    width: 100%;
    padding: 12px;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
}

.btn-large {
    padding: 20px 40px;
    font-size: 1.3em;
    margin: 20px 10px;
}

@media (max-width: 768px) {
    .btn-large {
        padding: 14px 28px;
        font-size: 1.1em;
        margin: 15px 8px;
    }
}

/* 学生列表 */
.student-list-section .section-card {
    height: calc(100vh - 280px);
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.student-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

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

@media (max-width: 968px) {
    .student-list-section .section-card {
        height: auto;
        min-height: 300px;
    }
}

.student-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 10px;
    margin-bottom: 8px;
    animation: slideIn 0.3s;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
}

@media (max-width: 768px) {
    .student-item {
        padding: 10px 12px;
        font-size: 0.95em;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.student-item:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    border-color: #667eea;
    transform: translateX(5px);
}

.student-name {
    font-size: 1em;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.student-name::before {
    content: "👤";
    font-size: 1.2em;
}

.btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-delete:hover {
    background: #c82333;
    transform: scale(1.1);
}

.empty-message {
    text-align: center;
    color: #adb5bd;
    padding: 60px 20px;
    font-size: 1em;
    line-height: 1.8;
}

.history-list .empty-message {
    padding: 40px 20px;
    font-size: 0.95em;
}

/* 随机抽选页面 */
.random-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
    max-height: 800px;
    overflow: hidden;
}

.random-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    height: 350px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .random-section {
        height: calc(100vh - 200px);
    }
    
    .random-display {
        padding: 20px 15px;
        height: 280px;
        margin-bottom: 15px;
        border-radius: 15px;
    }
}

.random-result {
    width: 100%;
}

.result-placeholder {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5em;
}

.result-name {
    font-size: 4em;
    font-weight: 700;
    color: white;
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .result-placeholder {
        font-size: 1.1em;
    }
    
    .result-name {
        font-size: 2.5em;
    }
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-name.rolling {
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* 老虎机滚动动画 */
.slot-machine-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
}

.slot-window {
    position: relative;
    width: 380px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        inset 0 4px 20px rgba(0, 0, 0, 0.3),
        0 10px 40px rgba(0, 0, 0, 0.3);
}

.slot-highlight {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 20px);
    height: 70px;
    border: 4px solid rgba(255, 215, 0, 0.8);
    border-radius: 15px;
    background: rgba(255, 215, 0, 0.1);
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.5),
        inset 0 0 30px rgba(255, 215, 0, 0.2);
    z-index: 2;
    pointer-events: none;
}

.slot-track {
    position: absolute;
    top: 65px;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.slot-item {
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2em;
    font-weight: 700;
    color: white;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

@keyframes slotSpin {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-350px);
    }
}

.slot-text {
    font-size: 1.6em;
    font-weight: 600;
    color: white;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    animation: textPulse 1.5s ease-in-out infinite;
    transition: color 0.3s;
}

@keyframes textPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .slot-window {
        width: 90%;
        max-width: 320px;
        height: 180px;
    }
    
    .slot-highlight {
        height: 60px;
    }
    
    .slot-track {
        top: 60px;
    }
    
    .slot-item {
        height: 60px;
        font-size: 1.8em;
    }
    
    .slot-text {
        font-size: 1.3em;
    }
}

.multiple-results {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

@media (max-width: 768px) {
    .multiple-results {
        gap: 15px;
    }
}

.result-card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 30px 40px;
    border-radius: 15px;
    min-width: 150px;
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@media (max-width: 768px) {
    .result-card {
        padding: 20px 25px;
        min-width: 120px;
    }
}

.result-number {
    font-size: 1.2em;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
}

.result-card-name {
    font-size: 2.5em;
    font-weight: 700;
    color: white;
}

@media (max-width: 768px) {
    .result-number {
        font-size: 1em;
        margin-bottom: 8px;
    }
    
    .result-card-name {
        font-size: 2em;
    }
}

/* 控制区域 */
.random-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .random-controls {
        gap: 10px;
        margin-bottom: 15px;
    }
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px 20px;
    border-radius: 10px;
}

.control-group label {
    font-weight: 600;
    color: #333;
}

@media (max-width: 768px) {
    .control-group {
        padding: 8px 15px;
    }
    
    .control-group label {
        font-size: 0.9em;
    }
}

/* 数字输入加减组件 */
.number-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e9ecef;
}

.number-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.5em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.number-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: scale(1.05);
}

.number-btn:active {
    transform: scale(0.95);
}

.number-input-wrapper input[type="number"] {
    width: 60px;
    padding: 8px;
    border: none;
    font-size: 1.1em;
    text-align: center;
    font-weight: 600;
    color: #333;
    background: white;
}

.number-input-wrapper input[type="number"]:focus {
    outline: none;
}

/* 隐藏数字输入框的上下箭头 */
.number-input-wrapper input[type="number"]::-webkit-inner-spin-button,
.number-input-wrapper input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.number-input-wrapper input[type="number"] {
    -moz-appearance: textfield;
}

/* 历史记录 */
.history-section {
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

@media (max-width: 768px) {
    .history-section {
        padding: 15px;
        border-radius: 15px;
    }
}

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

.history-section h3 {
    color: #333;
    font-size: 1.3em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 768px) {
    .history-header {
        margin-bottom: 15px;
        padding-bottom: 12px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .history-section h3 {
        font-size: 1.1em;
    }
}

.history-section h3::before {
    content: "📜";
    font-size: 1.2em;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    min-height: 0;
}

.history-item {
    background: white;
    padding: 15px 18px;
    border-radius: 12px;
    margin-bottom: 12px;
    text-align: left;
    animation: slideIn 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
    border: 2px solid #f0f0f0;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .history-item {
        padding: 12px 15px;
        gap: 10px;
        margin-bottom: 10px;
    }
}

.history-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.history-item:hover {
    background: #ffffff;
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.history-item:hover::before {
    opacity: 1;
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-time {
    color: #9ca3af;
    font-size: 0.8em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-time::before {
    content: "🕐";
    font-size: 1em;
}

@media (max-width: 768px) {
    .history-time {
        font-size: 0.75em;
    }
}

.history-names {
    color: #333;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

@media (max-width: 768px) {
    .history-names {
        font-size: 0.95em;
    }
}

.btn-delete-history {
    background: transparent;
    color: #dc3545;
    border: 2px solid #dc3545;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
}

.history-item:hover .btn-delete-history {
    opacity: 1;
}

.btn-delete-history:hover {
    background: #dc3545;
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* 滚动条样式 */
.student-list::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
    width: 8px;
}

.student-list::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.student-list::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.student-list::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

