/* ======================================================================
   CSS for PDF Pages Extractor Tool
   Same design spirit as the Images Extractor (clean, modern, blue accent)
   ====================================================================== */



/* -------- Error Message -------- */
.error-message[data-tool-status="error"] {
  display: none;
  background: #fef2f2;
  border-left: 4px solid #dc2626;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin: 1rem 0;
  color: #991b1b;
  font-size: 0.95rem;
  font-weight: 500;
}

/* -------- Extraction Controls (Main Card) -------- */
.extraction-controls {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid #e9edf2;
  padding: 1.5rem 2rem;
  margin-top: 1.5rem;
  display: block; /* overrides inline style if any, but kept for toggle */
}

/* Controls Header */
.controls-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e9edf2;
  margin-bottom: 1.5rem;
}
.controls-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: #0f172a;
}
.file-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f1f5f9;
  padding: 0.3rem 0.8rem 0.3rem 0.8rem;
  border-radius: 2rem;
  font-size: 0.85rem;
  color: #1e293b;
}
.file-info i {
  color: #0067b8;
}
.file-name {
  font-weight: 500;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.change-file {
  color: #0067b8;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.25rem;
  text-decoration: underline dotted;
  transition: color 0.2s;
}
.change-file:hover {
  color: #005499;
}

/* Selection Options Grid */
.selection-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 600px) {
  .selection-options {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.option-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e293b;
}

/* Radio Group / Chip Style */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f8fafc;
  border: 1px solid #e9edf2;
  padding: 0.35rem 1rem;
  border-radius: 2rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  color: #475569;
}
.radio-option:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.radio-option input[type="radio"] {
  accent-color: #0067b8;
  width: 1rem;
  height: 1rem;
  margin: 0;
}
.radio-option:has(input:checked) {
  background: #e0f2fe;
  border-color: #0067b8;
  color: #0f172a;
  box-shadow: 0 0 0 1px #0067b8;
}

/* Range Controls */
.range-controls {
  background: #f8fafc;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  border: 1px solid #e9edf2;
}
.range-controls label {
  font-weight: 500;
  font-size: 0.9rem;
  color: #1e293b;
  margin-right: 0.25rem;
}
.range-controls input[type="number"] {
  width: 80px;
  padding: 0.4rem 0.6rem;
  border: 1px solid #d1d9e6;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  text-align: center;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.range-controls input[type="number"]:focus {
  border-color: #0067b8;
  box-shadow: 0 0 0 3px rgba(0, 103, 184, 0.15);
  outline: none;
}
.range-values {
  display: flex;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #64748b;
  background: #ffffff;
  padding: 0.2rem 0.8rem;
  border-radius: 1rem;
  border: 1px solid #e9edf2;
}
.range-values span {
  font-weight: 600;
  color: #0f172a;
}

/* Custom Controls */
.custom-controls {
  margin-bottom: 1.5rem;
}
.custom-controls label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  color: #1e293b;
  margin-bottom: 0.4rem;
}
.custom-controls input[type="text"] {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid #d1d9e6;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.custom-controls input[type="text"]:focus {
  border-color: #0067b8;
  box-shadow: 0 0 0 3px rgba(0, 103, 184, 0.12);
  outline: none;
}
.custom-controls input[type="text"]::placeholder {
  color: #94a3b8;
}

/* Action Buttons inside controls */
.extraction-controls .action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e9edf2;
}
.btn {
  padding: 0.6rem 1.8rem;
  border-radius: 2rem;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: #0067b8;
  color: #ffffff;
}
.btn-primary:hover {
  background: #005499;
  box-shadow: 0 4px 12px rgba(0, 103, 184, 0.25);
}
.btn-secondary {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #d1d9e6;
}
.btn-secondary:hover {
  background: #e2e8f0;
}

/* -------- Results Section -------- */
.results-section {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid #e9edf2;
  padding: 1.5rem 2rem;
  margin-top: 1.5rem;
}

.results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e9edf2;
  margin-bottom: 1.25rem;
}
.results-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #0f172a;
}
.results-header .action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.results-header .btn {
  padding: 0.4rem 1.2rem;
  font-size: 0.85rem;
}

.selected-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  min-height: 80px;
}

/* Placeholder for when there are no results yet (optional) */
.selected-pages:empty::after {
  content: 'No pages extracted yet.';
  color: #94a3b8;
  font-size: 0.95rem;
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 0;
}

/* -------- Toast Notification -------- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.8rem 1.6rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  z-index: 9999;
  pointer-events: none;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.toast.success {
  background: #065f46;
}
.toast.error {
  background: #991b1b;
}

/* -------- Utility & Responsiveness -------- */
@media (max-width: 768px) {
  .extraction-controls {
    padding: 1rem 1.25rem;
  }
  .controls-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .file-info {
    width: 100%;
    justify-content: space-between;
  }
  .file-name {
    max-width: 120px;
  }
  .range-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }
  .range-controls input[type="number"] {
    width: 100%;
  }
  .range-values {
    justify-content: center;
  }
  .extraction-controls .action-buttons {
    flex-direction: column;
  }
  .extraction-controls .action-buttons .btn {
    justify-content: center;
  }
  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .results-header .action-buttons {
    width: 100%;
  }
  .results-header .action-buttons .btn {
    flex: 1;
    justify-content: center;
  }
  .toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    text-align: center;
  }
}

  .selected-pages {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  .radio-group {
    gap: 0.4rem;
  }
  .radio-option {
    font-size: 0.8rem;
    padding: 0.25rem 0.8rem;
  }
}