@import url('https://fonts.googleapis.com/css2?family=Nova+Flat&display=swap');

* {
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
  margin: 0;
  padding: 1rem;
  background: #16213e;
  color: #fff;
  overflow-x: hidden; /* Prevent horizontal scroll for footer */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
}

.instructions {
  max-width: 800px;
  margin: 0 auto 1rem;
  background: #fff3cd;
  color: #856404;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid #ffeeba;
  font-size: .95rem;
  line-height: 1.4;
}

.container {
  display: flex;
  gap: 1rem;
  max-width: 1100px;
  margin: auto;
  flex-wrap: wrap;
  color: #222;
  flex-grow: 1; /* So container takes available space pushing footer down */
  margin-bottom: 40px; /* Added 40px space below container */
}

.left, .right {
  flex: 1 1 400px;
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 0 5px rgba(0,0,0,.1);
  display: flex;
  flex-direction: column;
}

canvas {
  width: 100%;
  max-height: 500px;
  border: 1px solid #ccc;
  background: #eee;
  flex-grow: 1;
  border-radius: 6px;
}

#fileInput {
  display: none;
}

.drop-zone {
  border: 3px dashed #007acc;
  border-radius: 12px;
  padding: 2rem;
  margin-top: 1rem;
  text-align: center;
  background: #e3f2fd;
  color: #005fa3;
  font-weight: 700;
  font-size: 1.2rem;
  cursor: pointer;
  user-select: none;
  transition: background-color .3s ease, border-color .3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border-style: dashed;
  outline-offset: 4px;
  outline-color: transparent;
  outline-style: solid;
  outline-width: 2px;
}

.drop-zone:hover, .drop-zone:focus {
  background: #bbdefb;
  border-color: #004a8c;
  outline-color: #004a8c;
  outline-style: solid;
  outline-width: 2px;
}

.drop-zone.dragover {
  background: #90caf9;
  border-color: #003f72;
  outline-color: #003f72;
  outline-style: solid;
  outline-width: 2px;
}

.file-list {
  margin-top: .5rem;
  max-height: 180px;
  overflow-y: auto;
  background: #fafafa;
  border: 1px solid #ddd;
  padding: .5rem;
  border-radius: 5px;
  flex-shrink: 0;
}

.file-item {
  padding: .3rem 0;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: .4rem;
  user-select: none;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item.selected {
  background: #d0f0ff;
}

.file-name-display {
  flex-grow: 1;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-rename-input {
  flex-grow: 1;
  padding: .15rem .35rem;
  border: 1px solid #007acc;
  border-radius: 4px;
  font-size: .95rem;
  display: none;
}

.edit-icon {
  color: #007acc;
  font-size: 1rem;
  user-select: none;
  cursor: pointer;
}

.edit-icon.disabled {
  color: #aaa;
  cursor: not-allowed;
}

.controls {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.control-group {
  flex: 1 1 45%;
  display: flex;
  flex-direction: column;
}

.control-group.full-width {
  flex: 1 1 100%;
}

.controls label {
  font-weight: 600;
  margin-bottom: .3rem;
  user-select: none;
}

.controls input[type='number'], .controls input[type='text'], .controls select, .controls input[type='range'] {
  padding: .4rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.controls input[type='checkbox'] {
  margin-right: .5rem;
  transform: scale(1.2);
  vertical-align: middle;
  cursor: pointer;
}

.controls span#qualityValue {
  margin-top: .2rem;
  font-weight: 600;
  color: #444;
  user-select: none;
}

.button-row {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.button-row button {
  flex: 1 1 50%;
  padding: .6rem 1rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s ease;
}

#downloadBtn {
  background: #007acc;
  color: white;
}

#downloadBtn:disabled {
  background: #888;
  cursor: not-allowed;
}

#resetBtn {
  background: #dc3545;
  color: white;
}

#resetBtn:hover {
  background: #b02a37;
}

#downloadBtn:hover:enabled {
  background: #005fa3;
}

.spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
  margin-right: 6px;
  font-size: 18px;
  user-select: none;
}

.tick {
  display: inline-block;
  background: #28a745;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  text-align: center;
  font-size: 14px;
  line-height: 20px;
  margin-right: 6px;
  user-select: none;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }

  .controls {
    gap: .8rem;
  }

  .control-group {
    flex: 1 1 100%;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row button {
    flex: 1 1 100%;
  }

  canvas {
    max-height: 350px;
  }
}

/* Footer styles */


/* Updated: */
footer {
  background: #1a1a2e;
  border-top: 1px solid #3a3a5e;
  margin-top: auto;
  border-radius: 0 !important;
  user-select: none;
  flex-shrink: 0;
  padding: 1rem 0;
  margin: 0 -30px -20px;
}

@media (max-width: 1110px) {
  footer {
    padding-left: 15px;
    padding-right: 15px;
  }
}

.footer-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .9rem;
  color: #333;
}

footer a {
  color: #0dcaf0;
  text-decoration: none;
  transition: color .3s ease;
  white-space: nowrap;
}

footer a:hover, footer a:focus {
  text-decoration: none;
}

.footer-left {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-start;
}

.footer-right {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
  gap: 1.5rem;
}

@media (max-width: 500px) {
  .footer-content {
    flex-direction: column;
    gap: .75rem;
    font-size: .85rem;
    text-align: center;
    padding: 0 1rem;
  }

  .footer-left, .footer-right {
    justify-content: center !important;
    flex: none;
  }

  .footer-right {
    gap: 1rem;
  }
}

/*  */










header {
  background: #1a1a2e;
  border-bottom: 1px solid #3a3a5e;
  padding: 12px 24px;
  text-align: center;
  margin-top: -15px;
  margin-left: -30px;
  margin-right: -30px;
}

@media (max-width: 1110px) {
  header {
    padding-left: 15px;
    padding-right: 15px;
  }
}

@media (max-width: 500px) {
  .nbsp-hide {
    display: none;
  }
}

header a {
  font-family: 'Nova Flat', cursive;
  font-size: 22px;
  color: #ffd700;
  text-decoration: none;
}

p {
  text-align: center;
}
