/* ============================================================
   TABLE.CSS – makeCSS.com Table Generator
   Generator-specific styles (layout/workbench handled by shared CSS)
   ============================================================ */

/* ---------- Table Preview Area ---------- */
.table-preview-area {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-preview-area__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-surface-2);
}

.table-preview-area__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.table-preview-area__canvas {
  padding: var(--space-lg);
  overflow-x: auto;
  transition: background-color 0.2s;
}

.table-preview-area__canvas--mobile {
  display: flex;
  justify-content: center;
}

.table-preview-wrapper {
  min-width: 480px;
  transition: max-width 0.3s ease;
}

.table-preview-area__canvas--mobile .table-preview-wrapper {
  min-width: 0;
  max-width: 375px;
}

/* ---------- Viewport Toggle ---------- */
.table-viewport-toggle {
  display: flex;
  gap: 4px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.table-viewport-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border: none;
  background: none;
  border-radius: calc(var(--radius-sm) - 1px);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color 0.15s, background-color 0.15s;
}

.table-viewport-btn:hover {
  color: var(--color-text);
  background-color: var(--color-surface-2);
}

.table-viewport-btn--active {
  color: var(--color-primary);
  background-color: var(--color-primary-alpha, rgba(67, 97, 238, 0.08));
}

.table-viewport-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- Code Output Tabs ---------- */
.code-output__tabs {
  display: flex;
  gap: 2px;
}

.code-output__tab {
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.code-output__tab:hover {
  color: var(--color-text);
  background-color: var(--color-surface-2);
}

.code-output__tab--active {
  color: var(--color-primary);
  background-color: var(--color-primary-alpha, rgba(67, 97, 238, 0.08));
}

.code-output__panel {
  display: none;
}

.code-output__panel--active {
  display: block;
}

/* ---------- Editor Panels ---------- */
.table-editor-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.table-editor-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-surface-2);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s;
}

.table-editor-panel__header:hover {
  background-color: var(--color-surface-3, var(--color-surface-2));
}

.table-editor-panel__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin: 0;
}

.table-editor-panel__chevron {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  transition: transform 0.2s;
}

.table-editor-panel--open .table-editor-panel__chevron {
  transform: rotate(180deg);
}

.table-editor-panel__body {
  display: none;
  padding: var(--space-md);
}

.table-editor-panel--open .table-editor-panel__body {
  display: block;
}

/* ---------- Control Rows ---------- */
.table-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
}

.table-control-row + .table-control-row {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-sm);
  margin-top: var(--space-xs);
}

.table-control-row__label {
  font-size: var(--text-sm);
  color: var(--color-text);
  white-space: nowrap;
  min-width: 100px;
}

.table-control-row__input {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-content: flex-end;
}

.table-control-row__value {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}

/* ---------- Select Control ---------- */
.table-select {
  padding: 6px 28px 6px 10px;
  font-size: var(--text-sm);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s;
}

.table-select:hover,
.table-select:focus {
  border-color: var(--color-primary);
  outline: none;
}

/* ---------- Color Input ---------- */
.table-color-input {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.table-color-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
}

.table-color-swatch::-webkit-color-swatch-wrapper {
  padding: 0;
}

.table-color-swatch::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.table-color-hex {
  width: 80px;
  padding: 4px 8px;
  font-size: var(--text-xs);
  font-family: var(--font-mono, monospace);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

/* ---------- Toggle ---------- */
.table-toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background-color: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.table-toggle--active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.table-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.table-toggle--active .table-toggle__thumb {
  transform: translateX(16px);
}

/* ---------- Slider ---------- */
.table-slider {
  flex: 1;
  max-width: 160px;
  height: 6px;
  border-radius: 3px;
  background: var(--color-surface-2);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.table-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.table-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px var(--color-primary-alpha, rgba(67, 97, 238, 0.15));
}

.table-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  border: none;
}

/* ---------- Text Input ---------- */
.table-text-input {
  width: 100%;
  max-width: 200px;
  padding: 6px 10px;
  font-size: var(--text-sm);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}

.table-text-input:focus {
  border-color: var(--color-primary);
  outline: none;
}

.table-text-input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* ---------- Hint Text ---------- */
.table-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: var(--space-sm) 0 0;
  padding: var(--space-sm) var(--space-sm);
  background-color: var(--color-surface-2);
  border-radius: var(--radius-sm);
}

.table-hint code {
  font-size: 0.9em;
  padding: 1px 4px;
  background-color: var(--color-surface);
  border-radius: 3px;
  font-family: var(--font-mono, monospace);
}

/* ---------- Mini Table Preview ---------- */
.table-mini-preview {
  pointer-events: none;
}
