/* Reset & base */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1e1e2f;
  color: #f0f0f0;
  margin: 0;
  padding: 20px 20px 60px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

/* Container */
.container {
  background: #2a2a40;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 1000px;
  display: flex;
  gap: 30px;
  padding: 30px 35px;
  align-items: flex-start;
}

/* Panels */
.left, .right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

h2 {
  margin: 0 0 24px 0;
  font-weight: 700;
  font-size: 22px;
  text-align: center;
}

label {
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
  font-size: 14px;
}

/* Drag & Drop area styling */
.drop-area {
  border: 2px dashed #4caf50;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  border-radius: 12px;
  background: #161627;
  color: #bbb;
  margin-bottom: 15px;
  user-select: none;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.drop-area:focus {
  outline: none;
  box-shadow: 0 0 10px #4caf50;
}

.drop-area.dragover {
  background-color: #26324a;
  border-color: #6cf;
}

.drop-area p {
  margin: 8px 0;
  font-size: 16px;
}

.row {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

.row > div {
  flex: 1;
}

/* Browse button inside drop area */
.button.small-btn {
  background-color: #4caf50;
  color: white;
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  vertical-align: middle;
  user-select: none;
}

.button.small-btn:hover {
  background-color: #45a049;
}

/* File name display */
.file-name {
  font-family: monospace;
  color: #aaa;
  font-size: 14px;
  user-select: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Inputs */
input[type="number"],
input[type="range"] {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  background: #3a3a50;
  color: #fff;
  font-size: 14px;
  font-family: monospace;
  transition: background-color 0.2s ease;
  margin-bottom: 15px;
}

input[type="number"]:focus,
input[type="range"]:focus {
  outline: none;
  background-color: #4a4a6a;
  box-shadow: 0 0 5px #6cf;
}

.quality-value {
  text-align: right;
  margin-top: -12px;
  margin-bottom: 15px;
  color: #bbb;
  font-family: monospace;
}

/* Buttons */
button {
  margin-top: 16px;
  padding: 12px 0;
  background-color: #4caf50;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s ease;
  width: 100%;
}

button:hover:not(:disabled) {
  background-color: #45a049;
}

button:disabled {
  background-color: #555a5f;
  cursor: not-allowed;
}

/* Before/After preview box */
.compare-box {
  position: relative;
  width: 100%;
  height: 350px;
  background: #161627;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #444;
  user-select: none;
  outline: none;
}

.compare-box img {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* Compressed image overlay width controlled */
.compare-overlay {
  width: 50%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  border-right: 2px solid #4caf50;
}

.compare-overlay img {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* Draggable vertical divider */
.compare-divider {
  width: 4px;
  background: #4caf50;
  height: 100%;
  position: absolute;
  top: 0;
  left: 50%;
  cursor: ew-resize;
  border-radius: 2px;
  user-select: none;
  z-index: 10;
}

/* Size info */
#sizeInfo {
  margin-top: 12px;
  text-align: center;
  color: #bbb;
  font-size: 14px;
  min-height: 24px;
}

/* Buttons below preview */
.preview-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.preview-buttons button {
  flex: 1;
  padding: 12px 0;
  max-width: 180px;
}

/* Footer */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 14px;
  color: #888;
  background: #1e1e2f;
  padding: 10px 0;
  border-top: 1px solid #333;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

footer a {
  text-decoration: none;
  color: #fdb167;
}

footer a:hover {
  color: gold;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    padding: 20px;
    gap: 20px;
  }
  .left, .right {
    width: 100%;
  }
}
