/* --- 디자인 시스템 & 변수 설정 --- */
:root {
    --bg-color: #faf6f0;         /* 부드러운 밀크티/따뜻한 크림빛 배경 */
    --panel-bg: #ffffff;         /* 설정 카드 배경 */
    --text-main: #333333;        /* 메인 텍스트 */
    --text-muted: #666666;       /* 부가 텍스트 */
    
    /* 파스텔 테마 색상 */
    --primary-color: #ff8b94;    /* 러블리 피치 핑크 */
    --primary-hover: #ff7680;
    --secondary-color: #a8d8ea;  /* 파스텔 스카이 블루 */
    --secondary-hover: #93cce1;
    --mint-color: #a8e6cf;       /* 파스텔 민트 */
    --yellow-color: #ffd3b6;     /* 파스텔 옐로우 오렌지 */
    --lavender-color: #dcedc1;   /* 파스텔 라임/라벤더 조화 */
    --border-color: #eedec9;     /* 둥근 테두리용 연한 피치 */
    
    /* 칠판 색상 */
    --board-bg: #2d5a27;         /* 아늑한 학교 초록 칠판 */
    --board-wood: #8c52ff;       /* 보드 프레임 테마 */
    
    --card-shadow: 0 8px 16px rgba(140, 82, 255, 0.06);
    --hover-shadow: 0 12px 24px rgba(255, 139, 148, 0.15);
    --font-jua: 'Jua', 'Noto Sans KR', sans-serif;
    --font-noto: 'Noto Sans KR', sans-serif;
}

/* --- 기본 초기화 및 레이아웃 --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-noto);
    color: var(--text-main);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 1280px;
    background: #ffffff;
    border-radius: 30px;
    padding: 30px;
    border: 6px solid #f1e6d7;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.03);
}

/* --- 헤더 디자인 --- */
.app-header {
    text-align: center;
    margin-bottom: 30px;
}

.app-header h1 {
    font-family: var(--font-jua);
    font-size: 2.5rem;
    color: #ff7680;
    text-shadow: 2px 2px 0px #ffe5e7;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

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

/* --- 메인 콘텐츠 분할 --- */
.app-main {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

/* 모바일 & 태블릿 대응 */
@media (max-width: 992px) {
    .app-main {
        flex-direction: column;
    }
    .control-panel {
        width: 100% !important;
    }
}

/* --- 왼쪽 설정 패널 --- */
.control-panel {
    width: 380px;
    flex-shrink: 0;
}

.panel-card {
    background: #fffefb;
    border: 3px solid var(--border-color);
    border-radius: 24px;
    padding: 25px;
    box-shadow: var(--card-shadow);
}

.panel-title {
    font-family: var(--font-jua);
    font-size: 1.5rem;
    color: #555;
    margin-bottom: 20px;
    border-bottom: 3px dashed var(--border-color);
    padding-bottom: 10px;
}

/* --- 입력 폼 구성 --- */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: #555555;
    margin-bottom: 8px;
}

.input-group input[type="number"] {
    width: 100%;
    padding: 12px 18px;
    border: 2px solid #eedec9;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: var(--font-jua);
    color: #ff7680;
    outline: none;
    transition: all 0.2s ease-in-out;
    background-color: #fffdfb;
}

.input-group input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 139, 148, 0.15);
    background-color: #ffffff;
}

.reveal-mode-options {
    display: flex;
    gap: 12px;
    margin-top: 5px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: #fffdfb;
    border: 2px solid #eedec9;
    padding: 10px 14px;
    border-radius: 15px;
    transition: all 0.2s ease-in-out;
    flex: 1;
    justify-content: center;
    user-select: none;
}

.radio-label:hover {
    border-color: var(--primary-color);
    background-color: #ffffff;
}

.radio-label input[type="radio"] {
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

/* 라디오 버튼 선택 시 라벨의 테두리와 배경색 변화 (:has 유사 클래스 이용) */
.radio-label:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background-color: #ffe5e7;
    color: #ff7680;
    font-weight: 700;
}

.textarea-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.textarea-header label {
    margin-bottom: 0;
}

.btn-text {
    background: none;
    border: none;
    font-family: var(--font-noto);
    font-size: 0.85rem;
    font-weight: 700;
    color: #4a90e2;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.btn-text:hover {
    color: #2b6cb0;
}

.input-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #eedec9;
    border-radius: 18px;
    font-size: 1rem;
    font-family: var(--font-noto);
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: all 0.2s ease-in-out;
    background-color: #fffdfb;
}

.input-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(255, 139, 148, 0.15);
    background-color: #ffffff;
}

.char-count {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
    font-weight: 500;
}

/* --- 버튼 디자인 --- */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.btn {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 20px;
    font-family: var(--font-jua);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-secondary {
    background-color: var(--secondary-color);
    color: #334e68;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-hover);
    box-shadow: 0 6px 12px rgba(168, 216, 234, 0.3);
}

.btn-accent {
    background-color: var(--mint-color);
    color: #274e37;
}

.btn-accent:hover:not(:disabled) {
    background-color: #92daba;
    box-shadow: 0 6px 12px rgba(168, 230, 207, 0.3);
}

.btn:disabled {
    background-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

/* --- 오른쪽 디스플레이 패널 --- */
.display-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.classroom-board {
    background-color: #fffefb;
    border: 3px solid var(--border-color);
    border-radius: 24px;
    padding: 30px;
    height: 100%;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    box-shadow: var(--card-shadow);
}

/* 교실 칠판 */
.blackboard {
    background-color: var(--board-bg);
    color: #ffffff;
    font-family: var(--font-jua);
    font-size: 1.4rem;
    text-align: center;
    padding: 12px 0;
    border-radius: 16px;
    border: 8px solid #c39b62; /* 따뜻한 나무색 테두리 */
    box-shadow: inset 0 0 20px rgba(0,0,0,0.4), 0 4px 8px rgba(0,0,0,0.15);
    letter-spacing: 2px;
    position: relative;
}

/* 칠판 하단 분필 받침대 효과 */
.blackboard::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 10%;
    right: 10%;
    height: 6px;
    background: #b08953;
    border-radius: 3px;
}

/* --- 자리 배치 그리드 --- */
.seating-grid {
    flex-grow: 1;
    display: grid;
    gap: 15px;
    justify-content: center;
    align-content: start;
    width: 100%;
}

/* 빈 상태 메시지 */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 300px;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.8;
}

/* --- 자리 카드 스타일 --- */
.seat-card {
    background: white;
    border: 2.5px solid #ebd8c0;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px 10px;
    aspect-ratio: 1.25 / 1;
    min-width: 80px;
    max-width: 140px;
    box-shadow: 0 4px 8px rgba(235, 216, 192, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    user-select: none;
}

.seat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(235, 216, 192, 0.4);
}

.seat-number {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-bottom: 4px;
    font-weight: 700;
}

.seat-name {
    font-family: var(--font-jua);
    font-size: 1.3rem;
    color: var(--text-main);
    word-break: keep-all;
    text-align: center;
}

/* 성별 기반 카드 배경색 매핑 */
.seat-student-male { background-color: #d6e4ff; border-color: #adc8ff; } /* 파스텔 블루 (남학생) */
.seat-student-female { background-color: #ffd6e0; border-color: #ffb3c6; } /* 파스텔 피치 핑크 (여학생) */
.seat-student-unknown { background-color: #fef5d1; border-color: #ebdca5; } /* 성별 미지정 시 파스텔 옐로우 */

/* 특별 학생 카드 배경색 매핑 (일반용 / 하위 호환) */
.seat-student-0 { background-color: #ffd6e0; border-color: #ffb3c6; } /* 파스텔 핑크 */
.seat-student-1 { background-color: #d6e4ff; border-color: #adc8ff; } /* 파스텔 블루 */
.seat-student-2 { background-color: #dcedc1; border-color: #b8e0b3; } /* 파스텔 멜론 */
.seat-student-3 { background-color: #ffd3b6; border-color: #ffbfa3; } /* 파스텔 아프리콧 */
.seat-student-4 { background-color: #e8dbfc; border-color: #cfbbf7; } /* 파스텔 라벤더 */

/* 빈자리 카드 */
.seat-empty {
    background-color: #f3f4f6;
    border: 2px dashed #cbd5e1;
    box-shadow: none;
}

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

.seat-empty .seat-name {
    color: #94a3b8;
    font-size: 1.1rem;
    font-family: var(--font-noto);
    font-weight: 500;
}


/* 아직 공개되지 않은 자리 카드 */
.seat-card.unrevealed {
    background-color: #f7fafc;
    border: 2.5px dashed #cbd5e1;
    box-shadow: none;
    cursor: pointer;
}

.seat-card.unrevealed:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
    box-shadow: 0 6px 12px rgba(255, 139, 148, 0.1);
}

.seat-card.unrevealed .seat-name {
    color: #cbd5e1;
    font-size: 1.4rem;
}

/* --- 자리 공개 애니메이션 --- */
@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.6) rotate(-5deg);
    }
    70% {
        transform: scale(1.05) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

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

/* --- 토스트 메시지 안내 --- */
.toast-message {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333333;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: bottom 0.3s ease-in-out;
}

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

/* --- 푸터 스타일 --- */
.app-footer {
    text-align: center;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
