body { 
  padding-bottom: 40px; 
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@media (min-width: 992px) {
  .navbar-nav {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .navbar-nav .nav-item {
    flex: 0 0 auto;
  }

  .navbar-nav .nav-link {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    white-space: nowrap;
  }
}

.landing-hero {
  padding-top: clamp(1.6rem, 3vw, 2.4rem) !important;
}

.landing-logo-wrapper {
  max-width: 280px;
  margin: 0 auto 1.5rem;
}

.landing-logo {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.landing-hero-panel {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0 0 2rem;
  padding: 1.4rem 1.6rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(13, 110, 253, 0.16);
  background: linear-gradient(135deg, rgba(13, 110, 253, 0.08) 0%, rgba(255, 255, 255, 0.95) 45%, rgba(32, 201, 151, 0.08) 100%);
  backdrop-filter: blur(2px);
  text-align: left;
}

.landing-hero-panel-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  font-weight: 600;
  color: #0d6efd;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.landing-hero-panel-title {
  font-size: clamp(1.15rem, 2.2vw, 1.65rem);
  font-weight: 600;
  color: #0d6efd;
  margin-bottom: 0.6rem;
}

.landing-hero-panel-text {
  font-size: clamp(0.9rem, 1.7vw, 1.05rem);
  line-height: 1.6;
  color: #495057;
  margin-bottom: 0.65rem;
}

.landing-hero-panel-text:last-child {
  margin-bottom: 0;
}

.landing-recommendations-section {
  margin-top: 3rem;
}

.landing-recommendations-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.landing-recommend-image-trigger {
  display: block;
  width: 72px;
  min-width: 72px;
  height: 72px;
  border: none;
  padding: 0;
  border-radius: 0.75rem;
  overflow: hidden;
  background-color: #f8f9fa;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.landing-recommend-image-trigger:hover {
  transform: translateY(-1px);
}

.landing-recommend-image-trigger:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.35);
  outline-offset: 2px;
}

.landing-recommend-card-main {
  width: 100%;
}

.landing-recommend-card {
  border: 1px solid rgba(13, 110, 253, 0.12);
  border-radius: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.landing-recommend-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 30px rgba(13, 110, 253, 0.12);
}

.landing-recommend-thumb {
  width: 72px;
  min-width: 72px;
  height: 72px;
  border-radius: 0.75rem;
  object-fit: cover;
  background: #f8f9fa;
}

.landing-recommend-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  min-width: 72px;
  height: 72px;
  border-radius: 0.75rem;
  background: #f1f3f5;
  color: #adb5bd;
  font-size: 1.5rem;
}

.landing-recommend-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  margin-top: 0.6rem;
}

.landing-recommend-meta .badge {
  font-size: 0.75rem;
}

.landing-recommend-price {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.landing-recommend-price-label {
  color: #212529;
  font-weight: 500;
  font-size: 0.85rem;
}

.landing-recommend-price-value {
  color: #0d6efd;
  font-weight: 600;
  font-size: 1.18rem;
}

@media (min-width: 576px) {
  .landing-logo-wrapper {
    max-width: 320px;
  }
}

@media (min-width: 768px) {
  .landing-logo-wrapper {
    margin-left: auto;
    margin-right: auto;
    max-width: 360px;
  }

  .landing-hero-panel {
    margin-left: 0;
    margin-right: 0;
    padding: 1.6rem 2rem 1.7rem;
  }

  .landing-recommend-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(13, 110, 253, 0.16);
  }
}

@media (min-width: 992px) {
  .landing-logo-wrapper {
    max-width: 420px;
  }
}

@media (max-width: 575.98px) {
  .landing-recommendations-header {
    align-items: flex-start;
  }

  .landing-recommend-card-main {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .landing-recommend-image-trigger {
    width: 100%;
    min-width: 0;
    height: auto;
  }

  .landing-recommend-card-main .flex-grow-1 {
    width: 100%;
    min-width: 0;
  }

  .landing-recommend-thumb,
  .landing-recommend-thumb-placeholder {
    width: 100%;
    min-width: 0;
  }

  .landing-recommend-thumb {
    height: auto;
    max-height: 220px;
    display: block;
  }

  .landing-recommend-thumb-placeholder {
    height: auto;
    min-height: 140px;
    padding: 2.5rem 0;
    font-size: 1.75rem;
  }

  .landing-recommend-meta {
    justify-content: flex-start;
  }

  .landing-recommend-card:hover {
    transform: none;
    box-shadow: 0 12px 24px rgba(13, 110, 253, 0.12);
  }
}

.alert { 
  margin-top: 1rem; 
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.profile-alert-placeholder:empty {
  display: none;
}

.profile-alert-placeholder .alert {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.alert-profile-required {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: nowrap;
}

.alert.alert-profile-required {
  padding: 0.85rem 1rem;
}

.alert-profile-required .alert-profile-icon {
  flex: 0 0 auto;
  font-size: 1.5rem;
  line-height: 1;
  color: #856404;
}

.alert-profile-required .alert-profile-body {
  flex: 1 1 220px;
  min-width: 0;
}

.alert-profile-required .alert-profile-title {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.alert-profile-required .alert-profile-body p {
  margin-bottom: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

@media (max-width: 576px) {
  .alert-profile-required {
    gap: 0.5rem;
    align-items: flex-start;
  }

  .alert-profile-required .alert-profile-icon {
    font-size: 1.2rem;
    margin-top: 0.2rem;
  }

  .alert-profile-required .alert-profile-title {
    font-size: 1rem;
  }

  .alert-profile-required .alert-profile-body p {
    font-size: 0.9rem;
  }

  .alert.alert-profile-required {
    padding: 0.75rem 0.9rem;
  }
}

.w-md-auto {
  width: 100%;
}

/* モバイル対応 */
@media (max-width: 768px) {
  /* テキストの折り返しとレスポンシブ対応 */
  .container {
    padding-left: 15px;
    padding-right: 15px;
  }
  
  /* 長いテキストの強制折り返し */
  h1, h2, h3, h4, h5, h6, p, td, th, .card-title, .card-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
  }
  
  /* テーブルのレスポンシブ対応 */
  .table-responsive {
    font-size: 0.85rem;
  }
  
  .table td, .table th {
    padding: 0.5rem 0.25rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 120px;
  }
  
  /* ボタングループのレスポンシブ対応 */
  .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
  }
  
  .btn-sm {
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
    min-width: auto;
  }
  
  /* ナビゲーションの調整 */
  .navbar-brand {
    font-size: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* カードコンテンツの調整 */
  .card-body {
    padding: 1rem 0.75rem;
  }
  
  .card-title {
    font-size: 1.1rem;
    line-height: 1.3;
  }
  
  .card-text {
    font-size: 0.9rem;
    line-height: 1.4;
  }
  
  /* フォームの調整 */
  .form-control, .form-select {
    font-size: 16px; /* iOS Safariでのズーム防止 */
  }
  
  /* モーダルの調整 */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  /* フッターの調整 */
  .footer .row {
    text-align: center;
  }
  
  .footer .col-lg-6 {
    margin-bottom: 1rem;
  }
  
  /* 検索フォームの調整 */
  .row.g-3 > .col-md-8,
  .row.g-3 > .col-md-4 {
    margin-bottom: 0.75rem;
  }
  
  /* ページネーションの調整 */
  .pagination .page-link {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  /* 小さなモバイル画面での追加調整 */
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }
  
  .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }
  
  .btn-sm {
    font-size: 0.7rem;
    padding: 0.2rem 0.3rem;
  }
  
  /* テーブルセルをさらに小さく */
  .table td, .table th {
    padding: 0.25rem 0.125rem;
    font-size: 0.75rem;
    max-width: 80px;
  }
  
  /* モーダルをフルスクリーンに近づける */
  .modal-dialog {
    margin: 0.25rem;
    max-width: calc(100% - 0.5rem);
  }
  
  /* 長いURL やメールアドレスの折り返し */
  .text-break {
    word-break: break-all !important;
    overflow-wrap: break-word !important;
  }
}

/* 商品一覧（会員側） */
.product-card {
  border: 1px solid #e9ecef;
}

.product-card-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.product-card-header--no-image {
  gap: 0.5rem;
}

.product-card-header--no-image .product-card-main {
  width: 100%;
}

.product-card-image {
  width: 96px;
  min-width: 96px;
  height: 96px;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-image--placeholder i {
  font-size: 1.75rem;
}

.product-card-main {
  flex: 1 1 auto;
}

.product-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: #495057;
}

.product-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.product-card-footer .product-price {
  font-size: 1.2rem;
  margin-bottom: 0;
}

.product-detail-btn {
  min-width: 120px;
}

@media (min-width: 768px) {
  .w-md-auto {
    width: auto;
  }

  .product-card-footer {
    gap: 1rem;
  }
}

@media (max-width: 575.98px) {
  .product-card-header {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .product-card-image {
    width: 88px;
    min-width: 88px;
    height: 88px;
  }

  .product-card-meta {
    flex-direction: column;
    gap: 0.4rem;
  }

}

/* メッセージ機能のスタイル */
.messages-area {
  background: #f8f9fa;
}

.message {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.message.own {
  align-items: flex-end;
}

.message.other {
  align-items: flex-start;
}

.message-content {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin-bottom: 0.25rem;
}

.message .message-content a {
  color: #0d6efd;
  text-decoration: underline;
  word-break: break-all;
}

.message.own .message-content a {
  color: #fff;
}

.message.own .message-content {
  background: #007bff;
  color: white;
  border-bottom-right-radius: 0.5rem;
}

.message.other .message-content {
  background: white;
  color: #333;
  border: 1px solid #e9ecef;
  border-bottom-left-radius: 0.5rem;
}

.message-info {
  font-size: 0.75rem;
  color: #6c757d;
  padding: 0 0.5rem;
  max-width: 70%;
}

.message.own .message-info {
  text-align: right;
}

.message.other .message-info {
  text-align: left;
}

/* ユーザーリスト */
.user-item {
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative;
}

.user-item:hover {
  background: #f8f9fa;
}

.user-item.active {
  background: #e3f2fd;
  border-left: 4px solid #007bff;
}

.user-name {
  font-weight: 600;
  color: #333;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
}

.user-email {
  color: #6c757d;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.last-message-time {
  color: #6c757d;
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.unread-indicator {
  width: 8px;
  height: 8px;
  background: #dc3545;
  border-radius: 50%;
  margin-left: 0.5rem;
  display: inline-block;
}

/* タイピングインジケーター */
.typing-dots {
  display: inline-flex;
  align-items: center;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #6c757d;
  margin: 0 1px;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* No messages state */
.no-messages {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #6c757d;
  text-align: center;
}

/* Loading states */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
}

/* 購入希望確認モーダルのタイトル調整 */
#wishlistConfirmationTitle {
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.4;
  hyphens: auto;
}

/* Responsive adjustments for messages */
@media (max-width: 768px) {
  .message-content {
    max-width: 85%;
    font-size: 0.85rem;
    padding: 0.6rem 0.8rem;
  }
  
  .user-item {
    padding: 0.75rem;
  }
  
  .messages-area {
    height: 300px !important;
  }
}
