/* 기본 스타일 및 CSS 변수 */
:root {
    --primary-color: #FF6B00;
    --primary-light: #FF8A3D;
    --primary-dark: #E65C00;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    --purple-color: #C2410C;
    --websocket-connected: #10b981;
    --websocket-disconnected: #ef4444;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --transition-fast: all 0.15s ease;
    --transition-normal: all 0.25s ease;
    --transition-slow: all 0.5s ease;
}

/* 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    min-height: 100vh;
    user-select: none;
    overflow-x: auto;
}

/* 앱 컨테이너 */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1600px;
    margin: 0 auto;
    background: var(--bg-primary);
    box-shadow: var(--shadow-xl);
}

/* 헤더 */
.header {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.app-title {
    font-size: 1.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-title i {
    font-size: 2rem;
    color: var(--primary-color);
}

.header-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 컨트롤 패널 */
.control-panel {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
}

.control-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.batch-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.batch-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.batch-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    min-width: 150px;
}

.batch-select:hover {
    border-color: var(--primary-light);
}

.batch-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

/* 상태 범례 */
.status-legend {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-sm);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-sm);
}

/* 메인 콘텐츠 */
.main-content {
    flex: 1;
    padding: 2rem;
    background: var(--bg-secondary);
}

/* 스크롤바 스타일 (모바일에서 스크롤 개선) */
.main-content::-webkit-scrollbar,
.classroom-container::-webkit-scrollbar {
    height: 8px;
}

.main-content::-webkit-scrollbar-track,
.classroom-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.main-content::-webkit-scrollbar-thumb,
.classroom-container::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.main-content::-webkit-scrollbar-thumb:hover,
.classroom-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.classroom-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* 스크린 영역 */
.screen-area {
    margin-bottom: 3rem;
    display: flex;
    justify-content: center;
    width: 100%;
}

.screen {
    background: linear-gradient(135deg, #374151 0%, #111827 100%);
    color: white;
    padding: 1.5rem 3rem;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    border: 3px solid #4b5563;
}

.screen i {
    font-size: 1.5rem;
    opacity: 0.9;
}

/* 좌석 그리드 */
.seat-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(11, 55px);
    gap: 0.7rem;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

/* 좌석 래퍼 */
.seat-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 좌석 스타일 */
.seat {
    width: 100%;
    height: 100%;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-sm);
    background: var(--bg-primary);
}

/* 배경 아이콘 */
.seat::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.5rem;
    opacity: 0.1;
    z-index: 1;
    pointer-events: none;
}

.seat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.seat-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0.25rem 0.5rem;
    position: relative;
    z-index: 2;
    gap: 0.25rem;
}

.seat-name {
    font-weight: 600;
    font-size: 0.75rem;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seat-status-icon {
    flex-shrink: 0;
    display: none;
}

.status-icon {
    font-size: 1rem;
    opacity: 0.7;
}

.timer {
    font-size: 0.6rem;
    font-weight: 500;
    color: transparent;
    background: transparent;
    padding: 0.05rem 0.2rem;
    border-radius: var(--radius-sm);
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 35px;
    text-align: center;
}

/* 타이머가 필요한 상태에서만 타이머 색상 표시 */
.seat.wc .timer,
.seat.smoke .timer,
.seat.store .timer {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.seat-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.1) 100%);
    border-radius: var(--radius-lg);
    pointer-events: none;
}

/* 좌석 상태별 스타일 */
.seat.in {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    border-color: var(--success-color);
}

.seat.in::before {
    content: "\f2f6"; /* fa-user-check */
}

.seat.in .status-icon::before {
    content: "\f2f6"; /* fa-user-check */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.seat.out {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #475569 100%);
    color: white;
    border-color: var(--secondary-color);
}

.seat.out::before {
    content: "\f2f5"; /* fa-user-times */
}

.seat.out .status-icon::before {
    content: "\f2f5"; /* fa-user-times */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.seat.wc {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    border-color: #0ea5e9;
}

.seat.wc::before {
    content: "\f7bd"; /* fa-restroom */
}

.seat.wc .status-icon::before {
    content: "\f7bd"; /* fa-restroom */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.seat.smoke {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
    border-color: var(--warning-color);
}

.seat.smoke::before {
    content: "\f48d"; /* fa-smoking */
}

.seat.smoke .status-icon::before {
    content: "\f48d"; /* fa-smoking */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.seat.store {
    background: linear-gradient(135deg, #C2410C 0%, #9A3412 100%);
    color: white;
    border-color: #C2410C;
}

.seat.store::before {
    content: "\f07a"; /* fa-shopping-cart */
}

.seat.store .status-icon::before {
    content: "\f07a"; /* fa-shopping-cart */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.seat.absent {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-color: #ef4444;
}

.seat.absent::before {
    content: "\f235"; /* fa-user-times */
}

.seat.absent .status-icon::before {
    content: "\f235"; /* fa-user-times */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.seat.giveup {
    display: none;
}

.seat.late {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    border-color: #06b6d4;
}

.seat.late::before {
    content: "\f017"; /* fa-clock */
}

.seat.late .status-icon::before {
    content: "\f017"; /* fa-clock */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.seat.out_office {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border-color: #6366f1;
}

.seat.out_office::before {
    content: "\f1ad"; /* fa-building */
}

.seat.out_office .status-icon::before {
    content: "\f1ad"; /* fa-building */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

/* 외출 2시간 초과 시 깜박임 효과 */
.seat.out_office.overtime {
    animation: outOfficeOvertime 1s infinite;
}

@keyframes outOfficeOvertime {
    0%, 50% {
        background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
        border-color: #6366f1;
    }
    51%, 100% {
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
        border-color: #ef4444;
    }
}

/* 타이머가 필요한 상태에 외출 추가 */
.seat.out_office .timer {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

/* 위험 상태 애니메이션 */
.seat.danger {
    animation: dangerPulse 1.5s infinite;
    border-width: 3px;
}

@keyframes dangerPulse {
    0%, 100% {
        border-color: var(--danger-color);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        border-color: var(--warning-color);
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
}

/* 좌석 메뉴 - 완전한 중앙 정렬 */
.seat-menu {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0.8) !important;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    z-index: 1000 !important;
    min-width: 320px;
    max-width: 400px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
    margin: 0 !important;
    padding: 0;
    /* 모든 위치 관련 속성 초기화 */
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    height: auto !important;
    /* Grid/Flex 컨테이너의 영향 차단 */
    grid-area: unset !important;
    flex: none !important;
    align-self: auto !important;
    justify-self: auto !important;
}

.seat-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1) !important;
    top: 50% !important;
    left: 50% !important;
    position: fixed !important;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.menu-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.menu-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.menu-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.menu-actions {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-btn.in {
    border-color: var(--success-color);
    color: var(--success-color);
}

.action-btn.in:hover {
    background: var(--success-color);
    color: white;
}

.action-btn.out {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.action-btn.out:hover {
    background: var(--secondary-color);
    color: white;
}

.action-btn.wc {
    border-color: #0ea5e9;
    color: #0ea5e9;
}

.action-btn.wc:hover {
    background: #0ea5e9;
    color: white;
}

.action-btn.smoke {
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.action-btn.smoke:hover {
    background: var(--warning-color);
    color: white;
}

.action-btn.store {
    border-color: #C2410C;
    color: #C2410C;
}

.action-btn.store:hover {
    background: #C2410C;
    color: white;
}

.action-btn.absent {
    border-color: #ef4444;
    color: #ef4444;
}

.action-btn.absent:hover {
    background: #ef4444;
    color: white;
}

.action-btn.late {
    border-color: #06b6d4;
    color: #06b6d4;
}

.action-btn.late:hover {
    background: #06b6d4;
    color: white;
}

.action-btn.out_office {
    border-color: #6366f1;
    color: #6366f1;
}

.action-btn.out_office:hover {
    background: #6366f1;
    color: white;
}

/* 모달 배경 */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* 푸터 */
.footer {
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: 1rem 2rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auto-refresh {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-contact {
    text-align: center;
    padding: 0.75rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.auto-refresh i {
    animation: rotate 2s linear infinite;
}

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

/* 범례 색상 */
.legend-color.in { background: var(--success-color); }
.legend-color.out { background: var(--secondary-color); }
.legend-color.wc { background: #0ea5e9; }
.legend-color.smoke { background: var(--warning-color); }
.legend-color.store { background: #C2410C; }
.legend-color.absent { background: #ef4444; }
.legend-color.late { background: #06b6d4; }
.legend-color.out_office { background: #6366f1; }

/* 모바일 전용 요소 - 데스크톱에서는 숨김 */
.mobile-only {
    display: none !important;
}

/* 범례 토글 버튼 */
.btn-toggle-legend {
    background: linear-gradient(135deg, var(--info-color), #0891b2);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-toggle-legend:hover {
    background: linear-gradient(135deg, #0891b2, #0e7490);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-toggle-legend:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

/* 아이패드 최적화 */
@media (max-width: 1024px) {
    .seat-grid {
        grid-template-columns: repeat(12, 1fr);
        grid-template-rows: repeat(11, 45px);
        gap: 0.4rem;
        padding: 1rem;
        max-width: 100%;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .control-panel {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.6rem 0.8rem;
    }
    
    .header-content {
        flex-direction: row; /* 한 줄 유지 */
        gap: 0.6rem;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .app-title {
        font-size: 1.2rem;
        gap: 0.5rem;
        flex: 1;
    }
    
    .app-title i {
        font-size: 1.3rem;
    }
    
    .header-stats {
        gap: 0.4rem;
        font-size: 0.75rem;
        flex-wrap: nowrap;
        flex-shrink: 0;
    }
    
    /* 실시간 업데이트 텍스트 숨기기 */
    .stat-label {
        display: none;
    }
    
    /* 상태 인디케이터 크기 조정 */
    .status-indicator {
        width: 10px;
        height: 10px;
    }
    
    /* 버튼은 아이콘만 표시 - 텍스트 숨김 */
    .btn-manage-students .btn-text,
    .btn-logout .btn-text {
        display: none;
    }
    
    .btn-manage-students,
    .btn-logout {
        padding: 0.6rem;
        min-width: auto;
        width: auto;
    }
    
    .btn-manage-students i,
    .btn-logout i {
        font-size: 1.1rem;
        margin-right: 0;
    }
    
    .control-panel {
        padding: 0.75rem 1rem;
    }
    
    .control-content {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 1rem;
    }
    
    .batch-selector {
        width: 100%;
        justify-content: center;
    }
    
    /* 모바일에서 불필요한 버튼 숨기기 - 먼저 적용 */
    .btn-alphabetical-view,
    .btn-history-view {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* 액션 버튼들을 3열 그리드로 (아이콘만 표시) */
    .control-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
        width: 100%;
    }
    
    /* 범례 버튼은 전체 너비로 */
    .btn-toggle-legend {
        grid-column: 1 / -1;
    }
    
    /* 버튼 텍스트 숨기기 */
    .control-actions button .btn-text {
        display: none;
    }
    
    /* 모든 버튼 동일한 크기와 스타일 */
    .control-actions button,
    .control-actions a {
        padding: 0.75rem !important;
        justify-content: center;
        position: relative;
        display: flex;
        align-items: center;
        min-height: 48px;
        width: 100%;
    }
    
    .control-actions button i,
    .control-actions a i {
        font-size: 1.2rem;
        margin: 0;
    }
    
    /* 배지는 아이콘 위에 표시 */
    .btn-meeting-room {
        position: relative;
    }
    
    .meeting-room-badge {
        position: absolute;
        top: 0.2rem;
        right: 0.2rem;
    }
    
    /* 배지 크기 조정 */
    .meeting-room-badge {
        font-size: 0.7rem;
        padding: 0.1rem 0.35rem;
    }
    
    /* 모바일에서만 표시되는 요소 */
    .mobile-only {
        display: flex !important;
    }
    
    /* 범례를 기본적으로 숨김 */
    .status-legend {
        display: none;
        width: 100%;
        margin-top: 0.5rem;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .status-legend.show {
        display: flex;
    }
    
    /* 모바일에서 좌석 메뉴 중앙 정렬 보장 */
    .seat-menu {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(0.8) !important;
        width: 90% !important;
        max-width: 320px !important;
        margin: 0 !important;
        inset: auto !important;
    }
    
    .seat-menu.active {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(1) !important;
    }
    
    .main-content {
        padding: 0.75rem;
        overflow-x: auto; /* 모바일에서 수평 스크롤 활성화 */
        scroll-behavior: smooth; /* 부드러운 스크롤 */
        -webkit-overflow-scrolling: touch; /* iOS 터치 스크롤 개선 */
    }
    
    .classroom-container {
        /* 스크롤을 main-content에서만 처리하도록 변경 */
        width: max-content; /* 내용에 맞는 너비 */
        min-width: 100%; /* 최소 너비는 부모 너비 */
    }
    
    .screen-area {
        margin-bottom: 1rem; /* 기존 3rem에서 축소 */
    }
    
    .screen {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .seat-grid {
        grid-template-columns: repeat(12, minmax(55px, 1fr));
        grid-template-rows: repeat(11, 40px);
        gap: 0.25rem;
        padding: 0.75rem;
        width: fit-content; /* 내용에 맞는 너비 */
        min-width: calc(12 * 55px + 11 * 0.25rem + 1.5rem); /* 정확한 최소 너비 계산 */
        margin: 0 auto;
    }
    
    .seat-menu {
        min-width: 280px;
        margin: 1rem;
    }
    
    .menu-actions {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .classroom-container {
        width: max-content; /* 내용에 맞는 너비 */
        min-width: 100%; /* 최소 너비는 부모 너비 */
    }
    
    .seat-grid {
        grid-template-columns: repeat(12, minmax(48px, 1fr));
        grid-template-rows: repeat(11, 35px);
        gap: 0.15rem;
        padding: 0.6rem;
        width: fit-content; /* 내용에 맞는 너비 */
        min-width: calc(12 * 48px + 11 * 0.15rem + 1.2rem); /* 정확한 최소 너비 계산 */
        margin: 0 auto;
    }
    
    .seat-name {
        font-size: 0.6rem;
    }
    
    .status-icon {
        font-size: 0.7rem;
    }
    
    .timer {
        font-size: 0.55rem;
        width: 30px;
        padding: 0.05rem 0.15rem;
    }
    
    /* 모바일에서도 타이머가 필요한 상태에서만 색상 표시 */
    .seat.wc .timer,
    .seat.smoke .timer,
    .seat.store .timer {
        color: var(--danger-color);
        background: rgba(239, 68, 68, 0.1);
    }
}



/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1e293b;
        --bg-secondary: #0f172a;
        --bg-tertiary: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border-color: #334155;
    }
}

/* 프린트 스타일 */
@media print {
    .header, .control-panel, .footer, .seat-menu, .modal-backdrop {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .seat-grid {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* ================================
   WebSocket 관련 스타일
   ================================ */

/* 연결 상태 표시 */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--websocket-disconnected);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
    animation: pulse-disconnected 2s infinite;
    transition: var(--transition-normal);
}

.status-indicator.live {
    background-color: var(--websocket-connected);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    animation: pulse-connected 2s infinite;
}

.status-indicator.disconnected {
    background-color: var(--websocket-disconnected);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
    animation: pulse-disconnected 2s infinite;
}

/* 수강생 관리 버튼 */
.btn-manage-students {
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-normal);
    border: 1px solid var(--border-color);
}

.btn-manage-students:hover {
    background: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* 실시간 업데이트 애니메이션 */
.seat.updated {
    animation: seatUpdatePulse 1s ease-out;
}

@keyframes seatUpdatePulse {
    0% {
        transform: scale(1);
        box-shadow: var(--shadow-md);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 4px rgba(255, 138, 61, 0.3), var(--shadow-lg);
    }
    100% {
        transform: scale(1);
        box-shadow: var(--shadow-md);
    }
}

/* 연결 상태 애니메이션 */
@keyframes pulse-connected {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@keyframes pulse-disconnected {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* WebSocket 연결 실패 시 알림 */
.websocket-warning {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: var(--warning-color);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

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

/* ================================
   전체 퇴실 기능 스타일
   ================================ */

/* 컨트롤 액션 버튼들 */
.control-actions {
    display: flex;
    gap: 1rem;
    margin: 0 1rem;
    align-items: center;
}

/* 가나다순 보기 버튼 */
.btn-alphabetical-view {
    background: linear-gradient(135deg, var(--primary-color), #E65C00);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-md);
}

/* 히스토리 보기 버튼 */
.btn-history-view {
    background: linear-gradient(135deg, var(--info-color), #0891b2);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-alphabetical-view:hover {
    background: linear-gradient(135deg, #E65C00, #B84800);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-history-view:hover {
    background: linear-gradient(135deg, #0891b2, #0e7490);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-alphabetical-view.active {
    background: linear-gradient(135deg, var(--primary-color), #E65C00);
}

.btn-alphabetical-view.active:hover {
    background: linear-gradient(135deg, #E65C00, #B84800);
}

.bulk-exit-btn {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.bulk-exit-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.bulk-exit-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

/* 모달 스타일 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    transition: opacity 0.3s ease;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    color: var(--danger-color);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    margin: 0 0 1rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.modal-warning {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.modal-warning i {
    color: var(--info-color);
    margin-top: 0.1rem;
}

.modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-btn.cancel {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.modal-btn.cancel:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-btn.confirm {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
}

.modal-btn.confirm:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* 전체 퇴실 로딩 */
.bulk-exit-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-xl);
}

.loading-content i {
    font-size: 2rem;
    color: var(--danger-color);
}

.loading-content span {
    color: var(--text-primary);
    font-weight: 600;
}

/* 전체 퇴실 메시지 */
.bulk-exit-message {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1500;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
}

.bulk-exit-message.success {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.bulk-exit-message.error {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.bulk-exit-message i {
    font-size: 1.25rem;
}

/* 범용 메시지 스타일 */
.general-message {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1500;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
}

.general-message.info {
    background: linear-gradient(135deg, var(--primary-color), #E65C00);
}

.general-message.success {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.general-message.error {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.general-message.loading {
    background: linear-gradient(135deg, var(--info-color), #0891b2);
}

.general-message i {
    font-size: 1.25rem;
}

/* 모달 애니메이션 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* 반응형 모달 */
@media (max-width: 768px) {
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .bulk-exit-message,
    .general-message {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        font-size: 0.875rem;
    }
    
    .bulk-actions {
        margin: 0 0.5rem;
    }
    
    .bulk-exit-btn {
        font-size: 0.8rem;
        padding: 0.625rem 1.25rem;
    }
}

/* ================================
   좌석 이동 애니메이션
   ================================ */

/* 좌석 이동 중 */
.seat-placeholder.moving {
    transform: scale(1.1);
    z-index: 100;
    box-shadow: 0 8px 25px rgba(255, 107, 0, 0.3);
}

.seat.moving {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 107, 0, 0.4);
}

/* 빈 좌석 플레이스홀더 */
.seat-placeholder.empty {
    opacity: 0.3;
}

.seat.empty {
    background: transparent;
    border: 2px dashed var(--border-color);
    color: var(--text-tertiary);
    cursor: default;
}

.seat.empty:hover {
    transform: none;
    box-shadow: none;
}

.seat.empty .seat-name {
    font-style: italic;
    opacity: 0.5;
}

/* ================================
   가나다순 정렬 영역 스타일
   ================================ */

.alphabetical-container {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.alphabetical-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.alphabetical-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.alphabetical-header i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.student-count-badge {
    background: linear-gradient(135deg, var(--primary-color), #E65C00);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    margin-left: auto;
}

.alphabetical-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    align-items: start;
}

.alphabetical-student {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.alphabetical-student:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.alphabetical-student-name {
    font-weight: 600;
    font-size: 0.875rem;
    text-align: center;
    color: var(--text-primary);
    line-height: 1.3;
}

.alphabetical-student-info {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}



.alphabetical-student-status {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 상태별 스타일 - 기존 좌석 색상과 동일하게 매칭 */
.alphabetical-student.in {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(5, 150, 105, 0.02));
}

.alphabetical-student.in .alphabetical-student-status {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

.alphabetical-student.out {
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.05), rgba(71, 85, 105, 0.02));
}

.alphabetical-student.out .alphabetical-student-status {
    background: linear-gradient(135deg, var(--secondary-color), #475569);
    color: white;
}

.alphabetical-student.wc {
    border-color: #0ea5e9;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.05), rgba(2, 132, 199, 0.02));
}

.alphabetical-student.wc .alphabetical-student-status {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
}

.alphabetical-student.smoke {
    border-color: var(--warning-color);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(217, 119, 6, 0.02));
}

.alphabetical-student.smoke .alphabetical-student-status {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    color: white;
}

.alphabetical-student.store {
    border-color: #C2410C;
    background: linear-gradient(135deg, rgba(194, 65, 12, 0.05), rgba(154, 52, 18, 0.02));
}

.alphabetical-student.store .alphabetical-student-status {
    background: linear-gradient(135deg, #C2410C, #9A3412);
    color: white;
}

.alphabetical-student.absent {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(220, 38, 38, 0.02));
}

.alphabetical-student.absent .alphabetical-student-status {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.alphabetical-student.giveup {
    border-color: #6b7280;
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.05), rgba(107, 114, 128, 0.02));
    opacity: 0.7;
}

.alphabetical-student.giveup .alphabetical-student-status {
    background: #6b7280;
    color: white;
}

/* 애니메이션 */
.alphabetical-student {
    animation: fadeInUp 0.3s ease-out;
}

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

/* 반응형 */
@media (max-width: 768px) {
    .alphabetical-container {
        margin-top: 2rem;
        padding: 1.5rem;
    }
    
    .alphabetical-header h3 {
        font-size: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .student-count-badge {
        margin-left: 0;
        align-self: flex-start;
    }
    
    .alphabetical-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
    }
}

/* 좌석 하이라이트 효과 */
.seat.highlighted {
    animation: highlightPulse 0.6s ease-in-out 3;
    z-index: 50;
}

@keyframes highlightPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 107, 0, 0);
    }
}

/* ================================
   드래그 앤 드롭 스타일
   ================================ */

/* 드래그 중인 좌석 */
.seat.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    cursor: grabbing;
}

/* 좌석 기본 커서 */
.seat {
    cursor: grab;
}

.seat:active {
    cursor: grabbing;
}

/* 드롭 활성화 상태의 그리드 */
.seat-grid.drop-active {
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.03), rgba(255, 138, 61, 0.02));
    border: 2px dashed rgba(255, 107, 0, 0.2);
    border-radius: var(--radius-xl);
}

/* 드롭 가이드 (빈 공간에 표시되는 점선 영역) */
.drop-guide {
    border: 2px dashed rgba(255, 107, 0, 0.3);
    border-radius: var(--radius-md);
    background: rgba(255, 107, 0, 0.05);
    transition: var(--transition-fast);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-guide::before {
    content: "\f067"; /* fa-plus */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: rgba(255, 107, 0, 0.4);
    font-size: 1rem;
}

/* 하이라이트된 드롭 가이드 */
.drop-guide.highlight {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.drop-guide.highlight::before {
    color: var(--success-color);
    animation: dropPulse 0.8s ease-in-out infinite;
}

/* 좌석 이동 완료 애니메이션 */
.seat-moved {
    animation: seatMoveSuccess 0.5s ease-out;
}

@keyframes dropPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes seatMoveSuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    }
    100% {
        transform: scale(1);
    }
}

/* 드래그 중 다른 좌석들 스타일 */
.seat-grid.drop-active .seat:not(.dragging) {
    opacity: 0.7;
    filter: saturate(0.8);
}

/* 모바일에서 드래그 비활성화 */
@media (max-width: 768px) {
    .seat {
        cursor: pointer;
    }
    
    .seat[draggable="true"] {
        -webkit-user-drag: none;
        -khtml-user-drag: none;
        -moz-user-drag: none;
        -o-user-drag: none;
        user-drag: none;
    }
}

/* 터치 디바이스에서 드래그 개선 */
@media (pointer: coarse) {
    .drop-guide {
        min-height: 44px; /* 터치하기 쉬운 크기 */
        min-width: 44px;
    }
}

/* ================================
   히스토리 모달 스타일
   ================================ */

/* 히스토리 모달 컨테이너 */
.history-modal {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.history-modal .modal-body {
    padding: 0;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 필터 영역 */
.history-filters {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.filter-select, .filter-input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.1);
}

.filter-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #E65C00);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #E65C00, #B84800);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* 테이블 컨테이너 */
.history-table-container {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
    min-height: 400px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.history-table thead {
    background: linear-gradient(135deg, var(--primary-color), #E65C00);
    color: white;
}

.history-table th,
.history-table td {
    padding: 1rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.history-table th {
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.history-table tbody tr:hover {
    background: var(--bg-secondary);
}

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

/* 상태 표시 */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.in {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.out {
    background: rgba(100, 116, 139, 0.1);
    color: var(--secondary-color);
}

.status-badge.wc {
    background: rgba(14, 165, 233, 0.1);
    color: #0ea5e9;
}

.status-badge.smoke {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-badge.store {
    background: rgba(194, 65, 12, 0.1);
    color: #C2410C;
}

.status-badge.absent {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* 페이징 */
.history-pagination {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pagination-btn {
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 로딩 상태 */
.history-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.history-loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* 데이터 없음 상태 */
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
    text-align: center;
}

.history-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.history-empty p {
    font-size: 1.125rem;
    margin: 0;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .history-modal {
        width: 98%;
        max-height: 95vh;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .filter-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn {
        justify-content: center;
        width: 100%;
    }
    
    .history-table-container {
        padding: 1rem;
        overflow-x: auto;
    }
    
    .history-table {
        min-width: 800px;
    }
    
    .history-table th,
    .history-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .history-pagination {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .pagination-info {
        order: -1;
    }
}

@media (max-width: 480px) {
    .history-table th,
    .history-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .pagination-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* 로그아웃 버튼 스타일 */
.btn-logout {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-logout:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-logout i {
    font-size: 0.8rem;
}

/* ================================
   회의실 관련 스타일
   ================================ */

/* 회의실 버튼 */
.btn-meeting-room {
    background: linear-gradient(135deg, #C2410C, #9A3412);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-md);
    position: relative;
}

.btn-meeting-room:hover {
    background: linear-gradient(135deg, #9A3412, #7C2D12);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.meeting-room-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #9A3412;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 1.5rem;
    text-align: center;
}

/* 좌석 위 회의실 뱃지 */
.meeting-room-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    background: linear-gradient(135deg, #C2410C, #9A3412);
    color: white;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.15rem 0.3rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    line-height: 1;
}

@keyframes meetingBadgePulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(194, 65, 12, 0.4);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 0 4px rgba(194, 65, 12, 0);
    }
}

/* 좌석 메뉴 내 회의실 섹션 */
.menu-meeting-room {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(194, 65, 12, 0.03);
}

.meeting-room-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meeting-room-label::before {
    content: "🚪";
}

.meeting-room-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.meeting-room-btn {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    min-width: 60px;
    text-align: center;
}

.meeting-room-btn:hover {
    background: linear-gradient(135deg, #C2410C, #9A3412);
    border-color: #C2410C;
    color: white;
    transform: translateY(-1px);
}

.meeting-room-btn.active {
    background: linear-gradient(135deg, #C2410C, #9A3412);
    border-color: #C2410C;
    color: white;
}

.meeting-room-btn.exit-btn {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-color: #fca5a5;
    color: var(--danger-color);
}

.meeting-room-btn.exit-btn:hover {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    border-color: var(--danger-color);
    color: white;
}

/* 회의실 현황 모달 */
.meeting-room-modal {
    max-width: 700px;
    width: 95%;
}

.meeting-room-modal .modal-header h3 {
    color: #C2410C;
}

/* 회의실 카드 그리드 */
.meeting-rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.meeting-room-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: var(--transition-normal);
}

.meeting-room-card:hover {
    border-color: #C2410C;
    box-shadow: var(--shadow-md);
}

.meeting-room-card.has-members {
    border-color: #C2410C;
    background: linear-gradient(135deg, rgba(194, 65, 12, 0.03), rgba(154, 52, 18, 0.05));
}

.room-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.room-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.room-card-title i {
    color: #C2410C;
}

.room-card-count {
    background: #C2410C;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
}

.room-card-members {
    max-height: 150px;
    overflow-y: auto;
}

.room-member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.room-member-item:hover {
    background: var(--bg-tertiary);
}

.room-member-item:last-child {
    margin-bottom: 0;
}

.member-exit-btn {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    opacity: 0.5;
    transition: var(--transition-fast);
    padding: 0.25rem;
}

.room-member-item:hover .member-exit-btn {
    opacity: 1;
}

.member-exit-btn:hover {
    transform: scale(1.2);
}

.room-empty-message {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding: 1rem;
    font-size: 0.875rem;
}

/* 회의실 전체 퇴장 버튼 */
.meeting-room-actions {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* 회의실 선택 모달 */
.meeting-room-select-modal {
    max-width: 400px;
}

.select-student-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 1.5rem;
}

.meeting-room-select-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.meeting-room-select-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-normal);
}

.meeting-room-select-btn:hover {
    background: linear-gradient(135deg, #C2410C, #9A3412);
    border-color: #C2410C;
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.meeting-room-select-btn i {
    font-size: 1.5rem;
    color: #C2410C;
    transition: var(--transition-fast);
}

.meeting-room-select-btn:hover i {
    color: white;
}

.meeting-room-select-btn span {
    font-weight: 600;
    font-size: 0.875rem;
}

/* 반응형 */
@media (max-width: 768px) {
    .meeting-rooms-grid {
        grid-template-columns: 1fr;
    }
    
    .meeting-room-select-grid {
        grid-template-columns: 1fr;
    }
    
    .meeting-room-indicator {
        top: 1px;
        right: 1px;
        font-size: 0.5rem;
        padding: 0.1rem 0.2rem;
    }
    
    .btn-meeting-room {
        width: 100%;
        justify-content: center;
    }
}

/* ================================
   점심시간 상태 스타일
   ================================ */

/* 점심시간 좌석 스타일 */
.seat.lunch {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    border-color: #f97316;
    cursor: pointer;
    position: relative;
}

.seat.lunch::before {
    content: "\f2e7"; /* fa-utensils */
}

.seat.lunch .status-icon::before {
    content: "\f2e7"; /* fa-utensils */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

/* 점심시간 좌석 호버 - 클릭 유도 */
.seat.lunch:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(249, 115, 22, 0.4);
}

.seat.lunch::after {
    content: "클릭→복귀";
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.55rem;
    color: #f97316;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 4px;
    border-radius: 3px;
}

.seat.lunch:hover::after {
    opacity: 1;
}

/* 점심시간 범례 색상 */
.legend-color.lunch { background: #f97316; }

/* 점심시간 버튼 */
.btn-lunch-time {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-lunch-time:hover {
    background: linear-gradient(135deg, #ea580c, #c2410c);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 점심시간 모달 헤더 */
.lunch-modal-header h3 {
    color: #f97316 !important;
}

/* 점심시간 확인 버튼 */
.modal-btn.lunch-confirm {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

.modal-btn.lunch-confirm:hover {
    background: linear-gradient(135deg, #ea580c, #c2410c);
}

/* 점심시간 힌트 텍스트 */
.lunch-time-hint {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    font-size: 0.875rem;
    color: #ea580c;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 1rem;
}

.lunch-time-hint i {
    margin-top: 0.1rem;
}

/* 가나다순 보기 점심시간 스타일 */
.alphabetical-student.lunch {
    border-color: #f97316;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.05), rgba(234, 88, 12, 0.02));
}

.alphabetical-student.lunch .alphabetical-student-status {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
}

/* 히스토리 상태 배지 */
.status-badge.lunch {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

/* 반응형 */
@media (max-width: 768px) {
    .btn-lunch-time {
        width: 100%;
        justify-content: center;
    }
    
    .seat.lunch::after {
        display: none;
    }
}

