﻿* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', 'Malgun Gothic', sans-serif;
  font-size: 11.2px;
  min-height: 100vh;
  position: relative;
  color: #333;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.5) 100%);
  z-index: -2;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  z-index: -3;
}

/* ==================== 로고 (상단 좌측 고정) ==================== */
.logo-fixed {
  position: fixed;
  width: 100%;  
  top: 0px;
  left: 0px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  padding: 6.4px 14.4px;
  border-radius: 0px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo-fixed img {
  width: 112px;
  height: auto;
  display: block;
}

/* ==================== 메인 컨테이너 ==================== */
.login-container {
  width: 100%;
  max-width: 384px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 데스크톱: 화면 높이가 충분할 때 중앙 정렬 */
@media (min-width: 769px) and (min-height: 700px) {
  body {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  
  .login-container {
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* 데스크톱: 화면 높이가 좁을 때 */
@media (min-width: 769px) and (max-height: 699px) {
  body {
    display: block;
    padding-top: 70px;
  }
  
  .login-container {
    padding: 8px 16px;
  }
  
  .login-header {
    margin-bottom: 12px;
  }
  
  .site-title {
    font-size: 1.2rem;
  }
  
  .login-card {
    padding: 16px 20px;
  }
  
  .login-title {
    font-size: 1.2rem;
    margin-bottom: 12px;
  }
  
  .input-group {
    margin-bottom: 12px;
  }
  
  .links-container {
    margin-top: 12px;
  }
  
  .restriction-info {
    margin-top: 12px;
    padding: 6px 12px;
  }
  
  .fixed-qrcode {
    display: none;
  }
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
  width: 100%;
}

.login-header .logo {
  display: none;
}

.site-title {
  font-size: 1.2rem;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  letter-spacing: 0.8px;
  margin-top: 0;
}

/* ==================== 로그인 카드 ==================== */
.login-card {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  min-width: 272px;
  max-width: 336px;
  box-shadow: 0 16px 28px rgba(0,0,0,0.2);
  backdrop-filter: blur(2px);
  transition: transform 0.3s ease;
}

.login-card:hover {
  transform: translateY(-4px);
}

.login-title {
  text-align: center;
  font-size: 1.44rem;
  font-weight: 600;
  color: #2c3e66;
  margin-bottom: 24px;
  padding-bottom: 6.4px;
  border-bottom: 2.4px solid #2c3e66;
  display: inline-block;
  width: auto;
}

/* ==================== 입력 그룹 ==================== */
.input-group {
  position: relative;
  margin-bottom: 20px;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 9.6px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 1;
}

.input-field, .input-select {
  width: 100%;
  padding: 11.2px 32px 11.2px 32px;
  border: 1px solid #ddd;
  border-radius: 9.6px;
  font-size: 0.8rem;
  transition: all 0.3s ease;
  background: #fff;
  outline: none;
}

.input-field:focus {
  border-color: #2c3e66;
  box-shadow: 0 0 0 2.4px rgba(44, 62, 102, 0.1);
}

.input-label {
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  padding: 0 4px;
  color: #999;
  transition: 0.2s ease-out;
  pointer-events: none;
  font-size: 0.8rem;
  z-index: 1;
}

.input-field:focus ~ .input-label,
.input-field:not(:placeholder-shown) ~ .input-label {
  top: 0;
  transform: translateY(-50%);
  font-size: 0.6rem;
  background: #fff;
  color: #2c3e66;
}

.input-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 9.6px center;
  background-size: 12.8px;
}

/* ==================== 버튼 ==================== */
.button-group {
  display: flex;
  gap: 9.6px;
  margin-top: 12px;
  width: 100%;
}

.login-btn, .cancel-btn {
  flex: 1;
  padding: 9.6px;
  border: none;
  border-radius: 9.6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.login-btn {
  background: linear-gradient(135deg, #2c3e66, #1a2a4f);
  color: white;
}

.login-btn:hover {
  transform: translateY(-1.6px);
  box-shadow: 0 4px 12px rgba(44, 62, 102, 0.3);
}

.cancel-btn {
  background: #f0f0f0;
  color: #666;
  border: 1px solid #ddd;
}

.cancel-btn:hover {
  background: #e0e0e0;
}

/* ==================== 링크 버튼 ==================== */
.links-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  width: 100%;
  max-width: 336px;
  box-sizing: border-box;
}

.link-btn {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  padding: 8px 0;
  border-radius: 5px;
  text-decoration: none;
  color: #2c3e66;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 0.68rem;
  text-align: center;
  width: calc(50% - 5px);
  flex-shrink: 0;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-btn i {
  margin-right: 4px;
}

.link-btn:hover {
  background: #2c3e66;
  color: white;
  transform: translateY(-1.6px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* 모든 화면에서 동일하게 2개씩 고정 */
@media (max-width: 768px) {
  .link-btn {
    width: calc(50% - 5px);
    font-size: 0.6rem;
    padding: 6px 0;
  }
}

@media (max-width: 450px) {
  .link-btn {
    width: calc(50% - 5px);
    font-size: 0.55rem;
    padding: 5px 0;
    white-space: normal;
    word-break: keep-all;
    line-height: 1.2;
  }
}

/* ==================== 차량 제한 정보 ==================== */
.restriction-info {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 9.6px 16px;
  margin-top: 24px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 336px; /* 로그인 카드와 동일한 최대 너비 */
  min-width: 272px; /* 로그인 카드와 동일한 최소 너비 */  
}

.info-row {
  display: flex;
  gap: 6.4px;
  align-items: baseline;
  font-size: 0.68rem;
  flex-wrap: wrap;
  justify-content: center;
}

.info-label {
  font-weight: 600;
  color: #2c3e66;
}

.info-day {
  font-weight: 500;
  min-width: 40px;
}

.info-number {
  background: #2c3e66;
  color: white;
  padding: 2.4px 8px;
  border-radius: 16px;
  font-size: 0.64rem;
}

/* ==================== 푸터 (하단 고정) ==================== */
.login-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  z-index: 1000;
  border-top: 1px solid rgba(255,255,255,0.3);
}

.footer-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.footer-link {
  background: transparent;
  color: #2c3e66;
  text-decoration: none;
  font-size: 0.6rem;
  transition: color 0.3s;
  font-weight: 500;
}

.footer-link:hover {
  color: #1a2a4f;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .footer-links {
    gap: 9.6px;
  }
  .footer-link {
    font-size: 0.48rem;
  }
}

/* ==================== QR 코드 ==================== */
@media (max-width: 768px) {
  .fixed-qrcode {
    display: none;
  }
}

.fixed-qrcode {
  position: fixed;
  bottom: 56px;
  right: 24px;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.2);
  padding: 8px;
  border: 1px solid #ccc;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
  width: 180px;
  border-radius: 4px;
}

.qrcode-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.qrcode-container {
  position: relative;
  width: 100%;
  height: 164px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.1);
}

.qrcode-container .background-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.qrcode-container .qr-img {
  width: 140px;
  height: 140px;
}

.qrcode-item .text-bottom {
  width: 100%;
  text-align: center;
  color: white;
  align-items: center;
  font-size: 11.2px;
  margin-bottom: 4px;
  padding: 4px 8px;
  order: -1;
  background-color: rgba(41, 22, 111, 0.2);
  border-radius: 4px;
}

/* ==================== 데스크톱 전용 ==================== */
@media (min-width: 769px) and (min-height: 700px) {
  .fixed-qrcode {
    display: block;
  }
}

@media (min-width: 769px) and (max-height: 699px) {
  .fixed-qrcode {
    display: none;
  }
  
  .restriction-info {
    margin-bottom: 48px;
  }
}

/* ==================== 태블릿 ==================== */
@media (min-width: 481px) and (max-width: 768px) {
  .login-container {
    max-width: 352px;
    padding-bottom: 48px;
  }
  .fixed-qrcode {
    display: none;
  }
  
  .desktop-only {
    display: none;
  }  
}

/* ==================== 모바일 (수정됨 - 여백 추가) ==================== */
@media (max-width: 480px) {
  /* 로고를 일반 블록으로 변경 */
  .logo-fixed {
    position: relative;
    width: 100%;
    top: auto;
    left: auto;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    padding: 8px 12px;
    margin-bottom: 5px;
    box-sizing: border-box;
  }
  
  .logo-fixed img {
    width: 100px;
  }
  
  body {
    display: block;
    padding-top: 0;
  }
  
  /* 로고 아래에 충분한 여백을 주기 위해 padding-top 추가 */
  .login-container {
    max-width: 100%;
    padding: 0 12px 48px 12px;
    margin-top: 0;
  }
  
  /* 헤더 영역에 상단 여백 추가 */
  .login-header {
    margin-bottom: 16px;
    margin-top: 20px;
    padding-top: 10px;
  }
  
  .site-title {
    font-size: 1rem;
    display: block;
    clear: both;
    position: relative;
    z-index: 1;
    margin-top: 0;
  }
  
  .login-card {
    padding: 20px 16px;
    min-width: auto;
    width: 100%;
  }
  
  .login-title {
    font-size: 1.2rem;
    margin-bottom: 16px;
  }
  
  .input-field, .input-select {
    padding: 9.6px 28px 9.6px 28px;
    font-size: 0.72rem;
  }
  
  .input-icon {
    font-size: 0.68rem;
    left: 8px;
  }
  
  .input-label {
    left: 28px;
    font-size: 0.72rem;
  }
  
  .login-btn, .cancel-btn {
    padding: 8px;
    font-size: 0.72rem;
  }
  
  .link-btn {
    padding: 6.4px 11.2px;
    font-size: 0.6rem;
  }
  
  .restriction-info {
    gap: 12px;
    padding: 8px 12px;
  }
  
  .info-row {
    gap: 4.8px;
    font-size: 0.6rem;
  }
  
  .info-day {
    min-width: 32px;
  }
  
  .info-number {
    padding: 1.6px 6.4px;
    font-size: 0.56rem;
  }
  
  .fixed-qrcode {
    display: none;
  }

  .desktop-only {
    display: none;
  }  
}

/* ==================== 애니메이션 ==================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-card, .links-container, .restriction-info {
  animation: fadeInUp 0.6s ease-out;
}

/* ==================== 버전 체크 모달 ==================== */
.version-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.version-modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 320px;
  box-shadow: 0 16px 28px rgba(0,0,0,0.3);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.version-modal-header {
  background: linear-gradient(135deg, #2c3e66, #1a2a4f);
  color: white;
  padding: 16px;
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-modal-header i {
  font-size: 19.2px;
}

.version-modal-header h3 {
  margin: 0;
  font-size: 0.96rem;
}

.version-modal-body {
  padding: 16px;
  text-align: center;
}

.version-modal-body p {
  margin: 8px 0;
  line-height: 1.5;
}

.version-modal-buttons {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

.btn-clear-cache, .btn-close-modal {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.72rem;
  transition: all 0.3s ease;
}

.btn-clear-cache {
  background: #2c3e66;
  color: white;
}

.btn-clear-cache:hover {
  background: #1a2a4f;
  transform: translateY(-1.6px);
}

.btn-close-modal {
  background: #f0f0f0;
  color: #666;
}

.btn-close-modal:hover {
  background: #e0e0e0;
}