/* ==========================================
   우리 반 자리 바꾸기 - 스타일시트 (style.css)
   초등학생 대상 파스텔톤, 둥근 디자인, 전자칠판 가독성 극대화
   ========================================== */

/* 1. 디자인 시스템 & CSS 변수 정의 */
:root {
    /* 파스텔 색상 팔레트 */
    --bg-app: #f7fafc;          /* 부드러운 오프화이트 앱 배경 */
    --bg-card: #ffffff;         /* 메인 카드 배경 */
    --text-main: #2d3748;       /* 메인 다크 그레이 텍스트 */
    --text-muted: #718096;      /* 보조 회색 텍스트 */
    
    /* 기능별 테마 색상 (초등 교실용 웜&파스텔) */
    --pastel-mint: #e6f4ea;     /* 연두/민트 */
    --pastel-mint-dark: #137333;
    --pastel-blue: #e8f0fe;     /* 연하늘/블루 */
    --pastel-blue-dark: #1a73e8;
    --pastel-yellow: #fef7e0;   /* 연노랑 */
    --pastel-yellow-dark: #b06000;
    --pastel-pink: #fce8e6;     /* 연분홍 */
    --pastel-pink-dark: #c5221f;

    /* 버튼 전용 파스텔 톤 */
    --btn-primary: #4db6ac;      /* 따뜻한 민트 에메랄드 */
    --btn-primary-hover: #26a69a;
    --btn-primary-shadow: rgba(77, 182, 172, 0.3);
    
    --btn-secondary: #ffb74d;    /* 부드러운 옐로우 오렌지 */
    --btn-secondary-hover: #ffa726;
    --btn-secondary-shadow: rgba(255, 183, 77, 0.3);

    /* 좌석 카드 색상 (고대비 가독성 확보) */
    --seat-student-bg: #ebf5fb;     /* 아주 부드러운 파스텔 블루 */
    --seat-student-border: #aed6f1; /* 둥근 테두리 하늘색 */
    --seat-student-text: #1b4f72;   /* 깊은 군청색 (가독성용) */

    --seat-empty-bg: #fafafa;
    --seat-empty-border: #d5dbdb;
    --seat-empty-text: #bdc3c7;

    /* 모서리 둥글기 (초등 친화적) */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 50px;

    /* 그림자 효과 */
    --shadow-soft: 0 8px 24px rgba(149, 157, 165, 0.15);
    --shadow-medium: 0 12px 32px rgba(149, 157, 165, 0.25);
    --shadow-button: 0 6px 16px;
    --shadow-chalkboard: inset 0 0 15px rgba(0,0,0,0.5), 0 8px 16px rgba(0,0,0,0.15);
}

/* 2. 기본 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 3. 전체 레이아웃 (반응형 2컬럼) */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* 4. 왼쪽 설정 사이드바 */
.sidebar {
    width: 360px;
    background-color: var(--bg-card);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.02);
    flex-shrink: 0;
}

/* 로고/헤더 */
.app-header {
    text-align: center;
    border-bottom: 2px dashed #edf2f7;
    padding-bottom: 1.2rem;
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.3rem;
}

.logo-icon {
    font-size: 2rem;
}

.app-header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.app-header .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 입력 그룹 */
.config-section {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    flex-grow: 1;
}

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

.input-group label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.input-group label i {
    font-size: 1.1rem;
    padding: 6px;
    border-radius: 8px;
}

/* 아이콘 개별 파스텔 백그라운드 */
.icon-pastel-blue { background-color: var(--pastel-blue); color: var(--pastel-blue-dark); }
.icon-pastel-green { background-color: var(--pastel-mint); color: var(--pastel-mint-dark); }
.icon-pastel-yellow { background-color: var(--pastel-yellow); color: var(--pastel-yellow-dark); }

.input-group label .badge {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 2px;
}

textarea {
    width: 100%;
    height: 180px;
    padding: 0.8rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    background-color: #fcfdfd;
}

textarea:focus {
    border-color: var(--btn-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(77, 182, 172, 0.15);
}

/* 행/열 수 그리드 */
.grid-config {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

input[type="number"] {
    width: 100%;
    padding: 0.7rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: all 0.2s ease;
    background-color: #fcfdfd;
}

input[type="number"]:focus {
    border-color: var(--btn-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(77, 182, 172, 0.15);
}

/* 실시간 통계 정보 카드 */
.stats-card {
    background-color: #f8fafc;
    border: 1.5px solid #edf2f7;
    border-radius: var(--radius-md);
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.stat-divider {
    width: 1px;
    height: 25px;
    background-color: #edf2f7;
}

/* 사이드바 하단 버튼 그룹 */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: auto;
}

button {
    width: 100%;
    padding: 0.95rem;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

button:active {
    transform: scale(0.97);
}

.btn-primary {
    background-color: var(--btn-primary);
    color: white;
    box-shadow: var(--shadow-button) var(--btn-primary-shadow);
}

.btn-primary:hover {
    background-color: var(--btn-primary-hover);
    box-shadow: 0 8px 20px var(--btn-primary-shadow);
}

.btn-secondary {
    background-color: var(--btn-secondary);
    color: white;
    box-shadow: var(--shadow-button) var(--btn-secondary-shadow);
}

.btn-secondary:hover {
    background-color: var(--btn-secondary-hover);
    box-shadow: 0 8px 20px var(--btn-secondary-shadow);
}

/* 5. 오른쪽 메인 화면 */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    background-color: var(--bg-app);
    height: 100vh;
    overflow-y: auto;
}

/* 교실 칠판/교탁 영역 */
.podium-area {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.chalkboard {
    background-color: #1b5e20; /* 칠판 초록색 */
    color: #ffffff;
    padding: 0.8rem 4rem;
    border-radius: var(--radius-md);
    border: 8px solid #8d6e63; /* 갈색 나무 프레임 */
    box-shadow: var(--shadow-chalkboard);
    text-align: center;
    position: relative;
    max-width: 500px;
    width: 100%;
}

.chalkboard-text {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* 6. 동적 자리 배치 격자판 */
.classroom-grid-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.classroom-grid {
    display: grid;
    gap: 1.2rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 2rem;
}

/* 7. 좌석 카드 공통 스타일 */
.seat-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    aspect-ratio: 1.4 / 1; /* 가로가 약간 더 넓은 카드 비율 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
}

.seat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

/* 개별 카드 번호 가이드 (예: 1-1, 1-2 등 행/열 안내) */
.seat-index {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* 학생 카드 스타일 */
.student-seat-card {
    background-color: var(--seat-student-bg);
    border: 2px solid var(--seat-student-border);
    color: var(--seat-student-text);
}

.student-seat-card .seat-index {
    color: #85c1e9;
}

/* 학생 이름 - 전자칠판 대비 대형 크기 설정 */
.student-name {
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

/* 빈자리 카드 스타일 */
.empty-seat-card {
    background-color: var(--seat-empty-bg);
    border: 2px dashed var(--seat-empty-border);
    color: var(--seat-empty-text);
}

.empty-seat-card .seat-index {
    color: #d5dbdb;
}

.empty-text {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
}

/* 8. 팝업/바운스 등장 애니메이션 */
@keyframes popIn {
    0% {
        transform: scale(0.8) translateY(15px);
        opacity: 0;
    }
    70% {
        transform: scale(1.05) translateY(-3px);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.animate-pop {
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* 9. 토스트 알림 메시지 */
.toast-notification {
    position: fixed;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2d3748;
    color: #ffffff;
    padding: 0.9rem 2rem;
    border-radius: var(--radius-pill);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 0.95rem;
    z-index: 1000;
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.show {
    bottom: 30px;
}

.toast-notification i {
    color: var(--btn-primary);
    font-size: 1.2rem;
}

/* 10. 반응형 레이아웃 뷰포트 크기 대응 */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        height: auto;
        padding: 1.5rem;
    }
    
    .main-content {
        height: auto;
        min-height: calc(100vh - 400px);
        padding: 1.5rem 1rem;
    }
    
    textarea {
        height: 120px;
    }
    
    .chalkboard {
        padding: 0.6rem 2rem;
    }
    
    .student-name {
        font-size: 1.4rem;
    }
}

/* 학생 수가 많아 격자 카드가 너무 작아질 때를 대비한 폰트 스케일링 */
@media (min-width: 1200px) {
    /* 전자칠판에서 더 크게 보여주고 싶을 경우의 넉넉한 레이아웃 보장 */
    .classroom-grid {
        max-width: 1300px;
    }
}
