* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background-color: #edf1f7;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 18px;
  color: #2a2e35;
}

.wrapper {
  display: flex;
  flex-direction: row;
  gap: clamp(1rem, 2vw, 2rem);
  width: 100%;
  height: 100vh; /* Full height */
  padding: 2rem clamp(1rem, 4vw, 4rem);
  overflow: hidden;
}

.panel {
  background: #fff;
  padding: 2.5rem 2rem;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

.panel::-webkit-scrollbar {
  width: 8px;
}
.panel::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}

.filelist-panel {
  flex: 1 1 20%;
  min-width: 240px;
  max-width: 320px;
}

.panel:nth-child(2) {
  flex: 2 1 40%;
  min-width: 360px;
}

.preview-panel {
  flex: 3 1 40%;
  min-width: 400px;
  max-width: 100%;
  overflow: hidden;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 2rem;
  color: #0d6efd;
}

.preview-panel h2,
#previewContainer h2 {
  font-size: 1.25rem;
  color: #0d6efd;
  margin-bottom: 1rem;
  position: sticky;
  top: 0;
  background-color: #fff;
  z-index: 1;
  padding-top: 1rem;
}

input[type="file"] {
  width: 100%;
  font-size: 1rem;
  margin-bottom: 2rem;
  min-height: 44px;
}

input[type="file"]::-webkit-file-upload-button {
  visibility: visible;
  color: #007bff;
  font-weight: bold;
}

#fileNameList {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #333;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

#fileNameList li {
  margin-bottom: 0.65rem;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
}

.dropdown-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.dropdown-row label {
  font-weight: 600;
  white-space: nowrap;
}

.dropdown-row select {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: #fff;
}

.combo-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.combo-field select {
  flex: 1;
}

.combo-field input[type="checkbox"] {
  width: auto;
}

.checkbox-label {
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  gap: 0.35rem;
  white-space: nowrap;
  user-select: none;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

button {
  padding: 0.9rem 1.75rem;
  font-size: 1.05rem;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

button:hover {
  background-color: #0056b3;
}

.preview-panel pre {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 2rem;
  width: 100%;
}

#csvPreviewTable {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  background-color: #fff;
  border-radius: 8px;
}

#csvPreviewTable th,
#csvPreviewTable td {
  padding: 0.85rem 1rem;
  border: 1px solid #e0e0e0;
  font-size: 0.95rem;
  text-align: left;
}

#csvPreviewTable th {
  background-color: #f1f3f6;
  font-weight: bold;
  text-transform: capitalize;
}

#csvPreviewTable tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

#csvPreviewTable tbody tr:hover {
  background-color: #eef3fb;
}

.hidden {
  display: none;
}

@media (max-width: 1000px) {
  .wrapper {
    flex-direction: column;
    height: auto;
  }

  .panel {
    width: 100%;
    height: auto;
    max-height: none;
  }
}
