/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */



/* CSS Variables */
:root {
  --primary-yellow: #FDFF00;
  --header-gradient-start: #0D0521;
  --header-gradient-end: #104F5F;
  --tab-width: 240px;
  --tab-height: 37px;
  --header-font: 'Balboa', Arial, sans-serif;
  --header-height: 144px;
}

/* タブレット用CSS変数 */
@media (max-width: 768px) and (min-width: 481px) {
  :root {
    --tab-width: 180px;
    --tab-height: 35px;
    --header-height: 130px;
  }
}

/* モバイル用CSS変数 */
@media (max-width: 480px) {
  :root {
    --tab-width: 100px;
    --tab-height: 32px;
    --header-height: 120px;
  }
}

/* 超小型モバイル用CSS変数 */
@media (max-width: 360px) {
  :root {
    --tab-width: 90px;
    --tab-height: 30px;
    --header-height: 115px;
  }
}

/* Global overflow prevention */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

* {
  box-sizing: border-box;
}

/* Component-specific styles */

/* Header Navigation Styles */
.header-nav {
  background: linear-gradient(170deg, var(--header-gradient-start) 0%, var(--header-gradient-end) 100%);
  height: var(--header-height);
}

.nav-tab {
  width: var(--tab-width);
  height: var(--tab-height);
  font-family: var(--header-font);
  font-weight: 300;
  font-size: 14px;
  line-height: 1em;
  transition: color 0.3s ease;
}

.nav-tab:hover {
  color: var(--primary-yellow) !important;
}

.nav-tab.active {
  color: var(--primary-yellow) !important;
}

.nav-tab-underline {
  background-color: var(--primary-yellow);
  width: var(--tab-width);
  height: 2px;
}

.hamburger-gap {
  gap: 4px;
}

/* ドロップダウンメニューのホバー効果 */
.dropdown-menu-item {
  transition: all 0.2s ease;
}

.dropdown-menu-item:hover {
  background-color: #f3f4f6 !important;
  color: #374151 !important;
}

/* Logout button hover effect */
.logout-button:hover {
  background-color: #fef2f2 !important;
  color: #dc2626 !important;
}

/* タブレット・モバイル対応 */

/* タブレット対応 (769px〜1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  /* タブナビゲーション調整 */
  .nav-tab {
    font-size: 13px;
    padding: 0.5rem 1.5rem;
  }
}

/* タブレット対応 (480px〜768px) */
@media (min-width: 481px) and (max-width: 768px) {
  /* タブナビゲーション調整 */
  .nav-tab {
    font-size: 12px;
    padding: 0.5rem 1rem;
  }
  
  /* ドロップダウンメニュー */
  [data-menu-target="dropdown"] {
    position: absolute !important;
    right: 0 !important;
    top: 100% !important;
    margin-top: 0.5rem !important;
    z-index: 9999 !important;
    width: 12rem !important;
    max-width: calc(100vw - 2rem) !important;
  }
  
  /* ナビゲーションバー全体のz-indexを確保 */
  nav {
    z-index: 50 !important;
  }
  
  /* ドロップダウンの親要素の相対位置指定を確保 */
  nav .relative {
    position: relative !important;
  }
}

/* スレッド一覧のレスポンシブ対応 */

/* PC対応 (1024px以上) */
@media (min-width: 1024px) {
  
  .communities-container {
    /* max-width: 800px; */
  }
  
  .thread-button-wrapper {
    /* width: 718px !important; */
  }
}

/* タブレット対応 (768px〜1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .community-thread-card {
    width: 500px !important;
  }
  
  .communities-container {
    max-width: 600px;
  }
  
  .thread-button-wrapper {
    width: 500px !important;
  }
}

/* モバイル対応 (480px以下) */
@media (max-width: 480px) {
  /* タブナビゲーションをさらに小さく */
  .nav-tab {
    font-size: 10px;
    padding: 0.25rem 0.25rem;
  }
  
  /* ドロップダウンメニュー */
  [data-menu-target="dropdown"] {
    position: absolute !important;
    right: 0 !important;
    top: 100% !important;
    margin-top: 0.5rem !important;
    z-index: 9999 !important;
    width: 10rem !important;
    max-width: calc(100vw - 2rem) !important;
  }
  
  /* ナビゲーションバー全体のz-indexを確保 */
  nav {
    z-index: 50 !important;
  }
  
  /* ドロップダウンの親要素の相対位置指定を確保 */
  nav .relative {
    position: relative !important;
  }

  /* スレッドカードとボタンラッパーをモバイル最適化 */
  .community-thread-card {
    width: calc(100vw - 2rem) !important;
    max-width: 358px !important;
  }
  
  .thread-button-wrapper {
    width: calc(100vw - 2rem) !important;
    max-width: 358px !important;
  }
}

/* PC版でボタンを10px左に移動（index、my_threadsのみ） */
@media (min-width: 768px) {
  .communities.index .thread-button-wrapper > div,
  .communities.my_threads .thread-button-wrapper > div {
    padding-right: 10px;
  }
}

/* いいねカウンターのスタイル */
.like-counter {
  width: 19px;
  height: 16px;
  font-family: 'Balboa';
  font-style: normal;
  font-weight: 600;
  font-size: 14px;
  line-height: 16px;
  display: flex;
  align-items: flex-start;
  color: #808080;
  flex: none;
  order: 1;
  flex-grow: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'tnum' 1; /* タブラー数字で等幅に */
  text-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.1);
  justify-content: center; /* 水平中央揃え */
  text-align: center;
}

/* ホバー効果（オプション） */
.like-counter:hover {
  color: #666666;
  transform: perspective(100px) rotateX(0deg) scale(1.05);
  transition: all 0.2s ease;
}

/* いいねボタンコンテナの調整 */
.flex.items-center.gap-1 {
  align-items: flex-start; /* ハートと数字を上端で揃える */
}

/* ハートSVGのサイズ調整 */
.flex.items-center.gap-1 svg {
  height: 16px;
  width: 18px;
}

/* Turboプレビュー中はハンバーガーメニューとドロップダウンを強制的に隠す */
html[data-turbo-preview] #hamburgerPanel,
html[data-turbo-preview] #dropdownPanel {
  display: none !important;
  transform: translateX(-100%) !important;
}

html[data-turbo-preview] body {
  overflow: auto !important;
  position: static !important;
  width: 100% !important;
}
