* {
  box-sizing: border-box; /* Apply border-box to all elements for consistent layout */
}

html,
body {
  height: 100%; /* Ensure html and body take full viewport height */
  margin: 0;
  padding: 0;
}

body {
  background: linear-gradient(
    135deg,
    #2c3e50,
    #34495e
  ); /* Dark gradient background */
  color: #ecf0f1; /* Light text color */
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between; /* Distribute space between header, content, and footer */
}

.container {
  display: flex;
  flex-grow: 1; /* Allow container to grow and take available space */
  width: 95%;
  max-width: 1200px; /* Max width for the entire app */
  margin-top: 30px; /* Space from the top header */
  margin-bottom: 30px; /* Space from the footer */
  background-color: rgba(
    0,
    0,
    0,
    0.1
  ); /* Subtle background for the container */
  border-radius: 15px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  overflow: hidden; /* Ensure rounded corners apply to children */
  flex-grow: 1; /* Allow container to grow and take available space */
  min-height: 0; /* Allow flex item to shrink */
}

.main-content {
  flex: 3; /* Takes 3 parts of the available space */
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  border-right: 1px solid rgba(255, 255, 255, 0.1); /* Separator line */
  min-width: 0; /* Allow content to shrink below its intrinsic width */
  overflow-y: auto; /* Allow vertical scrolling for the main content */
}

.sidebar {
  flex: 1; /* Takes 1 part of the available space */
  background-color: rgba(0, 0, 0, 0.3); /* Darker background for sidebar */
  padding: 30px;
  border-left: 1px solid rgba(255, 255, 255, 0.1); /* Separator line */
  display: flex; /* Enable flexbox for vertical alignment */
  flex-direction: column; /* Stack children vertically */
  /* Remove overflow-y from sidebar itself, as the list inside will handle it */
}

.sidebar h2 {
  color: #3498db;
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.5em;
  text-align: center;
  flex-shrink: 0; /* Prevent heading from shrinking */
}

#uploadedFilesList {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1; /* Allow the list to take up available vertical space */
  overflow-y: auto; /* Make the list itself scrollable */
  /* Custom scrollbar for Webkit browsers */
  scrollbar-width: none; /* Firefox */
  scrollbar-color: #3498db #2c3e50; /* Firefox scrollbar thumb and track color */
}

#uploadedFilesList::-webkit-scrollbar {
  width: 8px; /* Width of the scrollbar */
}

#uploadedFilesList::-webkit-scrollbar-track {
  background: #2c3e50; /* Color of the scrollbar track */
  border-radius: 10px;
}

#uploadedFilesList::-webkit-scrollbar-thumb {
  background-color: #3498db; /* Color of the scrollbar thumb */
  border-radius: 10px;
  border: 2px solid #2c3e50; /* Padding around the thumb */
}

#uploadedFilesList li {
  background-color: #2c3e50;
  margin-bottom: 10px;
  padding: 10px 15px;
  border-radius: 5px;
  font-size: 0.9em;
  word-wrap: break-word; /* Use word-wrap for better text breaking */
  overflow-wrap: break-word; /* Standard property for word wrapping */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease;
  max-width: 100%; /* Ensure list item does not exceed parent width */
}

#uploadedFilesList li:hover {
  background-color: #34495e;
}

#uploadedFilesList li a {
  color: #ecf0f1;
  text-decoration: none;
}

#uploadedFilesList li a:hover {
  text-decoration: underline;
}

h1 {
  color: #ecf0f1;
  margin-bottom: 30px;
  font-size: 2.5em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.dropzone {
  border: 3px dashed #3498db; /* Blue dashed border */
  border-radius: 15px; /* Rounded corners */
  padding: 4em; /* More padding */
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease-in-out; /* Smooth transitions */
  background-color: rgba(0, 0, 0, 0.2); /* Slightly transparent background */
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4); /* Subtle shadow */
  width: 80%; /* Occupy more width */
  max-width: 700px; /* Max width for larger screens */
  margin-bottom: 30px;
}

.dropzone.dragover {
  background-color: rgba(52, 152, 219, 0.3); /* Lighter blue on drag over */
  border-color: #2980b9; /* Darker blue border */
  transform: scale(1.02); /* Slightly enlarge on drag over */
}

.dropzone p {
  font-size: 1.2em;
  color: #bdc3c7;
}

#fileInput {
  display: none; /* Hide the default file input */
}

#queue {
  width: 80%;
  max-width: 700px;
  margin-top: 20px;
  max-height: 40vh; /* Set a max height for the queue */
  overflow-y: auto; /* Allow the queue to scroll if it overflows */
  padding-right: 10px; /* Add some padding for the scrollbar */
}

.item {
  background-color: #34495e; /* Darker background for items */
  margin: 10px 0;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #4a627a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: background-color 0.3s ease;
}

.item div {
  font-weight: bold;
  color: #ecf0f1;
}

/* Remove old progress styles as they are replaced by progress-container */
.progress {
  display: none;
}
.progress div {
  display: none;
}

.progress-container {
  width: 90%; /* Slightly less than 100% to give some side spacing */
  max-width: 700px; /* Align with queue and dropzone max-width */
  background-color: #2c3e50; /* Darker background for the container */
  border-radius: 10px; /* More rounded corners */
  margin-top: 30px; /* More space from the queue */
  margin-bottom: 30px; /* Space below the progress bar */
  overflow: hidden;
  display: none; /* Hidden by default, shown when upload starts */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4); /* Modern shadow */
  padding: 5px; /* Inner padding for the container */
  position: relative; /* For positioning the text */
}

.progress-bar {
  height: 30px; /* Taller bar */
  width: 0%;
  background-color: #27ae60; /* A slightly darker, more modern green */
  background-image: linear-gradient(
    to right,
    #2ecc71,
    #27ae60
  ); /* Gradient for depth */
  text-align: center;
  line-height: 30px; /* Center text vertically */
  color: white;
  border-radius: 8px; /* Rounded corners for the bar itself */
  transition: width 0.4s ease-out; /* Smoother transition */
  font-weight: bold;
  font-size: 1.1em;
  position: relative;
  z-index: 1; /* Ensure bar is behind text if text is absolute */
}

.progress-text {
  position: absolute;
  width: calc(100% - 10px); /* Account for container padding */
  height: 30px; /* Match bar height */
  top: 5px; /* Align with container padding */
  left: 5px; /* Align with container padding */
  text-align: center;
  line-height: 30px;
  color: #ecf0f1; /* Light text color */
  font-weight: bold;
  font-size: 1.1em;
  z-index: 2; /* Ensure text is above the bar */
  pointer-events: none; /* Allow clicks to pass through text to elements below */
}

.message {
  margin-top: 10px;
  padding: 10px;
  border-radius: 5px;
  text-align: center;
  font-weight: bold;
  display: none; /* Hidden by default */
}

.message.success {
  background-color: #4caf50;
  color: white;
}

.message.error {
  background-color: #f44336;
  color: white;
}

.message.info {
  background-color: #3498db;
  color: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    flex-direction: column; /* Stack main content and sidebar vertically */
    margin-top: 20px;
    margin-bottom: 20px;
    height: auto; /* Allow container to adjust height based on content */
    overflow-y: visible; /* Allow container to scroll if content overflows on mobile */
  }

  .main-content {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Separator for stacked layout */
    padding-bottom: 20px;
    flex: none; /* Remove flex-grow for main-content on mobile */
    width: 100%; /* Ensure main-content takes full width */
  }

  .sidebar {
    border-left: none;
    padding-top: 20px;
    flex: none; /* Remove flex-grow for sidebar on mobile */
    width: 100%; /* Ensure sidebar takes full width */
    height: 40vh; /* Set a responsive height for the sidebar on mobile */
    overflow-y: auto; /* Enable vertical scrolling for the sidebar on mobile */
  }

  h1 {
    font-size: 2em;
    margin-bottom: 20px;
    text-align: center;
  }

  .dropzone {
    padding: 2em;
    width: 90%;
    margin-bottom: 20px;
  }

  .dropzone p {
    font-size: 1em;
  }

  #queue {
    width: 90%;
  }

  .item {
    padding: 10px;
    font-size: 0.9em;
  }

  .progress-bar {
    height: 20px;
    line-height: 20px;
  }

  .progress-text {
    line-height: 20px;
  }

  .message {
    padding: 8px;
    font-size: 0.9em;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.8em;
  }

  .dropzone {
    padding: 1.5em;
  }

  .dropzone p {
    font-size: 0.9em;
  }

  .item {
    flex-direction: column;
    align-items: flex-start;
  }

  .item div {
    margin-bottom: 5px;
  }
}

footer {
  margin-top: 40px;
  color: #bdc3c7;
  font-size: 0.9em;
  text-align: center;
}
