/**
 * 라이브 Q&A 스타일
 */

/* ===== 인증 영역 (collab-doc과 동일) ===== */
.cloud-auth-area {
    position: fixed;
    top: 16px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 900;
}

.cloud-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    color: #555;
    transition: background 0.15s, box-shadow 0.15s;
}

.cloud-login-btn:hover {
    background: #f8f8f8;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.cloud-user-area {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #555;
}

.cloud-user-photo {
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.cloud-user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cloud-logout-btn {
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border: none;
    background: none;
    cursor: pointer;
    color: #999;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.cloud-logout-btn:hover {
    color: #e74c3c;
    background: #fef0f0;
}

/* ===== 랜딩 페이지 ===== */
#landingPage.container {
    max-width: 1000px;
}

#landingPage .panel-title {
    margin-bottom: 24px;
}

.subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.ttl-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fef3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 0.82rem;
    margin-bottom: 16px;
}

.ttl-warning svg { flex-shrink: 0; stroke: #856404; }

.text-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 12px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}

.text-input:focus { border-color: #667eea; }

.room-code-input {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 6px;
    text-transform: uppercase;
}

.create-btn-area {
    margin-top: 36px;
}

.create-btn-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.create-btn-row .btn-primary {
    min-width: 44%;
    justify-content: center;
}

.cancel-edit-btn {
    font-size: 0.82rem;
    padding: 6px 20px;
}

.hint {
    font-size: 0.78rem;
    color: #999;
    margin-top: 8px;
    text-align: center;
}

.join-desc {
    font-size: 0.88rem;
    color: #666;
    margin-bottom: 16px;
}

/* 내 방 목록 */
.my-rooms-section {
    margin-top: 32px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
}

.my-rooms-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.my-room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.my-room-item:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.1); }

.my-room-title {
    flex: 1;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.my-room-code {
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: #667eea;
    background: #f0f0ff;
    padding: 2px 8px;
    border-radius: 6px;
}

.my-room-expiry {
    font-size: 0.78rem;
    color: #e67e22;
}

.my-room-expiry.ended {
    color: #999;
}

.my-room-delete {
    padding: 4px 8px;
    border: none;
    background: none;
    color: #ccc;
    cursor: pointer;
    font-size: 1.1rem;
    border-radius: 4px;
    transition: color 0.12s;
}

.my-room-delete:hover { color: #e74c3c; }

/* ===== 방 페이지 ===== */
#roomPage {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(135deg, #e8eaf6 0%, #f3e5f5 100%);
    z-index: 1;
}

.room-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 12px 20px 0;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.room-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.room-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-code-badge {
    font-family: monospace;
    font-size: 0.82rem;
    font-weight: 700;
    color: #667eea;
    background: #f0f0ff;
    padding: 3px 10px;
    border-radius: 6px;
}

.room-code-badge.clickable {
    cursor: pointer;
    transition: background 0.12s;
}

.room-code-badge.clickable:hover {
    background: #e0e0ff;
}


/* 폼 그리드 (레이블 + 값 정렬) */
.form-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 24px 14px;
    align-items: center;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    text-align: right;
    white-space: nowrap;
    line-height: 36px; /* 입력 높이와 수직 정렬 */
}

.form-label-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.form-label-hint {
    font-size: 0.68rem;
    color: #bbb;
    font-weight: 400;
}

.form-value {
    min-width: 0;
}

/* 폼 내부 모든 입력 높이 통일: 36px */
.form-value .text-input,
.form-value select,
.end-date-input,
.end-select,
.translate-lang-select {
    height: 36px;
    padding: 0 10px;
    margin-bottom: 0;
    font-size: 0.85rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
}

/* 종료 시간 행 */
.end-time-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
}

.end-date-input {
    flex: 1;
    text-align: center;
    font-family: monospace;
}

.end-select {
    width: auto;
    text-align: center;
    padding: 0 6px;
}

.end-time-colon {
    font-weight: 700;
    color: #555;
    font-size: 1rem;
    line-height: 36px;
}

/* 토글 버튼 — 높이 36px 통일 */
.toggle-btns {
    display: flex;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.toggle-btn {
    flex: 1;
    padding: 0 16px;
    border: none;
    background: #f5f5f5;
    color: #bbb;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 34px; /* 36px - 2px border */
}

.toggle-btn + .toggle-btn {
    border-left: 1px solid #ddd;
}

.toggle-btn.active {
    background: #667eea;
    color: white;
    font-weight: 600;
}

/* 번역 언어 격자 선택 */
.lang-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.lang-chip {
    padding: 5px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f9f9f9;
    color: #999;
    font-size: 0.78rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.lang-chip:hover {
    border-color: #b0b8d6;
}

.lang-chip.selected {
    background: #667eea;
    border-color: #667eea;
    color: white;
    font-weight: 600;
}

/* 글자수 슬라이더 */
.max-length-row {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
}

.max-length-slider {
    flex: 1;
    accent-color: #667eea;
}

.max-length-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #667eea;
    min-width: 36px;
    text-align: center;
}

/* 아카이브 배너 */
.archive-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.archive-banner svg { flex-shrink: 0; stroke: #999; }

/* 로딩 오버레이 */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #e8eaf6 0%, #f3e5f5 100%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: opacity 0.3s ease;
}

.loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #ddd;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 0.9rem;
    color: #888;
}

.room-expiry-badge {
    font-size: 0.75rem;
    color: #e67e22;
    background: #fef3cd;
    padding: 3px 10px;
    border-radius: 6px;
}

.room-expiry-badge.ended {
    color: #999;
    background: #f0f0f0;
}

.room-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    color: #555;
    transition: background 0.12s, color 0.12s;
}

.btn-icon:hover { background: #f0f0ff; color: #667eea; }

.btn-back {
    border: none;
    background: none;
    padding: 0;
    width: 28px;
    height: 28px;
}

/* 질문 입력 */
.question-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.question-textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}

.question-textarea:focus { border-color: #667eea; }

.question-input-wrapper {
    flex: 1;
    position: relative;
}

.char-count {
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 0.7rem;
    color: #bbb;
}

.char-count.near-limit {
    color: #e67e22;
}

.char-count.at-limit {
    color: #e74c3c;
    font-weight: 600;
}

.submit-btn {
    padding: 10px 20px;
    white-space: nowrap;
    align-self: flex-end;
}

/* 질문 목록 */
.room-footer {
    flex-shrink: 0;
    text-align: center;
    padding: 10px 20px;
    font-size: 0.75rem;
    color: #999;
}

.room-footer a {
    color: #667eea;
    text-decoration: none;
}

.room-footer a:hover {
    text-decoration: underline;
}

.question-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 20px;
}

.empty-state {
    text-align: center;
    color: #bbb;
    padding: 40px 20px;
    font-size: 0.95rem;
}

.question-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    padding-right: 80px;
    background: white;
    border-radius: 10px;
    border-left: 3px solid #667eea;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.15s;
    position: relative;
}

.question-item:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.08); }

.question-rank {
    font-size: 0.82rem;
    font-weight: 700;
    color: #bbb;
    min-width: 24px;
    text-align: center;
    padding-top: 2px;
}

.question-text {
    flex: 1;
    font-size: 0.92rem;
    color: #333;
    line-height: 1.5;
    word-break: break-word;
}

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

.question-meta {
    font-size: 0.72rem;
    color: #aaa;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.question-time {
    color: #ccc;
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #eee;
    background: #fafafa;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #999;
    transition: all 0.15s;
    position: absolute;
    top: 10px;
    right: 10px;
}

.vote-btn:hover { border-color: #f48fb1; color: #e91e63; }

.vote-btn.voted {
    background: #fce4ec;
    border-color: #f48fb1;
    color: #e91e63;
    font-weight: 600;
}

.vote-btn.voted .vote-heart { transform: scale(1.2); }

.vote-heart {
    font-size: 1rem;
    transition: transform 0.2s;
}

.vote-count {
    font-weight: 600;
}

/* 질문 아이템 래퍼 (삭제 버튼 외부 배치) */
.question-item-wrapper {
    position: relative;
}

.question-item-wrapper .question-item {
    width: 100%;
}

/* 관리자 삭제 버튼 (아이템 박스 오른쪽 바깥) */
.admin-delete-btn {
    position: absolute;
    right: -28px;
    top: 12px;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: #ccc;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.12s;
}

.admin-delete-btn:hover {
    color: #e74c3c;
}

/* 번역 텍스트 */
.question-translation {
    font-size: 0.92rem;
    color: #888;
    margin-top: 8px;
    line-height: 1.5;
}

.presenter-translations .question-translation {
    font-size: 1.6rem;
    color: rgba(255,255,255,0.5);
    margin-top: 10px;
}

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

/* 세션 목록 (오른쪽 패널 내부) */
.session-list-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.session-list-login-hint {
    text-align: center;
    color: #bbb;
    font-size: 0.85rem;
    padding: 24px 0;
}

/* 세션 목록 패널 (미사용, 하위호환) */
.saved-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 380px;
    max-height: 400px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.saved-panel.open { display: flex; }

.saved-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
}

.saved-panel-close {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #999;
    padding: 2px 6px;
    border-radius: 4px;
}

.saved-panel-close:hover { background: #f0f0f0; color: #333; }

.saved-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.saved-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
}

.saved-item:hover { background: #f5f5ff; }

.saved-item.editing {
    background: #f0f0ff;
    border: 1px solid #667eea;
    border-radius: 8px;
}

.saved-item-info { flex: 1; min-width: 0; }

.saved-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.saved-item-code {
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #667eea;
}

.saved-item-expiry {
    font-size: 0.72rem;
    color: #e67e22;
}

.saved-item-expiry.ended { color: #999; }

.saved-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.saved-item-edit {
    border: none;
    background: none;
    color: #bbb;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.12s;
}

.saved-item-edit:hover { color: #667eea; }

.saved-item-download {
    border: none;
    background: none;
    color: #bbb;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.12s;
}

.saved-item-download:hover { color: #11998e; }

.saved-item-delete {
    border: none;
    background: none;
    color: #ccc;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.12s;
}

.saved-item-delete:hover { color: #e74c3c; }

.saved-empty {
    text-align: center;
    color: #bbb;
    padding: 20px;
    font-size: 0.85rem;
}

.cloud-saved-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1px solid #b8d4e3;
    border-radius: 20px;
    background: #f0f8ff;
    cursor: pointer;
    font-size: 0.8rem;
    color: #3a7cbd;
    transition: background 0.15s;
}

.cloud-saved-btn:hover { background: #e0f0ff; }

/* ===== QR 모달 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.qr-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    padding: 24px;
    text-align: center;
    max-width: 90vw;
}

.qr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.modal-close {
    border: none;
    background: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
}

.qr-code-area {
    display: inline-block;
    padding: 16px;
    background: white;
    border-radius: 12px;
    border: 1px solid #eee;
}

.qr-room-code {
    margin-top: 12px;
    font-family: monospace;
    font-size: 1.6rem;
    font-weight: 700;
    color: #667eea;
    letter-spacing: 4px;
}

/* ===== 발표자 모드 (좌: 정보, 우: 질문) ===== */
.presenter-overlay {
    position: fixed;
    inset: 0;
    background: #1a1a2e;
    z-index: 9000;
    overflow: hidden;
}

.presenter-layout {
    display: flex;
    height: 100%;
}

.presenter-sidebar {
    width: 300px;
    flex-shrink: 0;
    padding: 40px 32px;
    border-right: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    overflow-y: auto;
}

.presenter-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    text-align: center;
    word-break: break-word;
}

.presenter-code {
    font-family: monospace;
    font-size: 1.6rem;
    font-weight: 700;
    color: #667eea;
    letter-spacing: 5px;
    margin-top: 8px;
}

.presenter-question-meta {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 6px;
}

.presenter-qr {
    background: white;
    padding: 8px;
    border-radius: 8px;
    margin: auto 0;
}

.presenter-viewer-count {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.5);
}

.btn-presenter-exit {
    padding: 10px 24px;
    border: 1px solid rgba(255,255,255,0.3);
    background: transparent;
    color: #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.12s;
    margin-top: auto;
    width: 100%;
    text-align: center;
}

.btn-presenter-exit:hover { background: rgba(255,255,255,0.1); }

.presenter-question-list {
    flex: 1;
    padding: 40px 48px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.presenter-question-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.presenter-rank {
    font-size: 1.6rem;
    font-weight: 700;
    color: #667eea;
    min-width: 36px;
    text-align: center;
}

.presenter-question-text {
    flex: 1;
    font-size: 1.6rem;
    color: #f0f0f0;
    line-height: 1.6;
    word-break: break-word;
}

.presenter-like-count {
    font-size: 1.4rem;
    color: #f48fb1;
    font-weight: 600;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 발표자 모드 질문 포커스 */
.presenter-question-item {
    cursor: pointer;
    transition: opacity 0.3s, transform 0.3s;
}

.presenter-question-list.has-focus .presenter-question-item {
    opacity: 0.25;
}

.presenter-question-list.has-focus .presenter-question-item.focused {
    opacity: 1;
    transform: scale(1.02);
}

.presenter-empty {
    text-align: center;
    color: rgba(255,255,255,0.3);
    padding: 60px 20px;
    font-size: 1.2rem;
}

/* 전체화면 시 홈/언어/인증/푸터 숨기기 */
:fullscreen .home-button,
:fullscreen .lang-toggle,
:fullscreen .cloud-auth-area,
:fullscreen .footer,
:fullscreen #bmc-wbtn,
:fullscreen .bmc-btn-container {
    display: none !important;
}

/* ===== 반응형 ===== */
@media (max-width: 700px) {
    .room-header { flex-direction: column; align-items: flex-start; }
    .room-header-right { align-self: flex-end; }
    .submit-btn { width: 100%; }
    .presenter-header { flex-direction: column; align-items: flex-start; padding: 16px; }
    .presenter-question-list { padding: 16px; }
    .presenter-question-text { font-size: 1rem; }
    .my-room-item { flex-wrap: wrap; }
}
