/* ==============================================
   クーポン機能用スタイルシート
   ============================================== */

/* アニメーション定義 */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* クーポン割引表示 */
.coupon-discount {
  color: #dc3545;
  font-size: 13px;
  margin-top: 40px;
  font-weight: bold;
  white-space: nowrap;
  text-align: right;
  padding-right: 60px;
}

.coupon-discount span {
  font-weight: normal;
  vertical-align: middle;
}

/* 割引後合計表示 */
.discount-total-wrapper {
  margin-top: 5px;
}

/* フラッシュメッセージ */
.coupon-flash-wrapper {
  margin: 15px 0;
  border-bottom: none !important;
}

.coupon-flash-wrapper .notice,
.coupon-flash-wrapper .alert {
  padding: 10px;
  margin-bottom: 10px;
  font-size: 80%;
  border-radius: 4px;
  animation: fadeIn 0.3s ease-out;
}

.coupon-flash-wrapper .notice {
  color: #000000;
  border: 1px solid #000000;
  background-color: #f8f9fa;
}

.coupon-flash-wrapper .alert {
  color: #c82333;
  border: 1px solid #c82333;
  background-color: #f8d7da;
}

/* クーポンセクション */
.coupon-section-wrapper {
  margin-bottom: 0px !important;
}

.coupon-section-wrapper .right {
  width: auto;
  min-width: 400px;
  border-bottom: none !important;
}

/* クーポン適用済み表示 */
.applied-coupon {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid #e9ecef;
}

.applied-coupon-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.applied-coupon-info {
  flex: 1;
}

.applied-coupon-code {
  font-weight: bold;
  color: #000000;
  font-size: 13px;
}

.applied-coupon-discount {
  margin-top: 4px;
  color: #dc3545;
  font-size: 12px;
}

.applied-coupon-discount strong {
  font-weight: bold;
}

.applied-coupon-expiry {
  margin-top: 2px;
  color: #666;
  font-size: 10px;
}

.applied-coupon-remove {
  margin-left: 10px;
}

.applied-coupon-remove button {
  padding: 4px 8px;
  background: #000000;
  color: white;
  border: none;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 2px;
}

.applied-coupon-remove button:hover {
  background-color: #c82333;
}

/* クーポン入力セクション */
.coupon-input-section {
  padding: 0;
  text-align: left;
  width: fit-content;
  margin: 0 auto;
}

/* エラーメッセージ */
#coupon-error-message {
  display: none;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  font-size: 12px;
  animation: slideDown 0.3s ease-out;
}

/* 入力フォームグループ */
.coupon-input-group {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* クーポンコード入力欄 */
#coupon_code_input {
  padding: 8px 12px;
  border: 1px solid #ccd4da;
  width: 200px;
  font-size: 13px;
  transition: border-color 0.2s;
  border-radius: 2px;
}

#coupon_code_input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

#coupon_code_input.error {
  border-color: #dc3545;
  background-color: #fff5f5;
}

/* クーポン適用ボタン */
#coupon-submit-btn {
  padding: 8px 16px;
  font-size: 13px;
  min-width: 60px;
  border: none;
  cursor: pointer;
  background: #000000;
  color: white;
  transition: all 0.2s;
  border-radius: 2px;
}

#coupon-submit-btn:hover:not(:disabled) {
  background-color: #333333;
}

#coupon-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 注意書き */
.coupon-note {
  margin: 10px 0 0 0;
  color: #888;
  font-size: 10px;
}

/* レスポンシブ対応（スマートフォン） */
@media screen and (max-width: 767px) {
  /* クーポン割引表示 */
  .coupon-discount {
    font-size: 12px;
    margin-top: 20px;
    padding-right: 10px;
  }

  /* クーポンセクション */
  .coupon-section-wrapper .right {
    min-width: 100%;
    width: 100%;
    padding: 0 10px;
  }

  /* クーポン適用済み表示 */
  .applied-coupon {
    padding: 10px;
  }

  .applied-coupon-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .applied-coupon-remove {
    margin-left: 0;
    margin-top: 10px;
    width: 100%;
  }

  .applied-coupon-remove button {
    width: 100%;
    padding: 8px;
  }

  /* クーポン入力セクション */
  .coupon-input-section {
    width: 100%;
  }

  .coupon-input-group {
    flex-direction: column;
    width: 100%;
  }

  #coupon_code_input {
    width: 100%;
    font-size: 16px; /* iOSのズーム防止 */
  }

  #coupon-submit-btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
  }

  /* フラッシュメッセージ */
  .coupon-flash-wrapper {
    margin: 10px 0;
  }

  .coupon-flash-wrapper .notice,
  .coupon-flash-wrapper .alert {
    font-size: 12px;
  }
}

/* タブレット対応 */
@media screen and (min-width: 768px) and (max-width: 1024px) {
  .coupon-section-wrapper .right {
    min-width: 350px;
  }

  #coupon_code_input {
    width: 180px;
  }
}

/* アクセシビリティ向上 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ダークモード対応（オプション） */
@media (prefers-color-scheme: dark) {
  .applied-coupon {
    background: #2d3748;
    border-color: #4a5568;
  }

  .applied-coupon-code {
    color: #f7fafc;
  }

  #coupon_code_input {
    background: #2d3748;
    color: #f7fafc;
    border-color: #4a5568;
  }

  #coupon-error-message {
    background: #742a2a;
    color: #feb2b2;
    border-color: #fc8181;
  }
}
/* 非表示フィールドの保護 */
input[type="hidden"] {
  display: none !important;
  visibility: hidden !important;
}
