/* Legal Typography Checker Styles */
.statmat-tool.legal-typography {
  font-family: 'Times New Roman', Times, serif; /* Classic legal font */
  max-width: 800px;
  margin: 0 auto;
  color: #2c3e50;
  background-color: #fdfdfd;
  border: 1px solid #dcdde1;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.statmat-tool.legal-typography * {
  box-sizing: border-box;
}

.statmat-tool.legal-typography .legal-header {
  text-align: center;
  padding: 30px 20px;
  background-color: #2c3e50;
  color: #fff;
  border-radius: 8px 8px 0 0;
  border-bottom: 4px solid #c23616; /* Professional red accent */
}

.statmat-tool.legal-typography .legal-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.statmat-tool.legal-typography .legal-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: normal;
  letter-spacing: 1px;
}

.statmat-tool.legal-typography .legal-header p {
  margin: 8px 0 0 0;
  font-size: 16px;
  font-style: italic;
  color: #bdc3c7;
}

.statmat-tool.legal-typography .legal-container {
  padding: 30px;
}

.statmat-tool.legal-typography label {
  display: block;
  font-weight: bold;
  margin-bottom: 10px;
  color: #34495e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.statmat-tool.legal-typography textarea {
  width: 100%;
  padding: 16px;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1.6;
  font-family: inherit;
  resize: vertical;
  background-color: #fff;
  transition: border-color 0.2s;
}

.statmat-tool.legal-typography textarea:focus {
  outline: none;
  border-color: #2c3e50;
  box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.statmat-tool.legal-typography .controls-bar {
  margin: 20px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background-color: #f5f6fa;
  padding: 16px;
  border-radius: 6px;
  border: 1px solid #dcdde1;
}

.statmat-tool.legal-typography .checks-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.statmat-tool.legal-typography .check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  margin: 0;
  cursor: pointer;
  font-size: 14px;
}

.statmat-tool.legal-typography .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 14px;
}

.statmat-tool.legal-typography .btn-primary {
  background-color: #c23616;
  color: #fff;
}

.statmat-tool.legal-typography .btn-primary:hover {
  background-color: #a02810;
}

.statmat-tool.legal-typography .btn-success {
  background-color: #27ae60;
  color: #fff;
}

.statmat-tool.legal-typography .btn-success:hover {
  background-color: #219653;
}

.statmat-tool.legal-typography .result-section {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid #dcdde1;
}

.statmat-tool.legal-typography .stats-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.statmat-tool.legal-typography .stat-box {
  background-color: #f5f6fa;
  border: 1px solid #dcdde1;
  border-radius: 6px;
  padding: 16px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.statmat-tool.legal-typography .stat-number {
  font-size: 28px;
  font-weight: bold;
  color: #c23616;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.statmat-tool.legal-typography .stat-label {
  font-size: 12px;
  text-transform: uppercase;
  color: #7f8fa6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.statmat-tool.legal-typography .action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.statmat-tool.legal-typography .action-bar h3 {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #2c3e50;
  font-size: 18px;
}

.statmat-tool.legal-typography #correctedOutput {
  background-color: #fdfdfd;
}

/* Toast */
.statmat-tool.legal-typography .toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: #2c3e50;
  color: white;
  padding: 12px 24px;
  border-radius: 4px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  z-index: 9999;
}

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

@media (max-width: 768px) {
  .statmat-tool.legal-typography .stats-panel {
    grid-template-columns: repeat(2, 1fr);
  }
  .statmat-tool.legal-typography .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* 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;
}
