/* Script Converter Custom Styles */
.script-wrap {
  /* Dynamic integration with site-wide CSS variables */
  --color-text-primary: var(--text, #000000);
  --color-text-secondary: var(--text-muted, #585859);
  --color-border-primary: var(--navy, #000000);
  --color-border-secondary: var(--border, #e2e2e3);
  --color-background-primary: var(--white, #ffffff);
  --color-background-secondary: var(--gray-50, #f8f8f8);
  --font-sans: var(--font-body, 'Google Sans Flex', sans-serif);
  
  --border-radius-md: 8px;
  --border-radius-lg: 12px;

  max-width: 650px;
  margin: 0 auto;
  padding: 0 0 24px;
  font-family: var(--font-sans);
}

.script-wrap * {
  box-sizing: border-box;
}

.script-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-section {
  display: flex;
  flex-direction: column;
}

.lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
  display: block;
}

/* Textarea input */
.script-wrap textarea {
  width: 100%;
  font-size: 14px;
  padding: 12px 14px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  background: var(--color-background-primary);
  color: var(--color-text-primary);
  resize: vertical;
  line-height: 1.5;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 80px;
}

.script-wrap textarea:focus {
  border-color: var(--color-border-primary);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.03);
}

/* Script Picker Grid */
.script-scroll {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.script-wrap .spick {
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  padding: 8px 12px;
  cursor: pointer;
  background: var(--color-background-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .12s;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.01);
}

.script-wrap .spick:hover {
  border-color: var(--color-border-primary);
  background: var(--color-background-secondary);
  transform: translateY(-1px);
}

.script-wrap .spick.on {
  border-color: var(--color-border-primary);
  background: var(--color-background-secondary);
  border-width: 1.5px;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.script-wrap .spick-flag {
  font-size: 20px;
  flex-shrink: 0;
}

.script-wrap .spick-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.script-wrap .spick-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.script-wrap .spick-sample {
  font-size: 10px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* Chips Row */
.script-wrap .chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.script-wrap .chip {
  padding: 6px 14px;
  border-radius: 99px;
  border: 0.5px solid var(--color-border-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: var(--color-background-primary);
  color: var(--color-text-secondary);
  transition: all .12s;
  white-space: nowrap;
  user-select: none;
}

.script-wrap .chip:hover {
  border-color: var(--color-border-primary);
  color: var(--color-text-primary);
  background: var(--color-background-secondary);
}

.script-wrap .chip.on {
  background: var(--color-border-primary);
  border-color: var(--color-border-primary);
  color: var(--color-background-primary);
  font-weight: 600;
}

/* Stat Row */
.script-wrap .stat-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.script-wrap .stat {
  font-size: 11px;
  color: var(--color-text-secondary);
  background: var(--color-background-secondary);
  border-radius: 99px;
  padding: 2px 8px;
  border: 0.5px solid var(--color-border-secondary);
}

.script-wrap .stat b {
  color: var(--color-text-primary);
  font-weight: 500;
}

/* Actions */
.script-wrap .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.script-wrap .actions button {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  background: var(--color-background-primary);
  color: var(--color-text-primary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.script-wrap .actions button:hover {
  background: var(--color-background-secondary);
  border-color: var(--color-border-primary);
}

.script-wrap .actions button:active {
  transform: scale(.98);
}

/* Output Layout */
.output-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 0.5px solid var(--color-border-secondary);
  padding-bottom: 4px;
  flex-wrap: wrap;
  gap: 10px;
}

.script-wrap .tabs {
  display: flex;
  gap: 4px;
}

.script-wrap .tab {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  transition: all .15s;
  user-select: none;
}

.script-wrap .tab:hover {
  color: var(--color-text-primary);
}

.script-wrap .tab.on {
  color: var(--color-text-primary);
  border-bottom-color: var(--color-border-primary);
}

.script-wrap .tp {
  display: none;
}

.script-wrap .tp.on {
  display: block;
}

/* Output Cards */
.out-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.script-wrap .out-card {
  background: var(--color-background-primary);
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-lg);
  padding: 16px 18px;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.01);
}

.script-wrap .out-card:hover {
  border-color: var(--color-border-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.script-wrap .out-card.copied {
  border-color: #059669;
  background: #f0fdf4;
}

.script-wrap .out-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.script-wrap .out-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  display: flex;
  gap: 8px;
  align-items: center;
}

.script-wrap .out-card.copied .out-meta {
  color: #059669;
}

.script-wrap .dir-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  border: 0.5px solid var(--color-border-secondary);
  background: var(--color-background-secondary);
  color: var(--color-text-secondary);
  text-transform: uppercase;
}

.script-wrap .out-text {
  font-size: 24px;
  color: var(--color-text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.script-wrap .out-card.copied .out-text {
  color: #059669;
}

.script-wrap .out-roman {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 6px;
  border-top: 0.5px solid var(--color-border-secondary);
  padding-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Compare View */
.compare-table-wrapper {
  overflow-x: auto;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: var(--border-radius-md);
  background: var(--color-background-primary);
}

.script-wrap .compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.script-wrap .compare-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  text-align: left;
  padding: 10px 12px;
  background: var(--color-background-secondary);
  border-bottom: 0.5px solid var(--color-border-secondary);
}

.script-wrap .compare-table td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--color-border-secondary);
  vertical-align: middle;
  color: var(--color-text-primary);
}

.script-wrap .compare-table tr:last-child td {
  border-bottom: none;
}

.script-wrap .word-col {
  font-weight: 600;
  color: var(--color-text-secondary);
}

.script-wrap .script-col {
  font-size: 18px;
  color: var(--color-text-primary);
}

/* Hide default tool layouts */
.tool-page .gen-heading {
  position: absolute;
  left: -9999px;
}

.tool-page .tool-output-grid {
  display: none;
}

.tool-interface {
  min-height: auto;
  padding: 0;
  background: transparent;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .script-wrap {
    padding: 0;
  }
}

@media (max-width: 600px) {
  .output-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Responsive Table Override */
.tool-content .content-right table {
  display: table !important;
  width: 100% !important;
  white-space: normal !important;
  word-break: break-word !important;
}

.tool-content .content-right table td {
  white-space: normal !important;
  word-break: break-word !important;
}