/**
 * top.php専用スタイル
 * パフォーマンス最適化のためインラインCSSから外部化
 */

/* 動画遅延読み込み */
video.lazy-video {
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  min-height: 200px;
}
video.lazy-video-loaded {
  background: transparent;
  min-height: auto;
}

/* スマホ版ヘッダー動画 */
.video-header-fullscreen {
  width: 100%;
  background: #000;
  position: relative;
}
.video-header-fullscreen .video-header-player {
  width: 100%;
  display: block;
}
.video-header-fullscreen .video-header-poster {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  transition: opacity 0.5s ease;
}
.video-header-fullscreen .video-header-poster.hidden {
  opacity: 0;
  pointer-events: none;
}
/* ヘッダー動画のサムネイルがない場合 */
.video-header-fullscreen:not(.has-poster) .video-header-player {
  opacity: 1;
}
/* ヘッダー動画のサムネイルがある場合 */
.video-header-fullscreen.has-poster .video-header-player {
  opacity: 0;
  transition: opacity 0.5s ease;
}
.video-header-fullscreen.has-poster .video-header-player.video-ready {
  opacity: 1;
}

/* 動画コンテナ（サムネイル付き） */
.video-container {
  position: relative;
}
.video-container .video-poster {
  width: 100%;
  display: block;
  border-radius: 8px;
  transition: opacity 0.5s ease;
}
.video-container .video-poster.hidden {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
}
/* サムネイルがある場合：動画を裏に配置 */
.video-container.has-poster video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.video-container.has-poster video.video-ready {
  position: relative;
  opacity: 1;
}
/* サムネイルがない場合：動画を通常表示 */
.video-container video {
  width: 100%;
  display: block;
  border-radius: 8px;
}
/* スマホ版：ヘッダー動画がある場合、上部の余白を削除 */
@media (max-width: 767px) {
  body:has(.video-header-fullscreen) .nav-wrap,
  body:has(.video-header-fullscreen) .navbar,
  body:has(.video-header-fullscreen) header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
  }
  body:has(.video-header-fullscreen) .main {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }
  body:has(.video-header-fullscreen) .video-header-fullscreen {
    margin-top: 0 !important;
  }
}

/* 動画コンテンツセクション */
.video-content-section {
  margin-bottom: 20px;
}
.video-content-section video {
  width: 100%;
  border-radius: 8px;
  display: block;
}

/* スライダー用ローディングアニメーションのスタイル */
.loading-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  display: none; /* 最初は非表示 */
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.loading {
  border: 5px solid rgba(0, 181, 205, 0.3);
  border-radius: 50%;
  border-top: 5px solid #00b5cd;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 写メ日記グリッドレイアウト */
.photo-grid-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.photo-grid-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: #f0f0f0;
}

.photo-grid-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.photo-grid-link {
  display: block;
  position: relative;
  text-decoration: none;
}

.photo-grid-image {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  background: #f0f0f0;
  overflow: hidden;
}

.photo-grid-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.photo-grid-item:hover .photo-grid-image img {
  transform: scale(1.05);
}

.photo-grid-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  padding: 30px 10px 10px;
  color: #fff;
}

.photo-grid-name {
  display: block;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-grid-time {
  display: block;
  font-size: 10px;
  opacity: 0.8;
  margin-top: 2px;
}

.photo-grid-locked {
  position: relative;
}

.photo-grid-lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.photo-grid-lock-overlay i {
  font-size: 24px;
  margin-bottom: 5px;
}

.photo-grid-lock-overlay span {
  font-size: 12px;
}

.no-photo-message {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

/* スマホ版 写メグリッド */
@media (max-width: 767px) {
  .photo-grid-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .photo-grid-info {
    padding: 20px 8px 8px;
  }

  .photo-grid-name {
    font-size: 11px;
  }

  .photo-grid-time {
    font-size: 9px;
  }
}

/* PC版バナースライダー */
.swiper-pc-banner {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding-top: 30px;
  overflow: hidden;
}
.swiper-pc-banner .swiper-slide img {
  width: 100%;
  height: auto;
  display: block;
}
.swiper-pc-banner .swiper-slide a {
  display: block;
}

/* スマホ版バナースライダー */
.swiper-sp-banner {
  width: 100%;
  overflow: hidden;
}
.swiper-sp-banner .swiper-slide {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.swiper-sp-banner .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 新着ニュース リスト形式 */
.news_box {
  background: #fff;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
}
.news-date-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.news-date-list li {
  border-bottom: 1px dotted #aaa;
  padding: 8px 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.news-date-list li:last-child {
  border-bottom: none;
}
.news-date-list li .news-date {
  background: var(--primary-color, #ec4899);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-right: 8px;
}
.news-date-list li a {
  color: #333;
  text-decoration: none;
}
.news-date-list li a:hover {
  color: var(--primary-color, #ec4899);
}

/* LOGIN NOW ドットスタイル */
.login-time-text {
  text-align: center;
  margin-bottom: 6px;
}
.login-time-text-sp {
  text-align: center;
  padding: 8px 0;
  background: #f8f9fa;
  border-radius: 6px;
}
.login-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.login-dot-blue { background-color: #2196F3; }   /* 〜30分 */
.login-dot-green { background-color: #4CAF50; }  /* 30分〜1時間 */
.login-dot-orange { background-color: #FF9800; } /* 1〜2時間 */
.login-dot-gray { background-color: #9E9E9E; }   /* 2〜4時間 */
.login-time-label {
  font-size: 11px;
  color: #666;
  vertical-align: middle;
}
