/* PDF Rotate Tool Styles */

#app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
}

#app-container h1 {
  margin-bottom: 10px;
}

#app-container > p {
  color: #666;
  margin-bottom: 20px;
}

/* Dropzone styles */
.dropzone {
  border: 2px dashed #ccc;
  border-radius: 12px;
  padding: 40px 20px;
  margin: 20px auto;
  max-width: 400px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: #007bff;
  background: #f0f7ff;
}

.dropzone.dragover {
  transform: scale(1.02);
}

.dropzone-content {
  text-align: center;
  pointer-events: none;
}

.dropzone-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.dropzone-text {
  font-size: 16px;
  color: #333;
  margin: 0 0 5px 0;
  font-weight: 500;
}

.dropzone-subtext {
  font-size: 14px;
  color: #888;
  margin: 0;
}

.dropzone input[type="file"] {
  display: none;
}

/* File info display */
.file-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 15px auto;
  padding: 10px 15px;
  background: #e8f5e9;
  border-radius: 8px;
  max-width: 300px;
}

.file-name {
  font-size: 14px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.file-remove {
  background: none;
  border: none;
  color: #666;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.file-remove:hover {
  background: #ffebee;
  color: #d32f2f;
}

#controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  margin: 20px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

/* Rotation buttons row */
.rotation-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.rotate-btn {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border: 2px solid #007bff;
  background: #007bff;
  color: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
}

.rotate-btn:hover:not(:disabled) {
  background: #0056b3;
  border-color: #0056b3;
  transform: translateY(-1px);
}

.rotate-btn:disabled {
  background: #ccc;
  border-color: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.rotate-btn:active:not(:disabled) {
  transform: translateY(0);
}

/* Selection buttons row */
.selection-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.control {
  padding: 10px 20px;
  font-size: 14px;
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.control:hover {
  background: #5a6268;
}

/* Page preview grid - centered with max columns */
#page-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 150px);
  justify-content: center;
  gap: 15px;
  margin: 20px 0;
  padding: 15px;
  min-height: 50px;
}

.page-thumbnail {
  position: relative;
  border: 3px solid #ddd;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  width: 150px;
}

.page-thumbnail:hover {
  border-color: #007bff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.page-thumbnail.selected {
  border-color: #28a745;
  background: #e8f5e9;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3);
}

.page-thumbnail canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.page-label {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
}

.select-checkmark {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: #28a745;
  color: white;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 1;
}

.page-thumbnail.selected .select-checkmark {
  display: flex;
}

/* Download section */
#download-section {
  margin: 20px 0;
  text-align: center;
}

#download-button {
  padding: 15px 40px;
  font-size: 18px;
  font-weight: bold;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

#download-button:hover {
  background: #218838;
}

/* Loading and error states */
.loading-message,
.error-message {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  font-size: 16px;
  color: #666;
  grid-column: 1 / -1;
}

.error-message {
  color: #dc3545;
  background: #f8d7da;
  border-radius: 8px;
}

/* Focus states for accessibility */
.rotate-btn:focus,
.control:focus,
#download-button:focus {
  outline: 3px solid #007bff;
  outline-offset: 2px;
}

.page-thumbnail:focus {
  outline: 3px solid #007bff;
  outline-offset: 2px;
}

#file-input:focus {
  outline: 3px solid #007bff;
  outline-offset: 2px;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  /* Smaller tagline on mobile */
  .tagline {
    font-size: 14px !important;
    padding: 0 10px;
  }
  
  .dropzone {
    padding: 30px 15px;
    margin: 15px;
  }
  
  .dropzone-icon {
    font-size: 36px;
  }
  
  .dropzone-text {
    font-size: 15px;
  }
  
  #controls {
    gap: 10px;
  }
  
  .rotation-buttons {
    width: 100%;
    flex-wrap: nowrap;
  }
  
  .rotate-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 8px;
    font-size: 14px;
  }
  
  .selection-buttons {
    width: 100%;
    flex-wrap: nowrap;
  }
  
  .selection-buttons .control {
    flex: 1;
    min-width: 0;
    padding: 10px 6px;
    font-size: 13px;
  }
  
  #page-preview-grid {
    grid-template-columns: repeat(auto-fit, 140px);
    gap: 10px;
  }
  
  .page-thumbnail {
    width: 140px;
  }
  
  #download-button {
    width: 100%;
    padding: 15px 20px;
  }
}