﻿body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f5f5;
}

:root {
  --form-background: #ffffff;
  --form-text: #111827;
  --accent-color: #007bff;
  --accent-color-hover: #0056b3;
}

.form-container {
  width: 100%;
  max-width: 900px;
  padding: 20px;
  background-color: var(--form-background, #fff);
  color: var(--form-text, #111827);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.form-container div {
  margin-bottom: 15px;
}

label {
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px;
  margin-top: 5px;
  box-sizing: border-box;
  font-size: 1rem;
  font-family: inherit;
  color: var(--form-text, #111827);
  border: 1px solid #9ca3af; /* slightly darker grey for visibility */
  border-radius: 4px;
}

button {
  width: 100%;
  padding: 12px;
  background-color: var(--accent-color, #007bff);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: var(--accent-color-hover, #0056b3);
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.two-column input,
.two-column select,
.two-column textarea,
.two-column button {
  width: 100%;
}

.two-column .full-width {
  grid-column: span 2;
}

@media (max-width: 600px) {
  .form-container {
    padding: 15px;
    margin: 0 10px;
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

#successMessage {
  text-align: center;
  padding: 20px;
  border: 1px solid #28a745;
  background-color: #d4edda;
  color: #155724;
  border-radius: 4px;
}

.hidden {
  display: none;
}
.field-card {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 20px;
  background-color: #f9fafb;
}

.field-card .inline-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card-action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.field-card button {
  width: auto;
}

.builder-inline-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 8px;
}

.builder-inline-actions button {
  flex: 1 1 220px;
}

.builder-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.design-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 16px;
}

.asset-card {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 20px;
  background-color: #f3f4f6;
}

.asset-title {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.1rem;
  font-weight: 600;
}

.asset-card button {
  width: auto;
}

.asset-layout-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.asset-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  justify-content: flex-end;
}

#designCustomCss {
  font-family: 'Fira Code', 'Consolas', monospace;
}

.label-card,
.section-card {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 20px;
  background-color: #f9fafb;
}

.label-title,
.section-title {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.05rem;
  font-weight: 600;
}

.label-actions,
.section-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 12px;
}

.form-asset {
  margin: 24px 0;
  text-align: center;
}

.form-asset img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}

.form-asset.align-left {
  text-align: left;
}

.form-asset.align-right {
  text-align: right;
}

.form-asset.align-stretch {
  text-align: center;
}

.form-asset.align-stretch img {
  width: 100%;
  max-width: 100%;
}

.form-asset-logo img {
  max-height: 140px;
}

.form-asset-banner img {
  width: 100%;
  max-width: 100%;
}

.form-asset figcaption {
  margin-top: 8px;
  font-size: 0.95rem;
  opacity: 0.8;
}

.form-label-block {
  margin: 16px 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--form-text, #111827);
}

.form-label-block.align-left {
  text-align: left;
}

.form-label-block.align-center {
  text-align: center;
}

.form-label-block.align-right {
  text-align: right;
}

.form-label-block p {
  margin: 0;
  white-space: pre-line;
}

.form-section {
  margin: 36px 0 20px;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid var(--accent-color, #2563eb);
  background-color: rgba(37, 99, 235, 0.05);
}

.form-section-outlined {
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-left-width: 4px;
  background-color: #ffffff;
}

.form-section-flush {
  border: none;
  padding: 0 0 20px;
  background: transparent;
}

.form-section h2 {
  margin: 0 0 12px;
  font-size: 1.4rem;
}

.form-section p {
  margin: 0;
  color: inherit;
  line-height: 1.6;
}

.button-secondary {
  width: auto;
  padding: 10px 16px;
  background-color: #6b7280;
  color: #fff;
  border: none;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}

.button-secondary:hover {
  background-color: #4b5563;
  color: #fff;
  text-decoration: none;
}

.options-row {
  margin-top: 10px;
}

.message {
  margin-top: 20px;
  border-radius: 4px;
  padding: 16px;
}

.message.success {
  border: 1px solid #28a745;
  background-color: #d4edda;
  color: #155724;
}

.message.error {
  border: 1px solid #dc3545;
  background-color: #f8d7da;
  color: #721c24;
}
.message.info {
  border: 1px solid #0d6efd;
  background-color: #e7f1ff;
  color: #0b4ca1;
}

.builder-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}

#builderSubmit {
  width: auto;
}

#existingForms {
  list-style: none;
  padding: 0;
  margin: 0;
}

#existingForms li {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  background-color: #ffffff;
}

#existingForms li:last-child {
  margin-bottom: 0;
}

#existingForms .form-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#existingForms small {
  color: #6b7280;
}

#existingForms .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}


#existingForms {
  list-style: none;
  padding: 0;
  margin: 0;
}

#existingForms li {
  margin-bottom: 8px;
}

#existingForms a {
  color: #007bff;
  text-decoration: none;
}

#existingForms a:hover {
  text-decoration: underline;
}
.logic-section {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e5e7eb;
}

.logic-section .logic-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.logic-hint {
  margin: 0;
  color: #4b5563;
  font-size: 0.9rem;
}

.logic-rules {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.logic-rule {
  border: 1px dashed #d1d5db;
  border-radius: 4px;
  padding: 12px;
  background-color: #fff;
}

.logic-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.logic-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logic-inline button {
  flex-shrink: 0;
}

.logic-add {
  margin-top: 8px;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.table-controls input[type="search"] {
  flex: 1 1 220px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}

.table-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background-color: #ffffff;
}

#entriesTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

#entriesTable th,
#entriesTable td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

#entriesTable th {
  background-color: #f9fafb;
  cursor: pointer;
  position: relative;
  user-select: none;
  font-weight: 600;
}

#entriesTable th[data-sort-direction="asc"]::after {
  content: '▲';
  position: absolute;
  right: 10px;
  font-size: 0.7rem;
  color: #2563eb;
}

#entriesTable th[data-sort-direction="desc"]::after {
  content: '▼';
  position: absolute;
  right: 10px;
  font-size: 0.7rem;
  color: #2563eb;
}

#entriesTable tbody tr:hover {
  background-color: #f3f4f6;
}

#entriesTable td.boolean {
  text-transform: uppercase;
  font-weight: 600;
}

.meta-info {
  color: #6b7280;
  margin-top: 12px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover {
  text-decoration: underline;
}

#entriesTable td.photo-cell,
#entriesTable td.file-cell {
  vertical-align: top;
}

.entry-photo-list,
.entry-file-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entry-photo,
.entry-file {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.entry-photo img {
  max-width: 160px;
  max-height: 160px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.entry-photo-details,
.entry-file-name {
  font-weight: 600;
}

.entry-file-meta,
.entry-photo-details .entry-file-size {
  font-size: 0.85rem;
  color: #6b7280;
}

.entry-download {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  color: #2563eb;
  text-decoration: none;
}

.entry-download:hover {
  text-decoration: underline;
}

.file-input-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.file-input-display {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.file-input-name {
  font-size: 0.9rem;
  color: #4b5563;
}

.file-input-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #6b7280;
}
