/* Cursive Signature Generator Styles */
.statmat-tool.cursive-signature {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 1000px;
  margin: 0 auto;
  color: #333;
  background-color: #f9fafb;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.06);
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.statmat-tool.cursive-signature * {
  box-sizing: border-box;
}

.statmat-tool.cursive-signature .cs-header {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  color: #fff;
  padding: 30px 24px;
  text-align: center;
}

.statmat-tool.cursive-signature .cs-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.statmat-tool.cursive-signature .cs-header h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.statmat-tool.cursive-signature .cs-header p {
  margin: 0;
  color: #e0e7ff;
  font-size: 16px;
}

.statmat-tool.cursive-signature .cs-container {
  padding: 30px;
}

.statmat-tool.cursive-signature .workspace {
  display: flex;
  gap: 30px;
}

/* Input Panel */
.statmat-tool.cursive-signature .input-panel {
  width: 320px;
  flex-shrink: 0;
  background-color: #fff;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.statmat-tool.cursive-signature .control-group {
  margin-bottom: 20px;
}

.statmat-tool.cursive-signature .row-group {
  display: flex;
  gap: 16px;
}

.statmat-tool.cursive-signature .row-group .control-group {
  flex: 1;
}

.statmat-tool.cursive-signature label {
  display: block;
  font-weight: 700;
  color: #4b5563;
  margin-bottom: 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.statmat-tool.cursive-signature input[type="text"]:focus,
.statmat-tool.cursive-signature select:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.statmat-tool.cursive-signature input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
}

.statmat-tool.cursive-signature input[type="range"] {
  width: 100%;
  margin-top: 10px;
}

/* Canvas Panel */
.statmat-tool.cursive-signature .canvas-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.statmat-tool.cursive-signature .canvas-wrapper {
  position: relative;
  background-color: #fff;
  background-image: 
    linear-gradient(45deg, #f3f4f6 25%, transparent 25%),
    linear-gradient(-45deg, #f3f4f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3f4f6 75%),
    linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  height: 100%;
  min-height: 350px;
}

.statmat-tool.cursive-signature canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.statmat-tool.cursive-signature .action-bar {
  display: flex;
  gap: 16px;
}

.statmat-tool.cursive-signature .btn {
  flex: 1;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.statmat-tool.cursive-signature .btn-primary {
  background-color: #4f46e5;
  color: white;
}

.statmat-tool.cursive-signature .btn-primary:hover {
  background-color: #4338ca;
}

.statmat-tool.cursive-signature .btn-secondary {
  background-color: #fff;
  color: #4b5563;
  border: 2px solid #d1d5db;
}

.statmat-tool.cursive-signature .btn-secondary:hover {
  background-color: #f3f4f6;
}

@media (max-width: 850px) {
  .statmat-tool.cursive-signature .workspace {
    flex-direction: column;
  }
  .statmat-tool.cursive-signature .input-panel {
    width: 100%;
  }
  .statmat-tool.cursive-signature .canvas-wrapper {
    min-height: 250px;
  }
}

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