body, html {
  height: 100%;
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background-color: #f8fafc;
  color: #334155;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

h1, h2, h3, h4, h5, h6 {
  color: #1e293b;
}

a {
  color: #3b82f6;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.btn:hover {
  background-color: #2563eb;
  text-decoration: none;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.alert {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
}

.alert-error {
  background-color: #fee2e2;
  color: #991b1b;
}

.navbar {
  background-color: #3b82f6;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  width: 100%;
  box-sizing: border-box;
  z-index: 1000;
}

.hamburger {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  z-index: 1002;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: white;
  transition: all 0.3s ease;
}

#sign-out-button {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.4rem 0.8rem;
  font-size: 14px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

#sign-out-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.navbar-links {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(59, 130, 246, 0.95);
  z-index: 1001;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.navbar-links.active {
  display: flex;
}

.navbar a,
.navbar-links a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s;
  font-size: 18px;
  border: none;
  cursor: pointer;
  background: none;
}

.navbar-links a {
  margin: 0.5rem 0;
  font-size: 20px;
}

.navbar a:hover,
.navbar-links a:hover,
#sign-out-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.custom-alert {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 10px 20px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  font-size: 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: 800px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 0.75rem;
}

label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: #475569;
  font-size: 0.9rem;
}

.info-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-color: #3b82f6;
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 16px;
  font-size: 12px;
  margin-left: 5px;
  cursor: help;
}

.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 200px;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.8rem;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

.advanced-settings {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  background-color: #f1f5f9;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.advanced-settings-toggle {
  cursor: pointer;
  color: #3b82f6;
  font-weight: 500;
  text-align: center;
  margin-bottom: 1rem;
}

#save-button {
  background-color: #3b82f6;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  width: 100%;
  margin-top: 1rem;
}

#save-button:hover {
  background-color: #2563eb;
}

.prompt-selector-container {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 15px;
}

#prompt-selector {
  flex-grow: 1;
}

.prompt-action-btn {
  padding: 8px 12px;
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
  margin: 0;
}

.prompt-action-btn:hover {
  background-color: #e0e0e0;
}

#prompt-name-container {
  margin-bottom: 15px;
}

#prompt-name-container label {
  display: block;
  margin-bottom: 5px;
}

#prompt-name {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

#prompt-selector,
.prompt-action-btn {
  height: 38px;
  box-sizing: border-box;
}

#prompt-textarea {
  width: 100%;
  height: 200px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  resize: vertical;
  font-weight: normal;
  box-sizing: border-box;
}

.variable-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.variable-btn {
  background-color: #e2e8f0;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

.variable-btn:hover {
  background-color: #cbd5e1;
}

.custom-dialog {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
}

.custom-dialog-content {
  background-color: #fefefe;
  padding: 20px;
  border-radius: 5px;
  width: 300px;
  max-width: 80%;
}

.custom-dialog-buttons {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.custom-dialog-buttons button {
  margin-left: 10px;
  padding: 5px 10px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

#custom-dialog-confirm {
  background-color: #3b82f6;
  color: white;
}

#custom-dialog-cancel {
  background-color: #ef4444;
  color: white;
}

.custom-action-buttons {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
}

.custom-action-buttons h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #4a5568;
  font-size: 0.9rem;
}

.custom-action-buttons p {
  margin-bottom: 0.5rem;
  color: #718096;
  font-size: 0.8rem;
}

.custom-action-btn {
  background-color: #edf2f7;
  color: #4a5568;
  font-weight: 500;
}

.custom-action-btn:hover {
  background-color: #e2e8f0;
}

/* Styles for the data page */
.table-container {
  flex-grow: 1;
  overflow: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  background-color: white;
  visibility: hidden;
  position: relative;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  position: relative;
}

th {
  background-color: #f1f5f9;
  font-weight: 600;
  color: #475569;
  position: sticky;
  top: 0;
  z-index: 10;
  cursor: pointer;
}

th:hover {
  background-color: #e2e8f0;
}

th::after {
  content: '\25B4';
  padding-left: 5px;
  opacity: 0.5;
}

th.sorted-asc::after {
  content: '\25B4';
  opacity: 1;
}

th.sorted-desc::after {
  content: '\25BE';
  opacity: 1;
}

tr:last-child td {
  border-bottom: none;
}

tr:nth-child(even) {
  background-color: #f8fafc;
}

.cell-content {
  position: relative;
  cursor: pointer;
}

.cell-content-hover {
  display: none;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 12px;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 80%;
  max-height: 80%;
  width: auto;
  overflow-y: auto;
  font-size: 14px;
  color: #334155;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.cell-content-hover .close-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #64748b;
}

#filter-container {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  flex-grow: 1;
}

#column-filter,
#filter-value,
#date-filter-select,
.date-filter input[type="date"] {
  height: 38px;
  box-sizing: border-box;
  padding: 0.25rem 0.5rem;
  font-size: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  align-self: stretch;
}

.date-filter {
  display: flex;
  align-items: stretch;
}

#custom-date-range {
  display: flex;
  gap: 0.5rem;
}

#column-filter {
  width: 150px;
  flex-shrink: 0;
}

#filter-value {
  flex-grow: 1;
  min-width: 150px;
}

#date-filter-select {
  width: 150px;
  flex-shrink: 0;
}

/* Styles for login page */
.login-container {
  background-color: white;
  padding: 2rem 2.5rem;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  width: 90%;
  max-width: 400px;
}

#login-form {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Styles for upload page */
.welcome-message {
  margin: 1rem 0;
  font-size: 16px;
  color: #64748b;
  font-weight: 500;
  text-align: center;
}

.file-input-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
}

.file-input-wrapper input[type=file] {
  display: none;
}

.file-input-wrapper .btn {
  background-color: #e2e8f0;
  color: #475569;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 0.5rem;
}

.file-input-wrapper .btn:hover {
  background-color: #cbd5e1;
}

.file-name {
  font-size: 13px;
  color: #64748b;
}

#upload-button {
  width: 100%;
  padding: 12px;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
}

#upload-button:hover {
  background-color: #2563eb;
}

#upload-button:disabled {
  background-color: #94a3b8;
  cursor: not-allowed;
}

.requirements {
  font-size: 14px;
  color: #333;
  margin-top: 1rem;
  text-align: center;
}

.requirements summary {
  cursor: pointer;
  color: #3b82f6;
  font-weight: 500;
}

.requirements-content {
  text-align: left;
  display: inline-block;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 1rem;
  margin-top: 0.5rem;
}

.requirements-content section {
  margin-bottom: 1rem;
}

.requirements-content h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #1e293b;
  text-align: center;
}

.requirements-content ul {
  list-style-type: none;
  padding-left: 0;
  margin-bottom: 1rem;
}

.requirements-content li {
  margin-bottom: 0.25rem;
}

.required-columns,
.file-format {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  padding-left: 0;
}

.required-columns li,
.file-format li {
  background-color: #e2e8f0;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin: 0.25rem;
}

.date-formats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding-left: 0;
}

.date-formats li {
  background-color: #e2e8f0;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin: 0.25rem;
}

@media (max-width: 767px) {
  body {
    padding-top: 60px;
  }

  .navbar {
    height: 60px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 1rem;
  }

  h1 {
    font-size: 20px;
  }

  label {
    font-size: 0.9rem;
  }

  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="date"],
  select,
  textarea {
    font-size: 14px;
    height: 38px;
  }

  .info-icon {
    width: 16px;
    height: 16px;
    line-height: 16px;
    font-size: 11px;
  }

  .tooltip .tooltiptext {
    width: 200px;
    font-size: 0.8rem;
  }

  #save-button {
    font-size: 14px;
  }

  #prompt-textarea {
    font-size: 14px;
  }

  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }

  th,
  td {
    padding: 10px 12px;
    font-size: 13px;
  }

  .cell-content-hover {
    max-width: 95%;
    max-height: 95%;
    font-size: 13px;
  }

  .action-btn {
    font-size: 13px;
  }

  .controls-container {
    flex-direction: column;
    align-items: stretch;
  }

  #filter-container {
    flex-wrap: wrap;
  }

  #column-filter,
  #filter-value {
    width: 100%;
  }

  .login-container {
    padding: 1.5rem;
    width: 95%;
  }

  #login-form input[type="text"],
  #login-form input[type="password"] {
    font-size: 14px;
    padding: 0.6rem;
  }

  .file-input-wrapper .btn {
    font-size: 13px;
  }

  .file-name {
    font-size: 12px;
  }

  #upload-button {
    font-size: 15px;
  }

  .settings-page .settings-grid,
  .settings-page .advanced-settings .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  body {
    padding-top: 70px;
  }

  .navbar {
    height: 70px;
  }

  .navbar-links {
    top: 70px;
  }

  #sign-out-button {
    font-size: 15px;
  }
}

@media (min-width: 1024px) {
  body {
    padding-top: 80px;
  }

  .navbar {
    height: 80px;
    padding: 0 2rem;
  }

  .navbar-links {
    top: 80px;
  }

  .hamburger {
    left: 2rem;
  }

  #sign-out-button {
    right: 2rem;
    font-size: 16px;
  }

  #filter-container {
    flex-wrap: nowrap;
  }
}

@media (hover: hover) and (pointer: fine) {
  .cell-content:hover::after,
  th:hover::after {
    content: attr(data-full-content);
    display: block;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 8px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 80%;
    max-height: 80%;
    width: auto;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    color: #334155;
  }
}

th {
  position: relative;
}

th .header-content {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  display: block;
}

/* Ensure consistent spacing below navbar for all pages */
.upload-page .container,
.settings-page .container,
.data-page .container {
  padding-top: 1rem;
}

/* Adjust container padding for smaller screens */
@media (max-width: 767px) {
  .upload-page .container,
  .settings-page .container,
  .data-page .container {
    padding-top: 0.5rem;
  }
}
