/* ============================================================
   INDEX-SPECIFIC STYLES - PDFCraft Home Page
   ============================================================ */

/* -----------------------------------------------------------
   HERO / HOME SCREEN
   ----------------------------------------------------------- */
.home-screen {
  display: block;
}

.tool-screen {
  display: none;
}

.screen.active {
  display: block;
  margin-top: 1rem;
}

.hero {
  text-align: center;
  padding: 40px 0 48px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-muted);
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.hero-eyebrow svg {
  width: 12px;
  height: 12px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 420px;
  margin: 0 auto 8px;
  line-height: 1.6;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--success);
  background: var(--success-light);
  padding: 5px 12px;
  border-radius: 100px;
  margin-top: 16px;
  font-weight: 500;
}

.trust-badge svg {
  width: 13px;
  height: 13px;
}

/* -----------------------------------------------------------
   TOOLS GRID
   ----------------------------------------------------------- */
.tools-section h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
  letter-spacing: .02em;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.tool-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  height: 100%;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}

.tool-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-card:active {
  transform: translateY(0);
}

.tool-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent-muted);
}

.tool-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent);
}

.tool-info h3 {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.tool-info p {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* -----------------------------------------------------------
   TOOL SCREEN
   ----------------------------------------------------------- */
.tool-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.back-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

.tool-header-info h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tool-header-info p {
  font-size: .85rem;
  color: var(--text-secondary);
}

/* -----------------------------------------------------------
   DROPZONE - Page specific overrides
   ----------------------------------------------------------- */
.dropzone-icon {
  width: 64px;
  height: 64px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  border: 1.5px solid var(--border);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.dropzone:hover .dropzone-icon {
  border-color: var(--accent);
}

.dropzone-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--accent);
}

.dropzone-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.dropzone-sub {
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 100px;
  transition: var(--transition);
  pointer-events: none;
}

.dropzone:hover .upload-btn {
  background: var(--accent-hover);
}

/* -----------------------------------------------------------
   FILE LIST / PREVIEW GRID
   ----------------------------------------------------------- */
.preview-section {
  margin-top: 24px;
}

.preview-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.preview-section-header h3 {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.preview-section-header .file-count {
  font-size: .78rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.file-item:hover {
  border-color: var(--border-hover);
}

.drag-handle {
  cursor: grab;
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.drag-handle svg {
  width: 18px;
  height: 18px;
}

.drag-handle:active {
  cursor: grabbing;
}

.file-thumb {
  width: 44px;
  height: 56px;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.file-thumb canvas,
.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-thumb .pdf-icon {
  color: var(--accent);
}

.file-thumb .pdf-icon svg {
  width: 22px;
  height: 22px;
}

.file-meta {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: .87rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.file-size {
  font-size: .75rem;
  color: var(--text-muted);
}

.file-pages {
  font-size: .72rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: 2px;
}

.file-remove {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-muted);
  flex-shrink: 0;
}

.file-remove:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-light);
}

.file-remove svg {
  width: 14px;
  height: 14px;
}

/* -----------------------------------------------------------
   PAGE GRID (REORDER / SPLIT / ROTATE)
   ----------------------------------------------------------- */
.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.page-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: grab;
  transition: var(--transition);
  user-select: none;
  position: relative;
}

.page-card:active {
  cursor: grabbing;
}

.page-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.page-card.sortable-ghost {
  opacity: .4;
}

.page-card.sortable-chosen {
  box-shadow: var(--shadow-lg);
  transform: scale(1.03);
}

.page-canvas-wrap {
  aspect-ratio: 3/4;
  background: var(--bg-secondary);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.page-footer {
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-num {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.page-actions {
  display: flex;
  gap: 4px;
}

.page-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-muted);
  border: 1px solid transparent;
}

.page-action-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.page-action-btn svg {
  width: 12px;
  height: 12px;
}

.page-select-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.page-card.selected .page-select-check {
  border-color: var(--accent);
  background: var(--accent);
}

.page-card.selected .page-select-check::after {
  content: '';
  width: 5px;
  height: 8px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
  display: block;
}

/* -----------------------------------------------------------
   OPTIONS PANEL
   ----------------------------------------------------------- */
.options-panel {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
}

.options-panel h3 {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.option-row:last-child {
  margin-bottom: 0;
}

.option-label {
  font-size: .87rem;
  font-weight: 500;
  color: var(--text-primary);
}

.option-sub {
  font-size: .76rem;
  color: var(--text-muted);
}

.option-controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.pill-btn {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  transition: var(--transition);
}

.pill-btn:hover,
.pill-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* -----------------------------------------------------------
   RANGE / INPUT
   ----------------------------------------------------------- */
input[type="range"] {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border: 2px solid #fff;
}

input[type="number"] {
  width: 70px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: .87rem;
  text-align: center;
  outline: none;
  transition: var(--transition);
}

input[type="number"]:focus {
  border-color: var(--accent);
}

/* -----------------------------------------------------------
   BOTTOM BAR - Page specific additions
   ----------------------------------------------------------- */
.add-more-btn {
  height: 52px;
  width: 52px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.add-more-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.add-more-btn svg {
  width: 22px;
  height: 22px;
}

/* -----------------------------------------------------------
   TOAST - Page specific overrides
   ----------------------------------------------------------- */
.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--error);
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-msg {
  font-size: .78rem;
  color: var(--text-secondary);
}

/* -----------------------------------------------------------
   RESULT BANNER - Page specific overrides
   ----------------------------------------------------------- */
.result-icon svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
}

/* -----------------------------------------------------------
   ROTATE CONTROLS
   ----------------------------------------------------------- */
.rotate-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}

.toolbar-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.toolbar-btn svg {
  width: 15px;
  height: 15px;
}

/* -----------------------------------------------------------
   EMPTY STATE
   ----------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  display: block;
}

.empty-state p {
  font-size: .88rem;
}

/* -----------------------------------------------------------
   SPLIT OPTIONS
   ----------------------------------------------------------- */
.split-info {
  font-size: .82rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
  border: 1px solid var(--border);
}

.split-selected-count {
  font-weight: 600;
  color: var(--accent);
}

/* -----------------------------------------------------------
   OUTPUT FORMAT TOGGLE
   ----------------------------------------------------------- */
.format-group {
  display: flex;
  gap: 6px;
}

.format-btn {
  padding: 7px 16px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  font-size: .82rem;
  font-weight: 500;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: var(--transition);
}

.format-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

/* -----------------------------------------------------------
   RESPONSIVE - Page specific
   ----------------------------------------------------------- */
@media (max-width: 600px) {
  .hero {
    padding: 24px 0 36px;
  }

  .tools-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .tool-card {
    padding: 18px 14px;
  }

  .page-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
  }
}

@media (max-width: 360px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
}