/* =============================================
   COMPONENTS — AcharyaML PDF Tools
   ============================================= */

/* Buttons - Premium Stamp/Print Theme */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600; /* Bolder */
  border: 1.5px solid var(--line-strong); /* Solid outline */
  border-radius: 4px; /* Square-ish */
  cursor: pointer;
  box-shadow: 3px 3px 0px var(--line); /* Offset shadow */
  transition: all 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0px 0px 0px transparent; /* Press down effect */
}

.btn-primary {
  background-color: var(--ink);
  color: var(--bg-page);
  border-color: var(--ink);
  box-shadow: 3px 3px 0px var(--line-strong);
}

.btn-primary:hover {
  background-color: var(--stamp);
  border-color: var(--stamp);
  box-shadow: 3px 3px 0px rgba(163, 53, 43, 0.3); /* Stamp soft color */
  color: #fff;
  transform: translate(-1px, -1px);
}

.btn-secondary, .btn-outline {
  background-color: var(--paper);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-secondary:hover, .btn-outline:hover {
  background-color: rgba(163, 53, 43, 0.05);
  color: var(--stamp);
  border-color: var(--stamp);
  transform: translate(-1px, -1px);
}

.btn-sm {
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-heading);
}

.form-control, .form-select, .form-input, .input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  background-color: var(--bg-card);
  transition: border-color 0.2s;
}

.form-control:focus, .form-select:focus, .form-input:focus, .input:focus {
  outline: none;
  border-color: var(--accent-red);
}

.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mb-2 { margin-bottom: var(--s-2); }

/* Dropzone (Matching reference) */
.dropzone-container {
  border: 2px dashed var(--border-med);
  background-color: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 4rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}

.dropzone-container:hover, .dropzone-container.dragover {
  border-color: var(--text-muted);
  background-color: #FAFAFA;
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.dropzone-title {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.dropzone-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.file-input-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Tool Stage (State Management) */
.stage-view {
  display: none;
}

.stage-view.active {
  display: block;
}

/* Thumbnails */
.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.thumb-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  padding: 0.5rem;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.thumb-item.selected {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 1px var(--accent-red);
}

.thumb-canvas-wrapper {
  aspect-ratio: 1 / 1.414;
  background-color: var(--paper);
  border: 1px solid var(--border-light);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.thumb-canvas-wrapper canvas {
  max-width: 100%;
  max-height: 100%;
}

.thumb-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress / Result */
.progress-card, .result-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  padding: 3rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--text-heading);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }
