body {
  font-family: Arial, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.drop-text {
  text-align: center;
  color: #666;
  padding: 30px;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  pointer-events: none; /* Ensures the drop zone gets the click */
}

.drop-text p {
  margin: 12px 0;
  font-size: 16px;
  line-height: 1.5;
}

.drop-text p:first-child {
  font-size: 20px;
  color: #2196f3;
  font-weight: 500;
}

.drop-text p:nth-child(2) {
  font-style: italic;
}

.drop-text p:last-child {
  font-size: 14px;
  color: #888;
  margin-top: 16px;
}

.subtitle {
  text-align: center;
  color: #666;
  font-size: 1.1em;
  margin: -10px 0 25px;
  font-weight: normal;
  line-height: 1.4;
}

#drop-zone {
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  margin: 20px 0;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: relative;
  background-color: #fafafa;
  transition: all 0.3s ease;
  cursor: pointer;
}

#drop-zone:hover {
  border-color: #2196f3;
  background-color: #f5f9ff;
}

#preview-container {
  position: relative;
  margin: 20px auto;
  max-width: 100%;
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  display: none; /* Hide by default */
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#preview-container.visible {
  display: flex;
}

#text-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Allow clicks to pass through when empty */
}

#text-overlay .text-block {
  pointer-events: auto; /* Re-enable clicks for text blocks */
}

.text-block {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  white-space: nowrap;
  transform-origin: top left;
  border: 1px solid rgba(33, 150, 243, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
}

.text-block:hover {
  background-color: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

#preview-image {
  max-width: 100%;
  max-height: 80vh; /* 80% of viewport height */
  object-fit: contain;
  display: none;
}

#drop-zone.has-image {
  min-height: auto;
}

#drop-zone.dragover {
  background-color: #e3f2fd;
  border-color: #2196f3;
  box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.1);
}

#result {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: none; /* Hide by default */
  flex-direction: column;
  height: 400px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#result.visible {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

#result h3 {
  margin: 0 0 15px 0;
  color: #2196f3;
  font-size: 1.2em;
  flex-shrink: 0;
}

#result-content {
  flex: 1;
  overflow: hidden;
  min-height: 0; /* Required for Firefox */
}

#result ul {
  list-style: none;
  padding: 0 5px 0 0;
  margin: 0;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2196f3 #f0f0f0;
}

/* Webkit scrollbar styling */
#result ul::-webkit-scrollbar {
  width: 8px;
}

#result ul::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

#result ul::-webkit-scrollbar-thumb {
  background-color: #2196f3;
  border-radius: 4px;
  border: 2px solid #f0f0f0;
}

#result ul::-webkit-scrollbar-thumb:hover {
  background-color: #1976d2;
}

#result li {
  padding: 10px;
  margin-bottom: 8px;
  background-color: #f8f9fa;
  border-radius: 4px;
  border-left: 3px solid #2196f3;
  transition: all 0.2s ease;
  cursor: pointer;
}

#result li:hover {
  background-color: #e3f2fd;
  transform: translateX(2px);
}

#result li:last-child {
  margin-bottom: 0;
}

.loading {
  display: none;
  margin: 10px 0;
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

.stats {
  display: none;
  position: fixed;
  top: 60px;
  right: 20px;
  background-color: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  padding: 12px;
  color: white;
  font-family: monospace;
  font-size: 11px;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  min-width: 320px;
  overflow: hidden;
}

.stats.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.stats.collapsed {
  padding: 0;
  height: 0;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0;
  line-height: 1.4;
  white-space: nowrap;
}

.stat-value {
  color: #2196f3;
  margin-left: 12px;
}

.stat-label {
  color: #ccc;
}

.text-block.selected, #result li.selected {
  background-color: rgba(33, 150, 243, 0.15);
  border-color: #1976d2;
}

.copy-all-button {
  background-color: #2196f3;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  min-width: 120px;
  justify-content: center;
}

.copy-all-button::before {
  content: attr(data-tooltip);
  font-size: 12px;
  position: absolute;
  bottom: -30px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.copy-all-button:hover::before {
  opacity: 1;
  visibility: visible;
}

.result-header {
  display: flex;
  align-items: baseline;
  margin-bottom: 15px;
  flex-shrink: 0;
  gap: 15px;
}

.result-header h3 {
  margin: 0;
  line-height: 1;
}

.selection-info {
  color: #666;
  font-size: 0.9em;
  flex-grow: 1;
  line-height: 1;
}

.stats-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  display: inline-flex;
  align-items: center;
  font-size: 0.65em;
  color: rgba(255, 255, 255, 0.8);
  background-color: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  user-select: none;
  transition: all 0.2s ease;
  z-index: 1001;
}

.stats-toggle:hover {
  background-color: rgba(0, 0, 0, 0.8);
  color: #2196f3;
}

h1 {
  text-align: center;
  color: #2196f3;
  margin-bottom: 20px;
  position: relative;
  padding: 0 40px;
}

h1 .title {
  display: inline-block;
  font-size: 1em;
}

.clear-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.8);
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.8em;
  display: none;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  z-index: 10;
}

.clear-button.visible {
  display: inline-flex;
}

.clear-button:hover {
  background-color: rgba(0, 0, 0, 0.8);
  color: #ff5252;
}

.clear-button::before {
  content: "×";
  font-size: 1.2em;
  line-height: 1;
} 