/* ==================================================
   04-login.css (로그인 화면 전용 스타일)
   ================================================= */

/* 1. 로그인 화면 메인 컨테이너 */
#login-screen {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* 2. 배경 애니메이션 효과 */
#login-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(120, 119, 198, 0.2) 0%, transparent 50%);
  animation: float 6s ease-in-out infinite;
}

/* 3. 메인 로그인 컨테이너 */
.login-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 48px;
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  max-width: 480px;
  width: 90%;
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 4. 게임 타이틀 섹션 */
.game-title {
  text-align: center;
  margin-bottom: 40px;
}

.game-title h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: -0.02em;
}

.game-title p {
  font-size: 1.125rem;
  color: #64748b;
  margin-bottom: 24px;
  font-weight: 500;
}

/* 5. 기능 배지 섹션 */
.feature-badges {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* 6. 로그인 폼 */
.login-form {
  max-width: 100%;
  margin: 0;
}

.input-group {
  position: relative;
  margin-bottom: 24px;
}

.input-group .input-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 18px;
  z-index: 2;
}

/* 7. 플레이어 이름 입력 필드 */
#player-name {
  width: 100%;
  padding: 20px 20px 20px 60px;
  font-size: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  font-weight: 500;
  color: #1e293b;
}

#player-name:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  background: white;
  transform: translateY(-2px);
}

#player-name::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

/* 8. 읽기 전용 상태 */
#player-name.readonly,
input.readonly {
  background-color: #f0f0f0;
  cursor: default;
  color: #555;
}

#player-name.readonly:focus,
input.readonly:focus {
  transform: none;
  background-color: #f0f0f0;
  color: #555;
  cursor: default;
}

/* 9. 게임 참여 버튼 */
#join-game-btn {
  width: 100%;
  padding: 20px;
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}

#join-game-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

#join-game-btn:active {
  transform: translateY(-1px);
}

#join-game-btn:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 10. 버튼 글로우 효과 */
#join-game-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

#join-game-btn:hover::before {
  left: 100%;
}

/* 11. 연결 상태 표시 */
.connection-status {
  text-align: center;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(248, 250, 252, 0.8);
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.5);
  backdrop-filter: blur(5px);
}

.connection-status #connection-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse-status 2s infinite;
}

#connection-text {
  font-size: 14px;
  color: #475569;
  font-weight: 500;
}

/* 12. 연결 상태별 색상 */
.connection-status.connected #connection-indicator {
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.connection-status.connecting #connection-indicator {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

.connection-status.disconnected #connection-indicator {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

/* 13. 사이트 정보 섹션 */
.site-info {
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-radius: 16px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  position: relative;
  overflow: hidden;
}

.site-info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.site-info small {
  display: block;
  color: #475569;
  font-weight: 500;
  line-height: 1.6;
}

.site-info small:first-child {
  font-size: 15px;
  margin-bottom: 8px;
  color: #1e293b;
}

.site-info small:last-child {
  font-size: 13px;
  color: #64748b;
}

#current-site {
  font-weight: 700;
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
}

/* 14. 장식 요소들 */
.decorative-elements {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.decorative-elements::before,
.decorative-elements::after {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.decorative-elements::before {
  top: -100px;
  right: -100px;
  animation: float-reverse 8s ease-in-out infinite;
}

.decorative-elements::after {
  bottom: -100px;
  left: -100px;
  animation: float 10s ease-in-out infinite;
}

/* 15. 타이핑 애니메이션 */
.typing-animation {
  display: inline-block;
  margin-left: 4px;
  animation: blink 1s infinite;
}

/* 16. 로그인 관련 애니메이션 키프레임 */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes float-reverse {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(20px) rotate(180deg); }
}

@keyframes pulse-status {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* 17. 모바일 반응형 (로그인 화면) */
@media (max-width: 768px) {
  .login-container {
    padding: 32px 24px;
    margin: 16px;
  }

  .game-title h1 {
    font-size: 2rem;
  }

  .feature-badges {
    flex-direction: column;
    align-items: center;
  }

  .badge {
    width: 100%;
    text-align: center;
    padding: 16px 20px;
  }

  #player-name {
    padding: 18px 18px 18px 55px;
  }

  #join-game-btn {
    padding: 18px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .login-container {
    padding: 24px 20px;
  }

  .game-title h1 {
    font-size: 1.75rem;
  }

  .game-title p {
    font-size: 1rem;
  }
}

/* 18. 다크모드 지원 (로그인 화면) */
@media (prefers-color-scheme: dark) {
  .login-container {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .game-title p {
    color: #94a3b8;
  }

  #player-name {
    background: rgba(30, 41, 59, 0.9);
    border-color: #334155;
    color: #f1f5f9;
  }

  #player-name::placeholder {
    color: #64748b;
  }

  .connection-status {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(51, 65, 85, 0.5);
  }

  #connection-text {
    color: #94a3b8;
  }

  .site-info {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-color: rgba(51, 65, 85, 0.8);
  }

  .site-info small {
    color: #94a3b8;
  }

  .site-info small:first-child {
    color: #f1f5f9;
  }
}

/* 19. 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
  #login-screen::before,
  .decorative-elements::before,
  .decorative-elements::after,
  .typing-animation {
    animation: none;
  }

  #join-game-btn,
  .badge,
  #player-name {
    transition: none;
  }
}

/* 20. 포커스 상태 개선 */
#join-game-btn:focus,
#player-name:focus {
  outline: 2px solid #4299e1;
  outline-offset: 2px;
}

.badge:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}
