:root {
  --primary-color: #3498db;
  --secondary-color: #2c3e50;
  --background-color: #ecf0f1;
  --text-color: #333;
  --card-bg-color: #ffffff;
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
}

.container {
  max-width: 800px;
  padding: 20px;
  width: 100%;
}

header {
  background-color: var(--secondary-color);
  color: white;
  text-align: left;
  padding: 20px 30px;
  margin-bottom: 30px;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
}

.logo {
  font-size: 1.8em;
  font-weight: bold;
  margin-right: 10px;
}

.tagline {
  font-size: 1em;
  margin-bottom: 0;
  margin-right: 20px;
}

.ribbon {
  background: #e74c3c;
  color: white;
  padding: 2px 4px;
  transform: rotate(-1.5deg);
  position: relative;
  display: inline-block;
}

.step, .about-section, footer {
  background-color: var(--card-bg-color);
  border-radius: 8px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: var(--card-shadow);
}

.step h2, .about-section h2, footer p {
  margin: 0 0 20px 0;
}

.step:last-child {
  margin-bottom: 0;
}

.file-input-container {
  position: relative;
  display: inline-block;
  overflow: hidden;
  cursor: pointer;
}

.file-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

#step5 {
  margin-bottom: 20px;
}

.file-input-button, .step button {
  background-color: var(--primary-color);
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s;
  margin-right: 10px;
  margin-bottom: 10px;
  margin-top: 20px;
}

.file-input-button:hover, .step button:hover {
  background-color: #2980b9;
}

.input-label {
  display: inline-block;
  margin-left: 10px;
}

.step textarea, .step select {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border-radius: 5px;
  border: 1px solid #ddd;
  font-size: 16px;
}

.variable {
  display: inline-block;
  margin: 2px;
  padding: 3px 8px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-size: 14px;
  color: #333;
}

.variable:hover {
  background-color: #e0e0e0;
}

.step-connector {
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  margin: -15px 0;
}

.connector-line {
  width: 2px;
  height: 0;
  background-color: var(--primary-color);
}

.about-section ul {
  padding-left: 20px;
  list-style: disc;
  margin-bottom: 20px;
}

footer p {
  margin: 0;
}

footer {
  text-align: left;
}

.fade-in {
  opacity: 0;
  transition: opacity 0.5s ease-in;
  visibility: hidden;
}

.fade-in.show {
  opacity: 1;
  visibility: visible;
}

.step {
  opacity: 1 !important;
  visibility: visible !important;
}

/* DataTables Styling */
.dataTables_wrapper {
  width: 100%;
  overflow: hidden;
}

#csvTableContainer {
  margin-top: 20px;
}

table.dataTable {
  width: 100% !important;
  margin: 0 !important;
  border-collapse: collapse;
}

table.dataTable thead th {
  position: sticky;
  top: 0;
  background-color: var(--primary-color);
  color: white;
  z-index: 1;
  padding: 10px;
  white-space: nowrap;
}

table.dataTable tbody td {
  padding: 8px;
  white-space: nowrap;
}

table.dataTable thead th, 
table.dataTable tbody td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 8px 10px;
}

.dataTables_scrollHead {
  overflow: hidden !important;
}

.dataTables_scrollBody {
  overflow-y: visible !important;
  overflow-x: auto !important;
  max-height: none !important;
}

#csvTableWrapper {
  overflow-x: auto;
  width: 100%;
}

/* Left-align the first column */
table.dataTable thead th:first-child,
table.dataTable tbody td:first-child {
  text-align: left;
}

/* Center-align all other columns */
table.dataTable thead th:not(:first-child),
table.dataTable tbody td:not(:first-child) {
  text-align: center;
}

.dataTables_filter {
  margin-bottom: 10px;
}

.dataTables_filter input {
  width: 200px;
  padding: 5px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.dataTables_wrapper .top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.dataTables_wrapper .bottom {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.dataTables_info {
  margin-bottom: 10px;
}

.datatables-bottom-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.dataTables_length {
  flex-shrink: 0;
}

.dataTables_paginate {
  display: flex;
  align-items: center;
}

.dataTables_paginate .paginate_button {
  padding: 5px 10px;
  margin: 0 2px;
  border-radius: 4px;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
}

.dataTables_paginate .paginate_button.current {
  background-color: #2980b9;
}

.dataTables_length label, .dataTables_filter label {
  font-size: 14px;
  color: var(--text-color);
}

.dataTables_length select {
  height: 35px;
  line-height: 1.4;
  padding: 5px;
  margin: 0 5px;
  border-radius: 5px;
  border: 1px solid #ddd;
}

/* Preview Section Styling */
#previewSection {
  margin-top: 20px;
}

#pageSelector {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 5px;
  border: 1px solid #ddd;
  font-size: 16px;
}

#previewContent {
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 15px;
  margin-top: 10px;
}

#previewRendered {
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 15px;
  background-color: #fff;
  margin-bottom: 15px;
}

#previewSource {
  background-color: #f1f1f1;
  padding: 10px;
  border-radius: 4px;
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 14px;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #ddd;
}

/* SimpleMDE Styling */
.CodeMirror {
  border: 1px solid #ddd;
  border-radius: 5px;
}

.editor-toolbar {
  border: 1px solid #ddd;
  border-radius: 5px 5px 0 0;
}

.editor-preview {
  background-color: #f9f9f9;
}

/* Ensure proper spacing in Step 5 */
#step5 button {
  margin-bottom: 10px;
}

/* Improve spacing in the variables section */
#variables {
  margin-bottom: 15px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .container {
    padding: 10px;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo {
    margin-bottom: 10px;
  }

  .file-input-button, .step button {
    width: 100%;
    margin-right: 0;
  }

  .dataTables_filter input {
    width: 100%;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    float: none;
    text-align: center;
  }

  .dataTables_wrapper .dataTables_filter {
    margin-top: 0.5em;
  }

  .datatables-bottom-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .dataTables_length,
  .dataTables_paginate {
    margin-top: 10px;
    width: 100%;
  }

  .dataTables_paginate {
    justify-content: center;
  }
}