/* ======================
   YURA Service CSS
   ====================== */

:root {
  --color-primary: #0a0a2e;
  --color-secondary: #2d1b69;
  --color-accent: #c9a84c;
  --color-bg: #f8f6f3;
  --color-bg-light: #ffffff;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-error: #d32f2f;
  --color-success: #388e3c;
  --font-family: "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", "Yu Gothic", sans-serif;
  --max-width: 600px;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --border-radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

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

/* ======================
   Layout
   ====================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing-md);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  padding: var(--spacing-md) 0;
  text-align: center;
}

.logo {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.logo-icon {
  font-size: 1.5rem;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--color-primary);
  letter-spacing: 0.1em;
}

.main {
  flex: 1;
  padding: var(--spacing-md) 0;
}

.footer {
  padding: var(--spacing-lg) 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.disclaimer {
  margin-bottom: var(--spacing-sm);
}

/* ======================
   Typography
   ====================== */

h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: var(--spacing-sm);
  color: var(--color-primary);
}

h2 {
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: var(--spacing-lg);
  color: var(--color-text-light);
  font-weight: normal;
}

.section-title {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-xs);
  border-bottom: 2px solid var(--color-accent);
  color: var(--color-primary);
}

/* ======================
   Form
   ====================== */

.form-card {
  background: var(--color-bg-light);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: bold;
  font-size: 0.9rem;
}

.label-hint {
  font-weight: normal;
  color: var(--color-text-light);
  font-size: 0.8rem;
}

.required {
  color: var(--color-error);
  margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.input-hint {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-top: var(--spacing-xs);
}

.char-count {
  text-align: right;
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-top: var(--spacing-xs);
}

.char-count.warning {
  color: var(--color-error);
}

.char-count.ok {
  color: var(--color-success);
}

/* ======================
   Select (Theme)
   ====================== */

.theme-select {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-sm);
}

@media (max-width: 480px) {
  .theme-select {
    grid-template-columns: 1fr;
  }
}

.theme-option {
  position: relative;
}

.theme-option input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.theme-option label {
  display: block;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid #ddd;
  border-radius: var(--border-radius);
  cursor: pointer;
  text-align: center;
  font-weight: normal;
  transition: all 0.2s;
}

.theme-option input:checked + label {
  border-color: var(--color-accent);
  background: rgba(201, 168, 76, 0.1);
  font-weight: bold;
}

.theme-option label:hover {
  border-color: var(--color-accent);
}

/* ======================
   Child Birthday Section
   ====================== */

.child-section {
  background: #fafafa;
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.child-section-hint {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-md);
}

.child-inputs {
  display: grid;
  gap: var(--spacing-md);
}

.child-input {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.child-input label {
  min-width: 80px;
  margin-bottom: 0;
  font-weight: normal;
}

.child-input input {
  flex: 1;
}

/* ======================
   Buttons
   ====================== */

.btn {
  display: block;
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  border: none;
  border-radius: var(--border-radius);
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--color-bg-light);
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

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

/* ======================
   Error / Success Messages
   ====================== */

.error-box {
  background: #ffebee;
  border: 1px solid var(--color-error);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  color: var(--color-error);
  font-size: 0.9rem;
}

.success-box {
  background: #e8f5e9;
  border: 1px solid var(--color-success);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  color: var(--color-success);
  font-size: 0.9rem;
}

/* ======================
   Payment Section
   ====================== */

.payment-section {
  background: var(--color-bg-light);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.payment-amount {
  text-align: center;
  font-size: 2rem;
  font-weight: bold;
  color: var(--color-primary);
  margin-bottom: var(--spacing-md);
}

.payment-amount span {
  font-size: 1rem;
  font-weight: normal;
}

#card-element {
  padding: var(--spacing-md);
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  background: white;
}

#card-errors {
  color: var(--color-error);
  font-size: 0.85rem;
  margin-top: var(--spacing-sm);
  min-height: 1.5em;
}

/* ======================
   Done Page
   ====================== */

.done-card {
  background: var(--color-bg-light);
  border-radius: var(--border-radius);
  padding: var(--spacing-xl);
  text-align: center;
}

.done-icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
}

.done-title {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-md);
}

.done-order-id {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-lg);
}

.done-message {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: var(--spacing-lg);
}

/* ======================
   Loading
   ====================== */

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  margin-right: var(--spacing-sm);
}

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

/* ======================
   Utilities
   ====================== */

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-sm {
  margin-top: var(--spacing-sm);
}

.mt-md {
  margin-top: var(--spacing-md);
}

.mt-lg {
  margin-top: var(--spacing-lg);
}

.mb-sm {
  margin-bottom: var(--spacing-sm);
}

.mb-md {
  margin-bottom: var(--spacing-md);
}

.mb-lg {
  margin-bottom: var(--spacing-lg);
}

/* ======================
   Mobile Optimizations
   ====================== */

/* タッチデバイス向け：タップ領域を大きく */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  /* フォーム要素を大きく（指でタップしやすく） */
  input[type="text"],
  input[type="email"],
  input[type="date"],
  select,
  textarea {
    padding: 0.875rem 1rem;
    font-size: 16px; /* iOS でズーム防止 */
  }

  /* ボタンを大きく */
  .btn {
    padding: 1rem 1.25rem;
    font-size: 1rem;
    min-height: 54px; /* タップしやすいサイズ */
  }

  /* テーマ選択を大きく */
  .theme-option label {
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
  }

  /* カード内のパディングを調整 */
  .form-card {
    padding: 1.25rem;
  }

  /* 子ども入力欄を縦並びに */
  .child-input {
    flex-direction: column;
    align-items: stretch;
  }

  .child-input label {
    min-width: auto;
    margin-bottom: 0.25rem;
  }

  /* 余白調整 */
  .container {
    padding: 0.75rem;
  }

  h1 {
    font-size: 1.35rem;
  }

  h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
  }
}

/* 小さいスマホ向け（iPhone SE など） */
@media (max-width: 375px) {
  html {
    font-size: 14px;
  }

  .form-card {
    padding: 1rem;
  }

  .theme-select {
    gap: 0.375rem;
  }

  .theme-option label {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }
}

/* 横向き対応 */
@media (max-width: 768px) and (orientation: landscape) {
  .container {
    max-width: 100%;
  }
}

/* Safe area 対応（iPhone X 以降のノッチ） */
@supports (padding: env(safe-area-inset-bottom)) {
  .footer {
    padding-bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom));
  }

  .btn-primary {
    margin-bottom: env(safe-area-inset-bottom);
  }
}

/* タッチデバイスでホバー効果を無効化 */
@media (hover: none) {
  .btn-primary:hover:not(:disabled) {
    transform: none;
    box-shadow: none;
  }

  .theme-option label:hover {
    border-color: #ddd;
  }

  .theme-option input:checked + label:hover {
    border-color: var(--color-accent);
  }
}

/* フォーカス時のアウトライン（アクセシビリティ） */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* スクロール時のスムーズ化 */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* 長押し時の選択を防止（UX向上） */
.btn {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
