/* =============================================
   클래스 코드 크게 보기 — js/modules/teacher/classCodeDisplay.js
   프로젝터로 교실 뒤에서도 읽히게 크게. 앱 대화상자(20000) 아래, 채팅·메모 패널 위
   ============================================= */

.class-code-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 8px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.2s ease;
}

.class-code-btn:hover,
.class-code-btn.active {
    background: rgba(74, 158, 255, 0.18);
}

.class-code-btn {
    position: relative;
}

/* 코드 없음은 아이콘을 흐리게 (열림/닫힘은 아이콘 모양으로만 구분) */
.class-code-btn.no-code i { opacity: 0.45; }

/* 프로필 > 클래스: "지금부터 다시 세기" 작은 버튼 (.modal .control-button 의 44px 최소 높이 해제) */
#classCodeDevices .control-button.class-count-reset {
    min-width: 0;
    min-height: 0 !important;
    height: 26px;
    margin: 0;
    padding: 0 10px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 26px;
}

.class-code-overlay {
    position: fixed;
    inset: 0;
    z-index: 15000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* 수업 전 교안을 띄운 채 그 위에 접속 안내를 보여 주는 용도: 뒤 화면을 어둡게/흐리게 하지 않는다.
       바깥은 클릭이 그대로 통과 (닫기는 X·Esc·Alt+K) */
    background: transparent;
    pointer-events: none;
}

.class-code-overlay[hidden] {
    display: none;
}

.class-code-panel {
    position: relative;
    width: min(640px, 100%);
    border-radius: 20px;
    pointer-events: auto;
    /* 그래파이트(청회색) 글래스: 교안이 흰색·파랑·주황·초록 칠판 어느 색이든 부딪히지 않는 중립색.
       사이트 정체성은 민트 단계 번호·분필 노랑 주소·초록 열림 점으로 남긴다. 배경은 조금 비치게 (코드는 칸 배경이 따로 있어 또렷하다) */
    background:
        radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, 0.10), transparent 55%),
        linear-gradient(135deg, rgba(52, 58, 70, 0.72) 0%, rgba(30, 34, 44, 0.80) 100%);
    /* 살짝 비치되 글자 뒤 교안 내용은 흐려져 읽기에 방해되지 않게 (사이트 글래스와 같은 방식) */
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 10px 28px rgba(0, 0, 0, 0.28),
        0 28px 70px rgba(0, 0, 0, 0.30);
    color: #fff;
    text-align: center;
    overflow: hidden;
    animation: classCodeIn 0.22s ease-out;
}

.class-code-panel.is-dragging {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 18px 40px rgba(0, 0, 0, 0.34),
        0 40px 90px rgba(0, 0, 0, 0.36);
}

/* transform 은 옮기기에 쓰므로 등장 효과는 opacity·scale 만 */
@keyframes classCodeIn {
    from { opacity: 0; scale: 0.97; }
    to { opacity: 1; scale: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .class-code-panel { animation: none; }
}

/* 큰 화면(고해상도 프로젝터·4K)에서는 카드도 조금 키운다 (--cc-base), 크게 보기는 그 위에 한 단계 (--cc-large) */
.class-code-panel { zoom: calc(var(--cc-base, 1) * var(--cc-large, 1)); }
.class-code-panel.is-large { --cc-large: 1.6; }
@media (max-width: 1100px), (max-height: 700px) { .class-code-panel.is-large { --cc-large: 1.25; } }
@media (min-width: 1900px) and (min-height: 1000px) { .class-code-panel { --cc-base: 1.15; } }
@media (min-width: 2400px) and (min-height: 1200px) { .class-code-panel { --cc-base: 1.3; } }
@media (min-width: 3200px) and (min-height: 1700px) { .class-code-panel { --cc-base: 1.7; } }

/* 머리: 제목 + 닫기. 끌어서 옮기고, 두 번 클릭하면 가운데로 */
.class-code-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 90px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.class-code-panel.is-dragging .class-code-head { cursor: grabbing; }

.class-code-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.92);
}

.class-code-label i { color: #ffd66b; }

/* 크게 보기 버튼: 닫기 버튼 왼쪽, 같은 크기의 둥근 버튼 */
.class-code-size {
    position: absolute;
    top: 50%;
    right: 50px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.class-code-size:hover,
.class-code-size[aria-pressed="true"] {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.class-code-head .class-code-close {
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
}

.class-code-body {
    padding: 22px 28px 2px;
}

.class-code-value {
    display: flex;
    justify-content: center;
    gap: clamp(5px, 0.6vw, 8px);
    margin: 0 0 16px;
    font-family: Consolas, "D2Coding", "Courier New", monospace;
    font-size: clamp(36px, 4.4vw, 60px);
    font-weight: 700;
    line-height: 1;
    color: #fff;
    cursor: copy;
    user-select: all;
    /* 0 과 O 구분 */
    font-variant-numeric: slashed-zero;
}

/* 한 글자 = 한 칸 */
.class-code-char {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05em;
    height: 1.3em;
    border-radius: 0.16em;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* 끌어 선택했을 때 진한 파란 덩어리 대신 옅은 민트로 */
.class-code-value ::selection { background: rgba(126, 226, 168, 0.35); color: #fff; }

/* 두 묶음 사이 틈 */
.class-code-gap {
    width: clamp(6px, 0.9vw, 14px);
}

.class-code-value.copied .class-code-char {
    background: rgba(126, 226, 168, 0.22);
    border-color: rgba(126, 226, 168, 0.6);
    color: #c9f5da;
}

.class-code-value.is-empty {
    color: rgba(255, 255, 255, 0.45);
    cursor: default;
}

/* 접속 단계: 번호 + 짧은 문장, 가로로 나란히 (좁으면 줄바꿈) */
.class-code-address {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 0 0 20px;
    font-size: clamp(15px, 1.4vw, 18px);
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
}

.class-code-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.class-code-step-num {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4em;
    height: 1.4em;
    border-radius: 50%;
    background: #7ee2a8;
    color: #123a1c;
    font-size: 0.78em;
    font-weight: 800;
}

.class-code-site {
    /* 접속 주소: 코드 바로 밑에 한 줄로 크게 (학생이 받아 적는 부분). 비치는 카드 위라 옅은 그림자로 윤곽만 */
    margin: 0 0 14px;
    color: #ffe08a;
    font-family: Consolas, "D2Coding", "Courier New", monospace;
    font-size: clamp(30px, 3.3vw, 44px);
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    overflow-wrap: anywhere;
}

.class-code-site:empty { display: none; }

/* 아래 상태 줄: 카드 바닥의 옅은 띠 */
.class-code-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 11px 20px;
    background: rgba(0, 0, 0, 0.16);
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    font-size: 14px;
}

.class-code-status:empty { display: none; }

.class-code-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
}

.class-code-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.class-code-dot.is-open { background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.2); }
.class-code-dot.is-closed { background: #f87171; box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.2); }

/* 글래스 위 보조 버튼 */
.class-code-small {
    margin: 0 !important;
    padding: 4px 12px !important;
    min-height: 0 !important;
    font-size: 13px !important;
    background: rgba(255, 255, 255, 0.10) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    border-radius: 8px !important;
}

.class-code-small:hover {
    background: rgba(255, 255, 255, 0.18) !important;
}

.class-code-actions:not(:empty) {
    padding: 0 0 24px;
}

.class-code-actions .control-button {
    margin: 0;
}

@media (max-width: 600px) {
    .class-code-body {
        padding: 20px 16px 2px;
    }
}
