/*  レスポンシブ対応出来てなかったです 2025-10-24
    全部が1ファイルで書かれていて分かりにくいです
    まずはファイルを分割してください    */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #191e2b;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: #253045;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

h1 {
    color: #bfc0d1;
    margin-bottom: 20px;
    text-align: center;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* 改善されたボタンスタイル */
button {
    background: #3a5470;  /* より濃いベース色 */
    color: #ffffff;       /* 純白でコントラスト向上 */
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    margin: 5px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
    background: #4a6280;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* プライマリーボタン（重要なアクション） */
.primary-btn, button[type="submit"] {
    background: linear-gradient(135deg, #00c6e6, #0099cc);
    color: #ffffff;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 198, 230, 0.3);
}

.primary-btn:hover, button[type="submit"]:hover {
    background: linear-gradient(135deg, #00b4d4, #0088bb);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 198, 230, 0.4);
}

/* セカンダリーボタン */
.secondary-btn {
    background: transparent;
    color: #00c6e6;
    border: 2px solid #00c6e6;
}

.secondary-btn:hover {
    background: rgba(0, 198, 230, 0.1);
    color: #00c6e6;
}

/* 危険なアクション（削除など） */
.danger-btn {
    background: #ff4757;
    color: #ffffff;
}

.danger-btn:hover {
    background: #ff3742;
}

button.liked {
    background: linear-gradient(135deg, #00c6e6, #0099cc);
    color: #ffffff;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 198, 230, 0.4);
}

/* フォーム */
input, textarea, select {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #bfc0d1;
    border-radius: 5px;
    font-size: 14px;
    background: #191e2b;
    color: #bfc0d1;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #00c6e6;
    box-shadow: 0 0 0 2px rgba(0, 198, 230, 0.2);
}

textarea {
    height: 100px;
    resize: vertical;
}

/* トピックリスト */
.topic-item {
    border: 1px solid #bfc0d166;
    padding: 15px;
    margin: 10px 0;
    border-radius: 5px;
    background: #191e2b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.topic-item:hover {
    background: rgba(0, 198, 230, 0.1);
    border-color: #00c6e6;
}

.topic-title {
    font-weight: bold;
    color: #bfc0d1;
    margin-bottom: 5px;
}

.topic-meta {
    font-size: 12px;
    color: #bfc0d1;
    opacity: 0.7;
}

#category-filter, #sort-selector {
    width: auto;
    display: inline-block;
    margin-left: 10px;
    cursor: pointer;
}

#category-filter:hover, #sort-selector:hover {
    border-color: #00c6e6;
    box-shadow: 0 0 0 2px rgba(0, 198, 230, 0.2);
    animation: pulse 1s infinite;
}

/* 検索 */
.search-box {
    margin: 20px 0;
}

/* 投稿リスト */
.post-item {
    border-left: 3px solid #00c6e6;
    padding:15px 10px 5px 10px ;
    margin: 10px 0;
    background: rgba(0, 198, 230, 0.05);
    border-radius: 5px;
    color: #bfc0d1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.post-content {
    margin-bottom: 8px;
}

.post-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.post-meta {
    font-size: 12px;
    color: #bfc0d1;
    opacity: 0.7;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.post-item button {
    font-size: 12px;
    padding: 6px 12px;
}

#posts {
    padding-top: 10px;
    border-top: 1px solid #bfc0d144;
}

.like-count {
    font-size: 12px;
    color: #bfc0d1;
    opacity: 0.8;
}

.nav-buttons {
    text-align: center;
    margin: 20px 0;
}

.error {
    color: #ff6b6b;
    font-size: 12px;
    margin: 5px 0;
}

.success {
    color: #00c6e6;
    font-size: 12px;
    margin: 5px 0;
}

/* 追加のスタイル */
h2, h3 {
    color: #bfc0d1;
}

label {
    color: #bfc0d1;
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

p {
    color: #bfc0d1;
}

option {
    background: #253045;
    color: #bfc0d1;
}

/* 詳細ページヘッダー */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.detail-header h2 {
    margin: 0;
    flex: 1;
}

.detail-header button {
    margin-left: 20px;
    flex-shrink: 0;
}

/* detail-contentのレイアウト */
#detail-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 20px;
}

#detail-content p {
    flex: 1;
    margin: 0;
}

#detail-content .topic-meta {
    flex-shrink: 0;
    white-space: nowrap;
}

.detail_content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* フィルター */
.filter-container {
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.filter-container label {
    font-size: 14px;
    color: #bfc0d1;
    white-space: nowrap;
    margin: 0;
}

.filter-container select {
    padding: 8px;
    border: 1px solid #bfc0d1;
    border-radius: 5px;
    font-size: 14px;
    background: #191e2b;
    color: #bfc0d1;
    flex: 1;
    min-width: 120px;
}

.delete-btn {
    font-size: 12px; 
    padding: 2px 6px;
    margin-left: 8px;
    background-color: #f0f0f0; /* 優しい薄いグレー */
    color: #555;             /* 濃すぎない文字色 */
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-btn:hover {
    background-color: #ccccccbd; /* ホバーでちょっと濃く */

}

/* フローティング投稿ボタン */
.floating-post-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #00c6e6, #0099cc);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 198, 230, 0.4);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.floating-post-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 198, 230, 0.6);
}

/* 投稿フォームモーダル */
.post-form-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.post-form-container.hidden {
    display: none;
}

.post-form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(25, 30, 43, 0.8);
    backdrop-filter: blur(4px);
}

.post-form-modal {
    background: #253045;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.post-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.post-form-header h3 {
    margin: 0;
    color: #00c6e6;
}

.close-btn {
    background: transparent;
    color: #bfc0d1;
    border: none;
    font-size: 20px;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(191, 192, 209, 0.1);
}

.post-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

.post-form-actions {
    display: flex;
    gap: 12px;
}

.cancel-btn {
    background: transparent;
    color: #bfc0d1;
    border: 1px solid #bfc0d1;
    padding: 8px 16px;
}

.submit-btn {
    background: linear-gradient(135deg, #00c6e6, #0099cc);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
}

#warning-message {
    color: #ff6b6b;
    font-size: 12px;
    margin-top: 10px;
    height: 16px;
}

/* アニメーション */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 投稿削除 */
.delete-btn {
    background: #ff4757 !important;
    color: #ffffff !important;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
}

.delete-btn:hover {
    background: #ff3742 !important;
}

/* ===== Responsive ===== */

/* 375px以下（小さい端末向け調整） */
@media (min-width: 375px) {
  html { font-size: 15px; }

  h1 { font-size: 30px; line-height: 1.3; }
  h2 { font-size: 18px; line-height: 1.35; }
  h3 { font-size: 16px; line-height: 1.4; }

  .topic-title,
  .post-content,
  label,
  p { font-size: 14px; line-height: 1.6; }

  .topic-meta,
  .post-meta,
  .like-count { font-size: 12px; }

  .container { padding: 12px; }
  button { font-size: 14px; padding: 10px 16px; min-height: 44px; }

  /* 投稿画面 */
  .post-content p { 
    font-size: 12px;
    }
  .post-item button { 
    font-size: 12px;
    min-height: 20px;
    }
   textarea { 
    min-height: 110px; 
    }
  .post-actions { 
    gap: 6px; 
    }
  .post-bottom { 
    flex-direction: column;
    align-items: stretch; 
    gap: 2px; 
    }
  .post-meta { 
    white-space: nowrap; 
    font-size: 11px; 
    }

  /* 以下のレイアウトは縦積み */
  .detail-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  #detail-content { flex-direction: column; align-items: stretch; gap: 12px; }
  #detail-content p { font-size: 0.8rem; margin-top: 3%; }

  /* 絞り込み機能 */
  .filter-container {
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    }
  .filter-container label { 
    font-size: 0.85rem;
    }
  .filter-container select {
    font-size: 0.75rem; 
    }
  .floating-post-btn {
    bottom: 20px; right: 20px;
    padding: 12px 18px; font-size: 14px;
  }

  #create h2 {
    margin-bottom: 3%;
  }

  #category {
    margin: 2% 0 3% 0
  }
}

/* 600px以上（タブレット/PC向け） */
@media (min-width: 600px) {
  .container { padding: 24px; }

  /* 横並びに戻す */
  .detail-header { flex-direction: row; align-items: center; gap: 10px; }
  #detail-content { flex-direction: row; align-items: flex-start; gap: 20px; }

  .filter-container { flex-direction: row; align-items: center; gap: 20px; }
}