/* ======================================================================
   CSS for PDF Image Extractor Tool
   Does NOT style the upload area (.upload-area and its children)
   ====================================================================== */

/* -------- Container -------- */
.tool-wrapper {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  color: #1e293b;
}

/* -------- Error & Quota messages -------- */
.error-message {
  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;
}

.quota-message {
  display: none;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin: 1.5rem 0;
}
.quota-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.quota-icon svg {
  display: block;
}
.quota-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0369a1;
}
.quota-timer {
  font-size: 0.95rem;
  color: #0c4a6e;
  margin-top: 0.25rem;
}

/* -------- Editor Layout (hidden by default) -------- */
.editor-layout.hidden {
  display: none;
}
.editor-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

/* -------- Preview Box (gallery) -------- */
.preview-box {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid #e9edf2;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-bottom: 1px solid #e9edf2;
}
.preview-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: #0f172a;
}
.download-all-btn {
  background: #0067b8;
  color: #fff;
  border: none;
  padding: 0.45rem 1.2rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: background 0.2s;
}
.download-all-btn:hover {
  background: #005499;
}
.download-all-btn i {
  font-size: 0.95rem;
}

/* Gallery container */
.preview-canvas-wrap {
  flex: 1;
  padding: 1.5rem;
  min-height: 280px;
  background: #fafbfc;
}

.gallery-placeholder {
  text-align: center;
  color: #94a3b8;
  font-size: 0.95rem;
  padding: 3rem 1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
}
.gallery-grid[style*="display: none"] {
  display: none !important;
}

/* Gallery item */
.gallery-item {
  background: #ffffff;
  border-radius: 0.75rem;
  border: 1px solid #e9edf2;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.1s;
  display: flex;
  flex-direction: column;
}
.gallery-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.image-thumb {
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.thumb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.image-info {
  padding: 0.6rem 0.75rem 0.25rem;
  font-size: 0.8rem;
}
.image-name {
  display: block;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.image-size {
  display: block;
  color: #64748b;
  font-size: 0.7rem;
}

.image-actions {
  padding: 0.5rem 0.75rem 0.75rem;
}
.btn-download-single {
  background: transparent;
  border: 1px solid #d1d9e6;
  border-radius: 2rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: #1e293b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s, border-color 0.2s;
}
.btn-download-single:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* -------- Right Settings Panel -------- */
.tool-settings {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid #e9edf2;
  padding: 1.5rem 1.5rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.tool-settings.hidden {
  display: none;
}

/* File info box */
.file-box {
  background: #f8fafc;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}
.file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
}
.file-name {
  font-weight: 600;
  color: #0f172a;
  flex: 1;
  min-width: 120px;
}
.file-pages,
.file-size {
  color: #475569;
  font-size: 0.85rem;
  background: #e9edf2;
  padding: 0.15rem 0.7rem;
  border-radius: 1rem;
}

/* Options */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.option-label {
  font-weight: 500;
  font-size: 0.9rem;
  color: #1e293b;
}
.option-group select.form-control {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d9e6;
  border-radius: 0.5rem;
  background: #fff;
  font-size: 0.9rem;
  color: #1e293b;
  outline: none;
  transition: border-color 0.2s;
}
.option-group select.form-control:focus {
  border-color: #0067b8;
  box-shadow: 0 0 0 3px rgba(0, 103, 184, 0.15);
}
.option-group input[type="range"] {
  width: 100%;
  margin: 0.2rem 0;
  accent-color: #0067b8;
}
.option-group span[data-role="quality-value"] {
  font-weight: 600;
  color: #0067b8;
  font-size: 0.9rem;
}

/* Action buttons */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.action-btn,
.btn-secondary {
  padding: 0.6rem 1.5rem;
  border-radius: 2rem;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.action-btn {
  background: #0067b8;
  color: #fff;
  flex: 1 1 auto;
}
.action-btn:hover {
  background: #005499;
}
.action-btn:active {
  transform: scale(0.97);
}
.btn-secondary {
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #d1d9e6;
}
.btn-secondary:hover {
  background: #e2e8f0;
}

/* -------- Processing Overlay -------- */
.processing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.processing-overlay[style*="display: none"] {
  display: none !important;
}
.processing-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.processing-text {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 500;
  margin-top: 1.5rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* -------- Responsive -------- */
@media (max-width: 768px) {
  .editor-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .preview-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .download-all-btn {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .action-buttons {
    flex-direction: column;
  }
  .action-btn,
  .btn-secondary {
    justify-content: center;
  }
  .tool-settings {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
  }
  .file-row {
    flex-direction: column;
    align-items: flex-start;
  }
}