/**
 * Text Tools - コンポーネント詳細スタイル
 * 各コンポーネントの追加スタイルと装飾
 */

/* ========================================
   TextInputArea 詳細スタイル
   ======================================== */

.text-input-area__header {
  gap: 1rem;
}

.text-input-area__label {
  flex: 1;
}

.text-input-area__char-count {
  white-space: nowrap;
}

.text-input-area__drop-zone {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.text-input-area__file-label {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ========================================
   FileLoader 詳細スタイル
   ======================================== */

.file-loader__drop-zone {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-loader__icon {
  line-height: 1;
}

.file-loader__button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ========================================
   OptionsList 詳細スタイル
   ======================================== */

.options-list__item {
  padding: 0.5rem 0;
}

.options-list__label {
  gap: 0.5rem;
  min-height: 44px; /* タッチターゲット最小要件 */
  align-items: center;
}

.options-list__input-checkbox:focus,
.options-list__input-radio:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.options-list__input-select {
  padding: 0.4rem 0.6rem;
  min-height: 36px;
}

.options-list__input-select:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.options-list__input-text {
  padding: 0.4rem 0.6rem;
  min-height: 36px;
  width: auto;
  max-width: 200px;
}

.options-list__input-text:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.options-list__radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.options-list__radio-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #000;
  display: block;
  margin-bottom: 0.25rem;
}

.options-list__radio-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.options-list__radio-group--disabled {
  opacity: 0.5;
  pointer-events: none;
}

.options-list__radio-group--disabled .options-list__radio-label {
  color: #9ca3af;
}

.options-list__radio-group--disabled .options-list__input-radio {
  cursor: not-allowed;
  accent-color: #d1d5db;
}

/* ========================================
   モバイル対応（ラジオボタン・セレクト）
   ======================================== */

@media (max-width: 768px) {
  /* ラジオボタンオプションをスタック */
  .options-list__radio-options {
    flex-direction: column;
    gap: 0.75rem;
  }

  .options-list__radio-options .options-list__label {
    margin-bottom: 0;
  }

  /* セレクト・テキスト入力が含まれるラベルをスタック */
  .options-list__label:has(select),
  .options-list__label:has(input[type="text"]) {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
  }

  /* モバイルでセレクト・テキスト入力をフルウィズ */
  .options-list__input-select,
  .options-list__input-text {
    width: 100%;
    max-width: 100%;
  }

  /* テキスト入力のモバイル調整 */
  .options-list__input-text {
    max-width: none;
  }
}

/* ========================================
   OutputBox 詳細スタイル
   ======================================== */

.output-box__text {
  user-select: text;
  border-left: 4px solid #3b82f6;
}

.output-box__text:empty::before {
  content: "処理結果がここに表示されます";
  color: #9ca3af;
  font-style: italic;
}

.output-box__button {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ========================================
   ローディングスピナー
   ======================================== */

.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   フォーカス管理
   ======================================== */

*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ========================================
   ダークモード対応（将来用）
   ======================================== */

@media (prefers-color-scheme: dark) {
  .text-tools-container {
    color: #e5e7eb;
    background-color: #1f2937;
  }

  .text-input-area__label,
  .options-list__label,
  .output-box__label {
    color: #f3f4f6;
  }

  .text-input-area__textarea,
  .output-box__text {
    background-color: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
  }

  .text-input-area__drop-zone,
  .file-loader__drop-zone {
    background-color: #1e293b;
    border-color: #3b82f6;
  }

  .options-list {
    background-color: #374151;
    border-color: #4b5563;
  }

  .options-list__input-select {
    background-color: #4b5563;
    color: #f3f4f6;
    border-color: #6b7280;
    color-scheme: dark;
  }

  .options-list__input-select:focus {
    background-color: #4b5563;
    color: #f3f4f6;
    border-color: #3b82f6;
  }

  .options-list__input-text {
    background-color: #4b5563;
    color: #f3f4f6;
    border-color: #6b7280;
  }

  .options-list__input-text:focus {
    background-color: #4b5563;
    color: #f3f4f6;
    border-color: #3b82f6;
  }
}

/* ========================================
   プリント対応
   ======================================== */

@media print {
  .text-input-area__drop-zone,
  .file-loader__drop-zone,
  .options-list,
  .output-box__actions {
    display: none;
  }

  .output-box__text {
    max-height: none;
    border: 1px solid #999;
  }
}

/* ========================================
   高コントラスト対応
   ======================================== */

@media (forced-colors: active) {
  .text-input-area__drop-zone,
  .file-loader__drop-zone,
  .options-list {
    border: 2px solid;
  }

  .btn,
  .output-box__button {
    border: 1px solid;
  }
}
