/* 글로벌 테마 변수 */
:root {
  --bg-color: #0d0f17;
  --card-bg: rgba(22, 26, 43, 0.65);
  --card-border: rgba(255, 255, 255, 0.06);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #6366f1; /* Indigo */
  --accent-hover: #4f46e5;
  --success-color: #10b981; /* Emerald */
  --shadow-main: 0 10px 40px 0 rgba(0, 0, 0, 0.45);
  --font-title: 'Outfit', 'Noto Sans KR', sans-serif;
  --font-body: 'Noto Sans KR', sans-serif;
}

/* 기본 리셋 및 레이아웃 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* 백그라운드 그라데이션 장식 */
body::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  top: -150px;
  left: -150px;
  pointer-events: none;
  z-index: -1;
}

body::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
  bottom: -200px;
  right: -200px;
  pointer-events: none;
  z-index: -1;
}

.app-container {
  width: 100%;
  max-width: 1300px;
  min-height: 100vh;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* 헤더 */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  border-radius: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-icon {
  font-size: 1.8rem;
  animation: pulse 2.5s infinite ease-in-out;
}

.logo-text {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a5b4fc, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.header-tag {
  font-family: var(--font-title);
  font-size: 0.8rem;
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  padding: 0.4rem 1.2rem;
  border-radius: 20px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-weight: 600;
}

/* 메인 구조 */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

/* Glassmorphism 카드 공통 */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: var(--shadow-main);
}

/* 비디오 섹션 */
.player-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 종횡비 */
  height: 0;
  overflow: hidden;
  border-radius: 20px !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-color: #000;
}

.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-details {
  padding: 2.2rem;
}

.video-title {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.8rem;
  color: #ffffff;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.8rem;
}

.bullet {
  color: rgba(255, 255, 255, 0.15);
}

.video-description {
  font-size: 1rem;
  line-height: 1.7;
  color: #cbd5e1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.8rem;
  margin-bottom: 2rem;
  white-space: pre-line;
}

/* 버튼 액션 */
.action-bar {
  display: flex;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-body);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-color) 0%, #8b5cf6 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.5);
  background: linear-gradient(135deg, var(--accent-hover) 0%, #7c3aed 100%);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* 링크 복사 마이크로 애니메이션 상태 */
.btn-primary.copied {
  background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%) !important;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35) !important;
  animation: bounce 0.3s ease-in-out;
}



/* 모달 오버레이 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 6, 12, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* 모달 본체 */
.modal-content {
  width: 90%;
  max-width: 520px;
  border-radius: 20px;
  overflow: hidden;
  transform: scale(0.92) translateY(-20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 1rem;
}

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--font-title);
  color: #fff;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #fff;
}

/* 폼 그룹 */
#upload-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #cbd5e1;
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

/* 클릭 전용 업로드 박스 */
.upload-click-box {
  width: 100%;
  padding: 2.5rem 1.5rem;
  border: 2px dashed #8a2be2 !important;
  border-radius: 16px;
  background-color: rgba(138, 43, 226, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease-in-out;
}

.upload-click-box:hover,
.upload-click-box.dragover {
  background-color: rgba(138, 43, 226, 0.2) !important;
  border-color: #a855f7 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.35);
}

.upload-click-box p {
  margin: 0 0 8px 0;
  font-weight: 700;
  color: #c084fc;
  font-size: 1.1rem;
}

#file-info {
  font-size: 0.95rem;
  color: #94a3b8;
  display: inline-block;
  margin-top: 4px;
}

/* 프로그레스 바 */
.progress-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.progress-bar-wrapper {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color) 0%, #8b5cf6 100%);
  border-radius: 4px;
  transition: width 0.1s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: right;
}

/* 업로드 성공 결과 안내 */
.upload-result {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.success-alert {
  font-size: 0.9rem;
  color: #34d399;
  font-weight: 600;
  text-align: center;
}

.link-copy-box {
  display: flex;
  gap: 0.5rem;
}

.link-copy-box input {
  flex-grow: 1;
  padding: 0.6rem 0.8rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #a5b4fc;
  font-size: 0.85rem;
  outline: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.2rem;
  margin-top: 0.5rem;
}

/* 에러 404 페이지 전용 */
.error-body {
  justify-content: center;
  align-items: center;
  background-image: radial-gradient(circle at center, rgba(99, 102, 241, 0.12) 0%, transparent 60%);
}

.error-card {
  padding: 3.5rem 2.5rem;
  text-align: center;
  max-width: 480px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}

.error-title {
  font-family: var(--font-title);
  font-size: 6.5rem;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: -0.5rem;
}

.error-msg {
  color: var(--text-secondary);
  font-size: 1.15rem;
  line-height: 1.5;
}

/* 애니메이션 Keyframes */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.9;
  }
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@media (max-width: 1024px) {
  .app-container {
    padding: 1.2rem;
  }
  .header-tag {
    display: none; /* 모바일에서는 가독성을 위해 생략 */
  }
}

  @media (max-width: 640px) {
    .app-header {
      padding: 1rem 1.2rem;
      flex-direction: column;
      gap: 1rem;
      align-items: flex-start;
    }
    .header-actions {
      width: 100%;
      flex-wrap: wrap;
    }
    .header-actions button {
      width: 100%;
      justify-content: center;
    }
    .video-title {
      font-size: 1.45rem;
    }
    .video-details {
      padding: 1.5rem;
    }
    .btn {
      width: 100%;
      justify-content: center;
    }
  }

  /* Google 로그인 및 유저 프로필 CSS */
  .user-profile-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.35rem 0.8rem 0.35rem 0.4rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
  }

  .user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .user-name {
    color: var(--text-primary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-logout {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    transition: background 0.2s;
  }

  .btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
  }

  /* 비디오 포맷 배지 */
  .format-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }

  .format-badge.mkv {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
  }

  .format-badge.mp4 {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
  }

  /* 업로더 정보 섹션 */
  .uploader-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
  }

  .uploader-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
  }

  .uploader-details {
    display: flex;
    flex-direction: column;
  }

  .uploader-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #f1f5f9;
  }

  .uploader-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
  }

  /* 홈 화면 히어로 및 비디오 그리드 스타일 */
  .hero-upload-section {
    width: 100%;
    margin-bottom: 2rem;
  }

  .hero-upload-card {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .hero-title {
    font-family: var(--font-title);
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.25;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }

  .hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.6;
  }

  .gallery-section {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-top: 1rem;
  }

  .section-title {
    font-size: 1.4rem;
    font-family: var(--font-title);
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
  }

  .video-card {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
  }

  .video-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.4);
  }

  .card-thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
    overflow: hidden;
  }

  .card-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
  }

  .video-card:hover .card-thumbnail {
    transform: scale(1.05);
  }

  .card-format-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
  }

  .card-body {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex-grow: 1;
  }

  .card-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    color: #f8fafc;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  /* 푸터 스타일 */
  .app-footer {
    width: 100%;
    margin-top: 3rem;
    padding: 2.5rem 1rem 2rem 1rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
    justify-content: center;
  }

  .app-footer .en-sub {
    font-size: 0.82rem;
    color: #64748b;
    font-family: var(--font-title);
  }



