/* Modern Reset & Base */
.wtb-table-builder-container * {
	box-sizing: border-box;
}

.wtb-table-builder-container {
	width: 100%;
	max-width: 1200px;
	margin: 40px auto;
	background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
	border-radius: 20px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.03);
	padding: 32px 36px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: #1e293b;
}

.wtb-table-builder-container .wtb-title {
	padding-top: 0;
	margin: 0 0 20px 0;
	background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	font-weight: 800;
	font-size: 1.8em;
	letter-spacing: -0.02em;
}

.wtb-table-builder-container .wtb-step-title {
	color: #1e293b;
	font-size: 1.3em;
	margin: 0 0 20px 0;
	font-weight: 700;
}

.wtb-table-builder-container .wtb-preview-title,
.wtb-table-builder-container .wtb-controls-title {
	color: #334155;
	font-size: 1.1em;
	margin: 0 0 12px 0;
	font-weight: 600;
}

.wtb-table-builder-container .wtb-format-title {
	margin: 0 0 8px 0;
	color: #1e293b;
	font-size: 1.1em;
	font-weight: 600;
}

/* Instructions */
.wtb-instructions {
	background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
	border-left: 4px solid #2563eb;
	padding: 14px 18px;
	margin-bottom: 24px;
	border-radius: 8px;
	font-size: 0.9em;
	line-height: 1.5;
	color: #1e40af;
}

.wtb-instructions strong {
	display: block;
	margin-bottom: 4px;
	color: #1e3a8a;
}

/* Builder Steps */
.wtb-builder-step {
	opacity: 1;
	transition: opacity 0.3s ease;
}

.wtb-builder-step.wtb-hidden {
	display: none;
	opacity: 0;
}

/* Format Selection */
.wtb-format-options {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
	gap: 20px;
	margin-bottom: 24px;
}

.wtb-format-card {
	background: white;
	border: 2px solid #e2e8f0;
	border-radius: 12px;
	padding: 24px;
	text-align: center;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
}

.wtb-format-card:hover {
	border-color: #2563eb;
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
}

.wtb-format-card.wtb-selected {
	border-color: #2563eb;
	background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
	box-shadow: 0 4px 16px rgba(37, 99, 235, 0.2);
}

.wtb-format-card.wtb-selected::after {
	content: "✓";
	position: absolute;
	top: 12px;
	right: 12px;
	width: 28px;
	height: 28px;
	background: #2563eb;
	color: white;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: bold;
	font-size: 16px;
}

.wtb-format-icon {
	margin-bottom: 16px;
	display: flex;
	justify-content: center;
}

.wtb-format-desc {
	margin: 0;
	color: #64748b;
	font-size: 0.9em;
}

.wtb-heading-toggle {
	margin: 24px 0;
	padding: 16px;
	background: #f8fafc;
	border-radius: 8px;
}

.wtb-heading-toggle label {
	display: flex;
	align-items: center;
	cursor: pointer;
	font-weight: 500;
	color: #334155;
}

.wtb-heading-toggle input[type="checkbox"] {
	width: 20px;
	height: 20px;
	margin-right: 10px;
	cursor: pointer;
	accent-color: #2563eb;
}

/* Grid Selector */
.wtb-grid-selector-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-bottom: 24px;
	padding: 24px;
	background: white;
	border-radius: 12px;
	border: 2px solid #e2e8f0;
}

.wtb-grid-selector {
	display: grid;
	gap: 4px;
	margin-bottom: 16px;
	padding: 12px;
	background: #f8fafc;
	border-radius: 8px;
}

.wtb-grid-cell {
	width: 24px;
	height: 24px;
	background: white;
	border: 1px solid #cbd5e1;
	border-radius: 3px;
	cursor: pointer;
	transition: all 0.15s ease;
}

.wtb-grid-cell:hover,
.wtb-grid-cell.wtb-hover {
	background: #dbeafe;
	border-color: #2563eb;
}

.wtb-grid-cell.wtb-selected {
	background: #2563eb;
	border-color: #1e40af;
}

.wtb-grid-info {
	font-size: 0.95em;
	color: #64748b;
	font-weight: 500;
	min-height: 24px;
}

/* Manual Inputs */
.wtb-manual-inputs {
	display: flex;
	gap: 16px;
	align-items: flex-end;
	justify-content: center;
	margin-bottom: 24px;
	padding: 20px;
	background: #f8fafc;
	border-radius: 8px;
}

.wtb-input-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.wtb-input-group label {
	font-size: 0.9em;
	font-weight: 600;
	color: #475569;
}

.wtb-input-group input[type="number"] {
	width: 100px;
	padding: 8px 12px;
	border: 2px solid #e2e8f0;
	border-radius: 6px;
	font-size: 1em;
	transition: border-color 0.2s ease;
}

.wtb-input-group input[type="number"]:focus {
	outline: none;
	border-color: #2563eb;
}

/* Table Editor */
.wtb-table-editor-wrapper {
	margin-bottom: 24px;
	padding: 24px;
	background: white;
	border-radius: 12px;
	border: 2px solid #e2e8f0;
	overflow-x: auto;
}

#wtb-table-editor {
	min-width: 100%;
}

.wtb-editable-table {
	width: 100%;
	border-collapse: collapse;
	position: relative;
}

.wtb-editable-table th,
.wtb-editable-table td {
	border: 1px solid #cbd5e1;
	padding: 12px;
	min-width: 120px;
	position: relative;
}

.wtb-editable-table th {
	background: #f1f5f9;
	font-weight: 600;
	color: #1e293b;
}

.wtb-editable-table td {
	background: white;
}

.wtb-editable-table input {
	width: 100%;
	border: 1px solid transparent;
	padding: 6px 8px;
	font-size: 0.95em;
	background: transparent;
	transition: all 0.2s ease;
}

.wtb-editable-table input:focus {
	outline: none;
	border-color: #2563eb;
	background: #eff6ff;
	border-radius: 4px;
}

.wtb-add-column-btn {
	position: absolute;
	bottom: -16px;
	right: -16px;
	width: 32px;
	height: 32px;
	background: #2563eb;
	color: white;
	border: none;
	border-radius: 50%;
	font-size: 20px;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	z-index: 10;
}

.wtb-add-column-btn:hover {
	background: #1e40af;
	transform: scale(1.1);
	box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.wtb-add-column-btn:active {
	transform: scale(0.95);
}

/* Styling Controls */
.wtb-styling-controls {
	background: #f8fafc;
	padding: 24px;
	border-radius: 12px;
	margin-bottom: 24px;
}

.wtb-control-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 20px;
	margin-bottom: 16px;
}

.wtb-control-row:last-child {
	margin-bottom: 0;
}

.wtb-control-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
	position: relative;
}

.wtb-control-group label {
	font-size: 0.9em;
	font-weight: 600;
	color: #475569;
}

.wtb-control-group select,
.wtb-control-group input[type="number"] {
	padding: 8px 12px;
	border: 2px solid #e2e8f0;
	border-radius: 6px;
	font-size: 1em;
	background: white;
	transition: border-color 0.2s ease;
}

.wtb-control-group select:focus,
.wtb-control-group input[type="number"]:focus {
	outline: none;
	border-color: #2563eb;
}

.wtb-control-group input[type="color"] {
	height: 40px;
	border: 2px solid #e2e8f0;
	border-radius: 6px;
	cursor: pointer;
	padding: 4px;
}

.wtb-control-group .wtb-unit {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: #64748b;
	font-size: 0.9em;
	pointer-events: none;
}

/* Table Preview */
.wtb-table-preview-wrapper {
	margin-bottom: 24px;
	padding: 24px;
	background: white;
	border-radius: 12px;
	border: 2px solid #e2e8f0;
	overflow-x: auto;
}

#wtb-table-preview {
	min-width: 100%;
}

/* Export Section */
.wtb-export-section {
	text-align: center;
	margin-bottom: 24px;
}

.wtb-copy-feedback {
	margin-top: 12px;
	font-size: 0.9em;
	min-height: 24px;
	font-weight: 500;
}

.wtb-copy-feedback.wtb-success {
	color: #059669;
}

.wtb-copy-feedback.wtb-error {
	color: #dc2626;
}

/* Buttons */
.wtb-btn-primary,
.wtb-btn-secondary,
.wtb-btn-back,
.wtb-btn-copy {
	padding: 12px 24px;
	border: none;
	border-radius: 8px;
	font-size: 1em;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	display: inline-block;
	margin: 8px 4px;
}

.wtb-btn-primary {
	background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
	color: white;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.wtb-btn-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

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

.wtb-btn-secondary {
	background: #64748b;
	color: white;
	box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

.wtb-btn-secondary:hover {
	background: #475569;
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(100, 116, 139, 0.4);
}

.wtb-btn-back {
	background: #f1f5f9;
	color: #475569;
	border: 2px solid #e2e8f0;
}

.wtb-btn-back:hover {
	background: #e2e8f0;
	border-color: #cbd5e1;
}

.wtb-btn-copy {
	background: linear-gradient(135deg, #059669 0%, #047857 100%);
	color: white;
	font-size: 1.1em;
	padding: 14px 32px;
	box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.wtb-btn-copy:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

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

.wtb-copy-icon {
	margin-right: 8px;
}

/* Signature */
.wtb-table-builder-signature {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid #e2e8f0;
	text-align: center;
}

.wtb-table-builder-signature img {
	width: 140px;
	opacity: 0.7;
	transition: opacity 0.3s ease;
}

.wtb-table-builder-signature img:hover {
	opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
	.wtb-table-builder-container {
		padding: 20px 16px;
	}

	.wtb-format-options {
		grid-template-columns: 1fr;
	}

	.wtb-control-row {
		grid-template-columns: 1fr;
	}

	.wtb-manual-inputs {
		flex-direction: column;
		align-items: stretch;
	}

	.wtb-input-group input[type="number"] {
		width: 100%;
	}
}

/* Column Resize Handle */
.wtb-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 5;
  transition: background 0.2s ease;
}

.wtb-resize-handle:hover {
  background: rgba(37, 99, 235, 0.3);
}

.wtb-resize-handle.wtb-resizing {
  background: rgba(37, 99, 235, 0.5);
}

.wtb-editable-table th,
.wtb-editable-table td {
  border: 1px solid #cbd5e1;
  padding: 12px;
  min-width: 50px;
  position: relative;
}
