/* Tool Individual Styles */

.tool-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: start;
}

.tool-main-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tool-side-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.input-area {
  width: 100%;
  background-color: rgba(156, 163, 175, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

textarea.input-area {
  min-height: 220px;
  resize: vertical;
}

.input-area:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--glow);
}

.input-row {
  display: flex;
  gap: 1rem;
}

.input-row .form-group {
  flex: 1;
}

/* Controls / Options */
.options-card {
  background: rgba(156, 163, 175, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
}

.options-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.option-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.option-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
}

.option-checkbox-label input[type="checkbox"],
.option-checkbox-label input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--glow);
}

.btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-secondary:hover {
  background-color: rgba(156, 163, 175, 0.08);
}

.btn-group {
  display: flex;
  gap: 1rem;
}

/* Counter Metrics Dashboard */
.counter-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.metric-card {
  background: rgba(156, 163, 175, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Diff Checker Layout */
.diff-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.diff-output {
  grid-column: span 2;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: rgba(156, 163, 175, 0.02);
  min-height: 150px;
  padding: 1rem;
  font-family: monospace;
  white-space: pre-wrap;
  font-size: 0.9rem;
}

.diff-line {
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
}

.diff-added {
  background-color: rgba(16, 185, 129, 0.15);
  color: #065f46;
  text-decoration: none;
}

[data-theme="dark"] .diff-added {
  color: #34d399;
}

.diff-removed {
  background-color: rgba(239, 68, 68, 0.15);
  color: #991b1b;
  text-decoration: line-through;
}

[data-theme="dark"] .diff-removed {
  color: #f87171;
}

/* Google SERP Preview */
.serp-preview-box {
  background-color: white;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 16px;
  max-width: 600px;
  margin-top: 1rem;
  font-family: arial, sans-serif;
  color: #202124;
  text-align: left;
}

.serp-url-line {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: #202124;
  margin-bottom: 4px;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.serp-title-line {
  font-size: 20px;
  color: #1a0dab;
  line-height: 1.3;
  margin-bottom: 4px;
  cursor: pointer;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.serp-title-line:hover {
  text-decoration: underline;
}

.serp-desc-line {
  font-size: 14px;
  color: #4d5156;
  line-height: 1.58;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.serp-mobile {
  max-width: 375px;
}

.serp-mobile .serp-title-line {
  font-size: 16px;
}

/* Google SERP Dark Mode Overrides */
[data-theme="dark"] .serp-preview-box {
  background-color: #202124;
  border-color: #3c4043;
  color: #bdc1c6;
}

[data-theme="dark"] .serp-url-line {
  color: #bdc1c6;
}

[data-theme="dark"] .serp-title-line {
  color: #8ab4f8;
}

[data-theme="dark"] .serp-desc-line {
  color: #bdc1c6;
}

/* History Box */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 250px;
  overflow-y: auto;
}

.history-item {
  background: rgba(156, 163, 175, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-time {
  color: var(--text-muted);
}

.history-action-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}

/* Prompt Assembler Grid */
.prompt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }
  .diff-container {
    grid-template-columns: 1fr;
  }
  .diff-output {
    grid-column: span 1;
  }
  .prompt-grid {
    grid-template-columns: 1fr;
  }
  /* Bug 261: ビジネス計算機の2カラムグリッドをモバイルで1カラムにスタック */
  .calc-result-grid {
    grid-template-columns: 1fr !important;
  }
  /* Bug 285: 請求書メーカーの集計2カラムグリッドをモバイルで1カラムにスタック */
  .invoice-calc-grid {
    grid-template-columns: 1fr !important;
  }
  .input-row {
    flex-direction: column !important;
  }
}

/* Forms Validation States */
.input-area:user-invalid {
  border-color: var(--danger, #ef4444);
  background-color: rgba(239, 68, 68, 0.03);
}

[data-theme="dark"] .input-area:user-invalid {
  background-color: rgba(239, 68, 68, 0.08);
}
