/* デザインシステムとCSS変数 */
:root {
  --font-primary: 'Outfit', 'Noto Sans JP', sans-serif;
  --bg-app: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-light: rgba(79, 70, 229, 0.1);
  --color-bg-card: rgba(255, 255, 255, 0.85);
  --color-text-main: #1f2937;
  --color-text-muted: #6b7280;
  --color-border: rgba(0, 0, 0, 0.06);
  --color-border-focus: rgba(79, 70, 229, 0.4);
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-success: #10b981;
  --color-secondary: #e5e7eb;
  --color-secondary-hover: #d1d5db;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 20px -2px rgba(0,0,0,0.05), 0 2px 8px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.05), 0 10px 10px -5px rgba(0,0,0,0.02);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

/* 全体のリセットとベース */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-app);
  color: var(--color-text-main);
  min-height: 100vh;
  line-height: 1.6;
}

/* アプリケーションコンテナ */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ヘッダー */
.app-header {
  text-align: center;
  margin-bottom: 40px;
}

.app-header .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.app-header .logo .icon {
  font-size: 2.2rem;
}

.app-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(45deg, var(--color-primary), #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-header .subtitle {
  color: var(--color-text-muted);
  font-size: 1rem;
  font-weight: 400;
}

/* メインレイアウト */
.app-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  flex: 1;
}

@media (min-width: 768px) {
  .app-main {
    grid-template-columns: 380px 1fr;
    align-items: start;
  }
}

/* カード共通 */
.glass-card {
  background: var(--color-bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  box-shadow: var(--shadow-lg);
}

/* フォームセクション */
.form-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--color-text-main);
  border-left: 4px solid var(--color-primary);
  padding-left: 10px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text-main);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  color: var(--color-text-main);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--color-border-focus);
}

.form-group textarea {
  height: 120px;
  resize: vertical;
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: var(--color-secondary);
  color: var(--color-text-main);
}

.btn-secondary:hover {
  background: var(--color-secondary-hover);
}

.btn-danger {
  background: var(--color-danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--color-danger-hover);
}

.btn-icon {
  width: auto;
  padding: 8px;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--color-secondary);
  color: var(--color-text-main);
  transform: rotate(45deg);
}

/* タイムライン */
.list-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-main);
}

/* タイムラインの投稿一覧 */
.posts-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 個々の投稿カード */
.post-card {
  background: var(--color-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeIn 0.4s ease-out both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(79, 70, 229, 0.2);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.post-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.post-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text-main);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-time {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.btn-delete {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-delete:hover {
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.1);
}

.post-content {
  font-size: 0.95rem;
  color: var(--color-text-main);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

/* ロード中 & 空状態 */
.loading-state,
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(79, 70, 229, 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

/* フッター */
.app-footer {
  text-align: center;
  margin-top: 60px;
  padding: 20px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* モーダル */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 24px;
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUp {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-card h3 {
  margin-bottom: 12px;
  font-size: 1.2rem;
  color: var(--color-text-main);
}

.modal-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.modal-card input {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
  font-family: inherit;
  font-size: 1rem;
}

.modal-card input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-border-focus);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-actions .btn {
  width: auto;
  min-width: 100px;
}

/* トースト通知 */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: #ffffff;
  color: var(--color-text-main);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--color-primary);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(120%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.active {
  transform: translateX(0);
}

.toast.toast-success {
  border-left-color: var(--color-success);
}

.toast.toast-error {
  border-left-color: var(--color-danger);
}
