/* Stamp Badge Styles */
.statmat-tool.stamp-badge {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 900px;
  margin: 0 auto;
  color: #2d3748;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.statmat-tool.stamp-badge * {
  box-sizing: border-box;
}

.statmat-tool.stamp-badge .stamp-header {
  background-color: #d32f2f; /* Stamp Red */
  color: #fff;
  padding: 30px 24px;
  text-align: center;
}

.statmat-tool.stamp-badge .stamp-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.statmat-tool.stamp-badge .stamp-header h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
}

.statmat-tool.stamp-badge .stamp-header p {
  margin: 0;
  color: #ffcdd2;
  font-size: 16px;
}

.statmat-tool.stamp-badge .stamp-container {
  padding: 30px;
}

.statmat-tool.stamp-badge .workspace {
  display: flex;
  gap: 30px;
}

/* Controls Panel */
.statmat-tool.stamp-badge .controls-panel {
  flex: 1;
  background-color: #f8fafc;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.statmat-tool.stamp-badge .control-group {
  margin-bottom: 20px;
}

.statmat-tool.stamp-badge .row-group {
  display: flex;
  gap: 16px;
}

.statmat-tool.stamp-badge .row-group .control-group {
  flex: 1;
}

.statmat-tool.stamp-badge label {
  display: block;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 8px;
  font-size: 14px;
}

.statmat-tool.stamp-badge input[type="text"],
.statmat-tool.stamp-badge select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #cbd5e0;
  border-radius: 6px;
  font-size: 15px;
  background-color: #fff;
  transition: all 0.2s;
}

.statmat-tool.stamp-badge input[type="text"]:focus,
.statmat-tool.stamp-badge select:focus {
  outline: none;
  border-color: #d32f2f;
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.15);
}

.statmat-tool.stamp-badge input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 2px solid #cbd5e0;
  border-radius: 6px;
  cursor: pointer;
  background-color: #fff;
}

/* Canvas Panel */
.statmat-tool.stamp-badge .canvas-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.statmat-tool.stamp-badge .canvas-wrapper {
  background-image: 
    linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  padding: 20px;
  background-color: #fff;
  margin-bottom: 20px;
}

.statmat-tool.stamp-badge canvas {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
}

.statmat-tool.stamp-badge .action-bar {
  width: 100%;
}

.statmat-tool.stamp-badge .btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.statmat-tool.stamp-badge .btn-primary {
  background-color: #d32f2f;
  color: white;
}

.statmat-tool.stamp-badge .btn-primary:hover {
  background-color: #b71c1c;
}

@media (max-width: 768px) {
  .statmat-tool.stamp-badge .workspace {
    flex-direction: column;
  }
}

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