/* ============================================
   ネイティブアプリ風モバイルデザイン
   HIP HUB - Native Mobile Experience
   ============================================ */

/* iOS/Android システムフォント優先 */
:root {
  --font-system: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 
                 'Helvetica Neue', 'Segoe UI', 'Roboto', 'Noto Sans JP', sans-serif;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  
  /* ネイティブカラー */
  --native-separator: rgba(255, 255, 255, 0.08);
  --native-bg-elevated: rgba(28, 28, 30, 0.95);
  --native-tap-highlight: rgba(255, 255, 255, 0.1);
}

/* ========================================
   モバイル専用スタイル（768px以下）
   ======================================== */
@media (max-width: 768px) {
  /* ========== ベースリセット ========== */
  html, body {
    font-family: var(--font-system) !important;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  /* ========== フルワイドコンテナ ========== */
  .container {
    padding: 0 12px !important;
    max-width: 100% !important;
    overflow-x: hidden;
  }

  .main-content {
    padding: 16px 0 !important;
    padding-top: calc(64px + var(--safe-area-top)) !important;
    padding-bottom: calc(70px + var(--safe-area-bottom)) !important;
    overflow-x: hidden;
  }

  /* ========== ブラー付き透過ヘッダー（固定） ========== */
  .header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.88) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--native-separator);
    padding-top: var(--safe-area-top);
    z-index: 1000;
  }

  .header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    padding: 0 12px !important;
  }

  .header-logo img {
    height: 28px;
  }

  /* ========== ページタイトルバナー ========== */
  .page-title-banner {
    background: rgba(10, 10, 10, 0.88);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    padding: 10px 12px;
    border-bottom: 0.5px solid var(--native-separator);
    /* 固定ヘッダーの下に表示されるよう余白を追加 */
    margin-top: calc(56px + var(--safe-area-top));
  }

  .page-title-banner h1 {
    font-size: 17px !important;
    font-weight: 600;
    margin: 0;
  }

  .page-title-banner h1 i {
    font-size: 15px;
    margin-right: 8px;
  }
  
  /* ページタイトルバナーがある場合、main-contentのpadding-topを減らす */
  .page-title-banner + .main-content {
    padding-top: 16px !important;
  }

  /* ========== ボトムナビ（iOS TabBar風） ========== */
  .footer-nav {
    background: rgba(10, 10, 10, 0.94) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--native-separator);
    padding-bottom: var(--safe-area-bottom);
    height: auto !important;
    min-height: 49px;
  }

  .footer-nav-list {
    height: 49px !important;
    display: flex !important;
    justify-content: space-around;
    align-items: center;
    padding: 0 !important;
    margin: 0;
  }

  .footer-nav-item {
    flex: 1;
    display: flex;
    justify-content: center;
  }

  .footer-nav-link {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0 !important;
    min-width: 60px;
    min-height: 44px;
    color: rgba(255, 255, 255, 0.45);
    transition: color 0.15s ease;
    text-decoration: none;
  }

  .footer-nav-link.active {
    color: var(--hphb-primary) !important;
  }

  .footer-nav-link i {
    font-size: 22px !important;
  }

  .footer-nav-text {
    font-size: 10px !important;
    font-weight: 500;
  }

  /* ========== ネイティブ風カード ========== */
  .card {
    border-radius: 12px;
    margin-bottom: 12px;
    border: none;
    background: var(--bg-secondary);
  }

  .card-body {
    padding: 16px !important;
  }

  /* フルワイドカード */
  .card-fullwidth {
    border-radius: 0;
    margin-left: -12px;
    margin-right: -12px;
    border-bottom: 0.5px solid var(--native-separator);
  }

  /* ========== セクションタイトル ========== */
  .section-title {
    font-size: 20px !important;
    font-weight: 700;
    margin-bottom: 12px;
  }

  .album-slider-controls {
    padding: 0;
    margin-bottom: 12px;
  }

  .album-slider-controls h2 {
    font-size: 20px !important;
  }

  /* ========== スライダーボタン非表示（スワイプのみ） ========== */
  .album-slider-button {
    display: none !important;
  }

  /* ========== 横スクロールスライダー最適化 ========== */
  .album-slider {
    margin: 0 -12px;
    width: calc(100% + 24px);
    overflow: hidden;
  }

  .album-slider-container {
    padding-left: 12px;
    scroll-padding-left: 12px;
    gap: 10px;
  }

  .album-slider-item {
    min-width: 140px;
  }

  .album-slider-item:last-child {
    margin-right: 12px;
  }

  /* ========== メディアカード ========== */
  .media-card {
    border-radius: 10px;
    overflow: hidden;
  }

  .media-card-body {
    padding: 10px 0 0 0;
  }

  .media-card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
  }

  .media-card-subtitle {
    font-size: 12px;
    opacity: 0.7;
  }

  /* ========== iOS風ボタン ========== */
  .btn {
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    min-height: 50px;
    transition: transform 0.1s ease, opacity 0.1s ease;
  }

  .btn:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  .btn-primary {
    background: var(--hphb-primary);
  }

  .btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    border: none;
  }

  .btn-sm {
    min-height: 36px;
    font-size: 14px;
    padding: 8px 16px;
  }

  .btn-icon {
    min-height: 44px;
    min-width: 44px;
    border-radius: 50%;
  }

  /* ========== iOS風入力フィールド ========== */
  .input-field,
  .search-input,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important; /* iOS zoom防止 */
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    padding: 12px 16px;
    min-height: 44px;
    color: var(--text-primary);
  }

  .input-field:focus,
  input:focus,
  textarea:focus,
  select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
  }

  /* ========== 検索バー ========== */
  .search-bar {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    border: none;
    height: 36px;
  }

  .search-bar .search-input {
    padding: 8px 12px;
    min-height: 36px;
    background: transparent !important;
  }

  /* ========== アバター ========== */
  .avatar {
    border: 2px solid rgba(255, 255, 255, 0.1);
  }

  .avatar-sm {
    width: 32px;
    height: 32px;
  }

  .avatar-md {
    width: 44px;
    height: 44px;
  }

  /* ========== タップフィードバック ========== */
  .tap-feedback {
    transition: background-color 0.1s ease;
  }

  .tap-feedback:active {
    background-color: var(--native-tap-highlight);
  }

  /* リスト項目のタップ */
  .conversation-item:active,
  .notification-item:active,
  .native-list-item:active {
    background-color: var(--native-tap-highlight) !important;
  }

  /* ========== モーダル（iOS ActionSheet風） ========== */
  .modal-content {
    border-radius: 14px 14px 0 0 !important;
    background: var(--native-bg-elevated) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    max-height: 90vh;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 0 16px !important;
    padding-bottom: calc(16px + var(--safe-area-bottom)) !important;
    animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }

  @keyframes slideUp {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  /* モーダルハンドル */
  .modal-content::before {
    content: '';
    display: block;
    width: 36px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin: 8px auto 16px;
  }

  .modal-backdrop {
    background: rgba(0, 0, 0, 0.5) !important;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }

  /* ========== ユーザーメニューモーダル ========== */
  .user-menu-modal-content {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-width: 100% !important;
    border-radius: 14px 14px 0 0 !important;
    padding: 0 !important;
    padding-bottom: var(--safe-area-bottom) !important;
  }

  .user-menu-modal-content .card {
    border-radius: 14px 14px 0 0 !important;
    margin: 0 !important;
  }

  .user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 10px;
    transition: background-color 0.15s ease;
    font-weight: 500;
    text-align: left;
  }

  .user-menu-item:active {
    background-color: rgba(255, 255, 255, 0.1);
  }

  .user-menu-item i {
    font-size: 18px;
    width: 24px;
    text-align: center;
  }

  /* ========== スムーズスクロール ========== */
  * {
    -webkit-overflow-scrolling: touch;
  }

  /* スクロールバー非表示（ネイティブ感） */
  ::-webkit-scrollbar {
    display: none;
  }

  /* ========== Hero セクション最適化 ========== */
  .hero-video-section {
    margin: -16px -12px 16px -12px !important;
    border-radius: 0 !important;
    width: calc(100% + 24px) !important;
    max-width: calc(100vw) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .hero-content {
    padding: 20px;
  }

  .hero-title {
    font-size: 24px !important;
  }

  .hero-logo {
    max-width: 120px;
  }

  /* ========== デイリーチャレンジ（スライダー形式） ========== */
  .daily-challenge-split {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    margin: 0 -12px;
    padding: 0 12px 12px;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .daily-challenge-split::-webkit-scrollbar {
    display: none;
  }

  .daily-challenge-left,
  .daily-challenge-right {
    flex: 0 0 85%;
    scroll-snap-align: center;
    min-width: 0;
    border-radius: 12px;
  }

  .daily-challenge-left .card-body,
  .daily-challenge-right .card-body {
    padding: 16px;
  }

  .daily-challenge-left h2,
  .daily-challenge-right h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
  }

  /* ========== コンテンツグリッド ========== */
  .content-grid {
    gap: 12px;
  }

  /* ========== タブ（スライダー形式） ========== */
  .slider-tab-card {
    min-height: auto;
    padding: 10px 16px;
  }

  .slider-tab-card h3 {
    font-size: 13px !important;
  }

  /* ========== フッター非表示（アプリでは不要） ========== */
  footer.footer {
    display: none !important;
  }

  /* ========== 安全領域を考慮したパディング ========== */
  .safe-area-top {
    padding-top: var(--safe-area-top);
  }

  .safe-area-bottom {
    padding-bottom: var(--safe-area-bottom);
  }

  /* ========== ローディングスピナー ========== */
  .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--hphb-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  /* ========== プルダウンリフレッシュインジケーター ========== */
  .refresh-indicator {
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 14px;
  }

  /* ========== 空状態 ========== */
  .empty-state {
    padding: 48px 24px;
    text-align: center;
  }

  .empty-state i {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 16px;
  }

  .empty-state p {
    color: var(--text-secondary);
    font-size: 15px;
  }

  /* ========== ステータスバッジ ========== */
  .badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
  }

  .badge-live {
    background: #ff3b30;
    color: white;
  }

  .badge-new {
    background: var(--hphb-primary);
    color: white;
  }
}

/* ========================================
   小さいモバイル（375px以下）
   ======================================== */
@media (max-width: 375px) {
  .container {
    padding: 0 8px !important;
  }

  .album-slider {
    margin: 0 -8px;
    width: calc(100% + 16px);
    overflow: hidden;
  }

  .album-slider-container {
    padding-left: 8px;
  }

  .section-title {
    font-size: 18px !important;
  }

  .media-card-title {
    font-size: 13px;
  }

  .album-slider-item {
    min-width: 120px;
  }

  /* ========== プロフィールタブ スライダー（統一サイズ） ========== */
  #slider-profile-tabs .album-slider-container {
    gap: 12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  #slider-profile-tabs .album-slider-item {
    flex: 0 0 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
  }

  #slider-profile-tabs .slider-tab-card {
    width: 100%;
    height: 50px;
  }

  #slider-profile-tabs .slider-tab-card .card-title {
    font-size: 13px !important;
    padding: 8px 12px !important;
    white-space: nowrap;
  }

  /* ========== プロフィールページ コンテンツグリッド ========== */
  .profile-content-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* タブコンテンツ内のカード調整 */
  #tracks-tab .card,
  #playlists-tab .playlist-card,
  #albums-tab .card,
  #mvs-tab .card,
  #reels-tab .card {
    margin: 0 !important;
  }

  /* カード内のパディング調整 */
  #tracks-tab .card-body > div:last-child,
  #albums-tab .card-body > div:last-child,
  #mvs-tab .card-body > div:last-child {
    padding: 8px !important;
  }

  /* タイトルのフォントサイズ調整 */
  #tracks-tab .card-body div[style*="font-weight"],
  #albums-tab .card-body div[style*="font-weight"],
  #mvs-tab .card-body div[style*="font-weight"] {
    font-size: 13px !important;
  }

  /* ========== プロフィールページ - SP時大きな四角画像 ========== */
  .profile-hero-avatar {
    width: 100% !important;
    max-width: 280px !important;
    height: auto !important;
    aspect-ratio: 1 !important;
    border-radius: 12px !important;
    margin-top: -100px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
  }

  .profile-hero-avatar img {
    border-radius: 12px !important;
  }

  .profile-hero-avatar .avatar-verified-badge {
    width: 32px !important;
    height: 32px !important;
    bottom: 8px !important;
    right: 8px !important;
  }

  .profile-hero-avatar .avatar-verified-badge i {
    font-size: 16px !important;
  }

  /* ========== アーティスト詳細ページ - SP時大きな四角画像 ========== */
  .artist-hero-avatar {
    width: 100% !important;
    max-width: 280px !important;
    height: auto !important;
    aspect-ratio: 1 !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5) !important;
  }

  .artist-hero-avatar img {
    border-radius: 12px !important;
  }
}

/* ========================================
   ダークモード最適化（システム連動）
   ======================================== */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* ========================================
   横向き対応
   ======================================== */
@media (max-width: 768px) and (orientation: landscape) {
  .footer-nav {
    height: 44px !important;
    min-height: 44px;
  }

  .footer-nav-list {
    height: 44px !important;
  }

  .main-content {
    padding-bottom: calc(50px + var(--safe-area-bottom)) !important;
  }
}

/* ========================================
   フローティングアクションボタン（FAB）
   ======================================== */
.fab-create-btn {
  display: none;
}

@media (max-width: 767px) {
  /* デスクトップ用ボタンを非表示 */
  .shop-create-btn-desktop,
  .event-create-btn-desktop,
  .create-btn-desktop {
    display: none !important;
  }
  
  /* イベントヘッダーボタン調整 */
  .event-header-buttons {
    gap: 8px !important;
  }
  .event-header-buttons .btn {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
  .event-header-buttons .btn span,
  .event-header-buttons .btn:not(.event-create-btn-desktop) {
    /* アイコンのみ表示 */
  }
  
  /* FABを表示 */
  .shop-fab-mobile,
  .event-fab-mobile,
  .fab-mobile {
    display: flex !important;
    position: fixed;
    bottom: calc(80px + var(--safe-area-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--hphb-primary) 0%, var(--hphb-secondary) 100%);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 16px rgba(79, 172, 254, 0.4);
    z-index: 999;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  
  .shop-fab-mobile:active,
  .event-fab-mobile:active,
  .fab-mobile:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.3);
  }
}

/* ========================================
   PWAスタンドアロンモード
   ======================================== */
@media (display-mode: standalone) {
  .header {
    padding-top: var(--safe-area-top) !important;
  }
}

