/* View 페이지 전용 스타일 */
/* 사용자 화면용 독립 CSS 파일 */

/* 기본 변수 (view 전용) */
:root {
  --primary-color: #2563eb;
  --danger-color: #dc2626;
  --background-color: #ffffff;
  --panel-background: #f8f9fa;
  --text-primary: #212529;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --hover-color: #1d4ed8;
  --interim-background: #f1f5f9;
  --success-color: #059669;
  --accent-color: #2563eb;
  --accent-color-rgb: 37, 99, 235;
  --accent-color-hover: #1d4ed8;
  --accent-color-light: rgba(37, 99, 235, 0.1);
  --button-bg: #f1f5f9;
  --button-hover: #e2e8f0;
  --text-color: #212529;
  --header-color: #212529;
  --modal-backdrop: rgba(0, 0, 0, 0.5);
  --modal-background: #ffffff;
  --modal-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  --warning-color: #ea580c;
  --input-background: #ffffff;
  --card-background: #f8fafc;
  --card-hover: #f1f5f9;
  --status-color: #64748b;
  --admin-panel-bg: #ffffff;
  --admin-panel-header: #f5f5f5;
  
  /* 화면 전용 변수들 */
  --original-text-bg: #e8f5e9;
  --original-text-border: #66bb6a;
  --merged-bubble-bg: #e8f5e9;
  --merged-bubble-border: #66bb6a;
  --translation-bg: #fff3e0;
}

[data-theme="dark"] {
  --background-color: #1a1a1a;
  --panel-background: #2d2d2d;
  --border-color: #404040;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --interim-background: #363636;
  --preliminary-translation-bg: #3d3223;
  --header-color: #ffffff;
  --button-bg: #404040;
  --button-hover: #505050;
  --admin-panel-bg: #2d2d2d;
  --admin-panel-header: #363636;
  
  /* 화면 전용 다크모드 */
  --original-text-bg: #1b3a1d;
  --original-text-border: #4caf50;
  --merged-bubble-bg: #1e4d2e;
  --merged-bubble-border: #66bb6a;
  --primary-bg: #1a1a1a;
  --control-bg: #2d2d2d;
  --panel-header-bg: #363636;
  --status-color: #a0a0a0;
  --title-color: #ffffff;
  --theme-icon-color: #f1f3f5;
}

/* CSS Reset 및 기본 스타일 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  /* View 전용 레이아웃 */
  max-width: 100%;
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.header {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-background);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.main-content {
  flex: 1;
  margin: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.transcription-panel {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  min-height: 0;
  overflow: hidden;
  padding: 1rem;
  margin-bottom: 0px;
}

.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel-background);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.panel-header {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  background: var(--background-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h2 {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  color: var(--text-secondary);
}

.text-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}

.interim-content {
  position: sticky;
  bottom: -20px;
  margin: 0 1.5rem 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--interim-background);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  z-index: 1;
}

.interim-content.fading {
  color: transparent;
  transition: color 4s ease-out;
}

/* 글꼴 크기 조정을 위한 동적 적용 (JavaScript에서 조정됨) */
.font-size-large .interim-content {
  font-size: 1.5rem !important;
  padding: 1.5rem 2rem !important;
}

.font-size-small .interim-content {
  font-size: 0.75rem !important;
  padding: 0.75rem 1rem !important;
}

/* 버튼 스타일 */
.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--button-bg);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-color);
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.icon-button:hover {
  background: var(--button-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle {
  position: static;
  width: 35px;
  height: 35px;
}

.theme-toggle i {
  font-size: 1rem;
}

/* Footer 스타일 (interim 하단 배치) */
.footer-styled {
  flex-shrink: 0;
  padding: 1rem;
  margin-top: auto;
  background: var(--background-color);
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Footer를 interim 하단에 배치 */
.footer-container {
  display: none; /* 기본적으로 숨김 */
}

.main-content.with-footer .footer-container {
  display: block;
  margin-top: auto;
  padding-top: 1rem;
}

/* 번역 버블 */
.final-text p,
.final-translation p {
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  background: var(--interim-background);
  border: 1px solid var(--border-color);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 다크모드 토글 버튼 */
.theme-image {
  width: 35px;
  height: 35px;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.theme-image:hover {
  opacity: 0.7;
}

/* 로딩 스피너 */
.loading-spinner {
  text-align: center;
  padding: 2rem;
  color: var(--status-color);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
  .transcription-panel {
    grid-template-columns: 1fr;
  }
  
  .header {
    padding: 0.75rem 1rem;
  }
  
  .panel {
    margin-bottom: 1rem;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .container {
    height: auto;
    min-height: 100vh;
  }
  
  .header {
    padding: 0.5rem 1rem;
  }
}

/* 연결 상태 표시 */
.connection-status {
  position: fixed;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
}

[data-theme="dark"] .connection-status {
  background-color: rgba(45, 45, 45, 0.9);
}

/* View 페이지: 좌측 상단 */
.connection-status--view {
  top: 0.7rem;
  left: 0.7rem;
}

/* Screen 페이지: 좌측 하단 */
.connection-status--screen {
  bottom: 1rem;
  left: 1rem;
}

/* 연결 상태 인디케이터 */
.connection-status__indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* 연결됨: 초록색 */
.connection-status--connected .connection-status__indicator {
  background-color: #10b981;
}

/* 끊김: 빨간색 */
.connection-status--disconnected .connection-status__indicator {
  background-color: #ef4444;
}

/* 재연결 중: 주황색/노란색 */
.connection-status--reconnecting .connection-status__indicator {
  background-color: #f59e0b;
}

/* 재연결 중 애니메이션 */
@keyframes pulse-reconnecting {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* 모바일 반응형 */
@media (max-width: 768px) {
  .connection-status--view {
    top: 0.5rem;
    left: 0.5rem;
  }
  
  .connection-status--screen {
    bottom: 0.5rem;
    left: 0.5rem;
  }
  
  .connection-status__indicator {
    width: 8px;
    height: 8px;
  }
}
