@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-color: #0f172a;
  --surface-color: #1e293b;
  --surface-color-light: #334155;
  --primary-color: #3b82f6;
  --primary-hover: #60a5fa;
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --accent: #f59e0b;
  --danger: #ef4444;
  --blur-amount: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow: hidden; /* 프리젠터, 청중 모두 스크롤 방지 */
}

/* === Presenter View Styles === */
.presenter-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px;
  gap: 20px;
}

/* Header / Controls */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(var(--blur-amount));
  padding: 15px 25px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 15px;
}

.info-group {
  display: flex;
  align-items: center;
  gap: 30px;
  font-variant-numeric: tabular-nums;
}

.time-display, .timer-display {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 1px;
}

.timer-controls {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  background: var(--surface-color-light);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

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

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

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent:hover {
  background: #d97706;
}

.btn-danger {
  background: var(--danger);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-danger:hover {
  background: #dc2626;
}

/* Viewers */
.viewer-container {
  display: flex;
  gap: 20px;
  flex: 1;
  min-height: 0; 
}

.preview-box {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  padding: 15px;
  flex: 1; /* evenly split */
}

/* Current slide is slightly larger */
.preview-box.current {
  flex: 1.5;
}

.preview-header {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
}

.slide-wrapper {
  flex: 1;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.slide-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Inputs and Radio Options */
.input-field {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  outline: none;
  width: 70px;
  text-align: center;
  font-family: inherit;
  font-weight: 500;
}
.input-field:focus {
  border-color: var(--primary-color);
}

.radio-group {
  display: flex;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.radio-group label {
  padding: 8px 15px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: 0.2s;
}

.radio-group input[type="radio"] {
  display: none;
}

.radio-group input[type="radio"]:checked + label {
  background: var(--primary-color);
  color: #fff;
}

/* Bottom Controls */
.bottom-bar {
  display: flex;
  justify-content: center;
  gap: 15px;
  padding: 10px;
}

/* === Audience View Styles === */
.audience-layout {
  width: 100vw;
  height: 100vh;
  background-color: #000;
  position: relative;
  overflow: hidden;
}

.audience-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.5s ease-in-out;
}

/* For Fade transitions */
.canvas-hide {
  opacity: 0;
}
.canvas-show {
  opacity: 1;
}
/* Immediately cut */
.no-transition {
  transition: none !important;
}

/* Black screen overlay */
#black-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#black-screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* 프롬프터 내 메시지 박스 가독성 강화 (흰색 바탕, 빨간 글씨) */
#prompter-message-box {
  background: #ffffff !important; 
  border: 4px solid #ff0000 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#prompter-message-text {
  font-size: 2.8rem !important; /* 글씨 크기 추가 확대 */
  color: #ff0000 !important;
  font-weight: 800 !important;
  line-height: 1.2;
}

/* 우측 하단 메시지 패널 */
.prompter-msg-panel {
  position: absolute;
  bottom: 25px;
  right: 25px;
  width: 400px;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(var(--blur-amount));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.panel-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.msg-log-container-v2 {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
  height: 150px;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column; /* 최근 메시지가 아래로 오도록 수정 */
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-input-group {
  display: flex;
  gap: 10px;
}

/* 다음 슬라이드 박스 정렬 */
.prompter-box.next {
  grid-area: next;
  align-self: center; /* 프롬프터는 다시 중앙 정렬 */
}

/* 발표자 화면용 미리보기 박스 정렬 */
.viewer-container .preview-box:not(.current) {
  align-self: flex-start; /* 발표자 화면의 다음 슬라이드는 상단 정렬 */
}

.msg-log-item {
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
}

.msg-log-item b {
  color: var(--accent);
}

/* Start Overlay for audience */
.audience-start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  gap: 20px;
}

/* === Prompter View Styles === */
.prompter-layout {
  display: grid;
  grid-template-areas: 
    "current next"
    "info info";
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr auto;
  height: 100vh;
  width: 100vw;
  background-color: #000;
  padding: 20px;
  gap: 20px;
}

.prompter-box {
  background: rgba(30, 41, 59, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.prompter-box.current {
  grid-area: current;
}

.prompter-box.next {
  grid-area: next;
}

.prompter-info-bar {
  grid-area: info;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(10px);
  padding: 15px 40px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.prompter-header {
  padding: 10px 20px;
  font-size: 1.1rem; /* 약간 더 크게 */
  font-weight: 600;
  color: var(--text-muted);
  background: transparent; /* 배경색 제거 */
  z-index: 10;
}

.prompter-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.prompter-timer-group {
  display: flex;
  gap: 40px;
  align-items: center;
}

.prompter-time-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.prompter-time-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 5px;
}

.prompter-time-value {
  font-size: 2.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.prompter-time-value.timer {
  color: var(--accent);
}
