/* ===== 汎用文字数カウントツール - スタイルシート ===== */

/* 全体コンテナ */
#char-counter-app {
  font-family: 'Segoe UI', 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
  background: #f9fafb;
  padding: 2rem;
  max-width: 1200px;
  margin: 2rem auto;
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  line-height: 1.6;
}

/* ヘッダー */
.cc-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #e5e7eb;
}

.cc-header h2 {
  font-size: 1.75rem;
  color: #1f2937;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.cc-header p {
  font-size: 1rem;
  color: #6b7280;
  margin: 0;
}

/* メインテキスト入力エリア */
.cc-main-input {
  margin-bottom: 2rem;
}

.cc-main-input label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #374151;
}

#main-textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 2px solid #d1d5db;
  font-size: 1rem;
  resize: vertical;
  background: #ffffff;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  line-height: 1.6;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

#main-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* セクション */
.cc-section {
  background: #ffffff;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cc-section h3 {
  font-size: 1.25rem;
  color: #1f2937;
  margin-bottom: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cc-section h4 {
  font-size: 1.1rem;
  color: #374151;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

/* カウントグリッド */
.count-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.count-item {
  background: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.count-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  background: #ffffff;
  border-color: #3b82f6;
}

.count-item::after {
  content: 'クリックでコピー';
  position: absolute;
  top: 0.25rem;
  right: 0.5rem;
  font-size: 0.65rem;
  color: #9ca3af;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.count-item:hover::after {
  opacity: 1;
}

.count-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #3b82f6;
  display: block;
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.count-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

/* 検索ボックス */
.search-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-box input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  font-size: 1rem;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.search-box input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-box label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #374151;
}

.search-result {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
  padding: 0.75rem;
  background: #f3f4f6;
  border-radius: 0.5rem;
}

.search-result span {
  color: #3b82f6;
  font-size: 1.5rem;
}

/* 除外設定 */
.exclude-settings {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.exclude-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.exclude-row label {
  min-width: 100px;
  font-weight: 600;
  color: #374151;
}

.exclude-row input[type="text"] {
  flex: 1;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.exclude-row input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.exclude-range {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exclude-range span {
  color: #6b7280;
}

.excluded-result {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 0.5rem;
}

.excluded-result h4 {
  margin-top: 0;
  color: #92400e;
}

/* SNS設定（オプション） */
.cc-optional {
  background: #f3f4f6;
  border: 1px dashed #d1d5db;
}

.cc-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.cc-controls label {
  flex: 1;
  min-width: 200px;
  font-weight: 600;
  color: #374151;
}

.cc-controls select {
  width: 100%;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  background: #ffffff;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.sns-limit-display {
  padding: 0.5rem 1rem;
  background: #dbeafe;
  border-radius: 0.5rem;
  color: #1e40af;
  font-weight: 600;
}

.sns-limit-display span {
  font-size: 1.25rem;
  color: #3b82f6;
}

/* 使い方・説明 */
.cc-help {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
}

.cc-help details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1.1rem;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background 0.2s ease;
}

.cc-help details summary:hover {
  background: #e5e7eb;
}

.help-content {
  margin-top: 1rem;
  padding: 1rem;
  background: #ffffff;
  border-radius: 0.5rem;
}

.help-content ol,
.help-content ul {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.help-content li {
  margin-bottom: 0.5rem;
}

.help-content dl {
  margin: 1rem 0;
}

.help-content dt {
  font-weight: 600;
  color: #1f2937;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
}

.help-content dd {
  margin-left: 1rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

/* SVGアイコン */
.svg-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
}

/* トースト通知 */
.cc-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: #10b981;
  color: #ffffff;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 1rem;
  font-weight: 600;
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  #char-counter-app {
    padding: 1rem;
    margin: 1rem auto;
  }

  .cc-header h2 {
    font-size: 1.5rem;
  }

  .count-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
  }

  .count-value {
    font-size: 1.5rem;
  }

  .exclude-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .exclude-row label {
    min-width: auto;
  }

  .cc-controls {
    flex-direction: column;
  }

  .cc-controls label {
    width: 100%;
  }
}

/* チェックボックスのスタイリング */
input[type="checkbox"] {
  accent-color: #3b82f6;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* セレクトボックスのスタイリング */
select {
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* スクロールバーのスタイリング */
#main-textarea::-webkit-scrollbar {
  width: 8px;
}

#main-textarea::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

#main-textarea::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

#main-textarea::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
