/* Homoglyph Detector Styles */
.statmat-tool.homoglyph-detector {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  color: #333;
}

.statmat-tool.homoglyph-detector * {
  box-sizing: border-box;
}

.statmat-tool.homoglyph-detector .input-group {
  margin-bottom: 20px;
}

.statmat-tool.homoglyph-detector label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
}

.statmat-tool.homoglyph-detector textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.statmat-tool.homoglyph-detector textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.statmat-tool.homoglyph-detector .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s, color 0.2s;
}

.statmat-tool.homoglyph-detector .btn-primary {
  background-color: #3b82f6;
  color: #fff;
  width: 100%;
}

.statmat-tool.homoglyph-detector .btn-primary:hover {
  background-color: #2563eb;
}

.statmat-tool.homoglyph-detector .btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
}

.statmat-tool.homoglyph-detector .btn-secondary:hover {
  background-color: #e5e7eb;
}

.statmat-tool.homoglyph-detector .result-card {
  margin-top: 32px;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.statmat-tool.homoglyph-detector .summary-box {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.statmat-tool.homoglyph-detector .summary-box.clean {
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.statmat-tool.homoglyph-detector .summary-box.dirty {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.statmat-tool.homoglyph-detector .summary-box h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 18px;
}

.statmat-tool.homoglyph-detector .summary-box p {
  margin: 0;
}

.statmat-tool.homoglyph-detector .comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.statmat-tool.homoglyph-detector .grid-col h4 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 15px;
  color: #4b5563;
}

.statmat-tool.homoglyph-detector .result-box {
  background-color: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px 16px;
  min-height: 80px;
  font-family: monospace;
  font-size: 15px;
  word-break: break-all;
  white-space: pre-wrap;
}

.statmat-tool.homoglyph-detector .clean-preview {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.statmat-tool.homoglyph-detector .clean-preview span {
  flex-grow: 1;
}

.statmat-tool.homoglyph-detector .danger-char {
  background-color: #fecaca;
  color: #991b1b;
  font-weight: bold;
  padding: 0 2px;
  border-radius: 2px;
  border-bottom: 2px solid #ef4444;
}

.statmat-tool.homoglyph-detector .btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
  flex-shrink: 0;
  margin-left: 8px;
}

.statmat-tool.homoglyph-detector .btn-icon:hover {
  background-color: #e5e7eb;
  color: #374151;
}

.statmat-tool.homoglyph-detector .table-container {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.statmat-tool.homoglyph-detector .detected-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.statmat-tool.homoglyph-detector .detected-table th,
.statmat-tool.homoglyph-detector .detected-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.statmat-tool.homoglyph-detector .detected-table th {
  background-color: #f9fafb;
  font-weight: 600;
  font-size: 14px;
  color: #4b5563;
}

.statmat-tool.homoglyph-detector .detected-table tr:last-child td {
  border-bottom: none;
}

.statmat-tool.homoglyph-detector .char-display {
  font-size: 18px;
  font-family: monospace;
  font-weight: bold;
  margin-right: 8px;
}

.statmat-tool.homoglyph-detector .char-hex {
  font-size: 12px;
  color: #6b7280;
  font-family: monospace;
}

.statmat-tool.homoglyph-detector .result-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.statmat-tool.homoglyph-detector .toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background-color: #10b981;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  z-index: 9999;
}

.statmat-tool.homoglyph-detector .toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .statmat-tool.homoglyph-detector .comparison-grid {
    grid-template-columns: 1fr;
  }
}

/* Global override for mobile scrolling on long results */
.statmat-tool [class*="result"], 
.statmat-tool [class*="output"],
.statmat-tool [class*="preview"],
.statmat-tool [class*="display"] {
  overflow-x: auto;
  max-width: 100%;
}

/* Global safeguard: ensure main wrapper never exceeds mobile viewport */
.statmat-tool {
  width: 100% !important;
  box-sizing: border-box;
}
