/* Toolswa - Dedicated Tool Page Styles
   Used across all 8 tools for unified iLovePDF-style drag-and-drop, configuration, and result views.
*/

/* ------------------- TOOL HEADER & BREADCRUMB ------------------- */
.tool-page-header {
  padding: 40px 0 28px;
  text-align: center;
  background: radial-gradient(circle at 50% 0%, var(--primary-light) 0%, transparent 60%);
}

.breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 14px;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb span.current {
  color: var(--text-main);
  font-weight: 600;
}

.tool-header-title {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.tool-header-subtitle {
  font-size: 15.5px;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
}

/* ------------------- MAIN TOOL WORKSPACE ------------------- */
.tool-workspace {
  padding: 16px 0 64px;
  flex: 1;
}

.tool-container {
  max-width: 980px;
  margin: 0 auto;
}

/* ------------------- UPLOAD ZONE (DRAG & DROP) ------------------- */
.upload-dropzone {
  background: var(--bg-card);
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-xl);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.upload-icon-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 4px 16px rgba(108, 60, 233, 0.15);
  transition: transform 0.2s ease;
}

.upload-dropzone:hover .upload-icon-circle {
  transform: scale(1.08);
}

.upload-btn-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: var(--primary);
  color: white;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(108, 60, 233, 0.35);
  margin-bottom: 14px;
  pointer-events: none; /* Let parent dropzone trigger input */
}

.upload-dropzone:hover .upload-btn-main {
  background-color: var(--primary-hover);
}

.upload-hint {
  font-size: 14px;
  color: var(--text-muted);
}

.upload-formats {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
}

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

/* ------------------- FILE QUEUE & REORDER (PDF MERGE) ------------------- */
.file-queue-area {
  margin-top: 24px;
  display: none;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.queue-count {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.queue-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-secondary-sm {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary-sm:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.file-queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.queue-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.queue-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.queue-item-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #FEECEB;
  color: #E53935;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.queue-item-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.queue-item-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.queue-item-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  margin-top: auto;
}

.queue-reorder-btns {
  display: flex;
  gap: 4px;
}

.btn-mini {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-mini:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-mini.danger:hover {
  color: #E53935;
  border-color: #E53935;
  background: #FEECEB;
}

/* ------------------- CONFIGURATION PANELS ------------------- */
.tool-controls-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.controls-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 14.5px;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 60, 233, 0.12);
}

/* Radio Cards (Compression Options) */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.option-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  background: var(--bg-card);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.option-card:hover {
  border-color: var(--border-hover);
}

.option-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.option-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.option-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Sliders */
.slider-container {
  display: flex;
  align-items: center;
  gap: 16px;
}

.range-slider {
  flex-grow: 1;
  height: 6px;
  border-radius: 4px;
  background: var(--border-color);
  outline: none;
  accent-color: var(--primary);
}

.slider-val-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  min-width: 48px;
  text-align: right;
}

/* ------------------- ACTION BAR ------------------- */
.tool-action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
}

.btn-primary-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-color: var(--primary);
  color: white;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 36px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(108, 60, 233, 0.35);
  cursor: pointer;
}

.btn-primary-lg:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 60, 233, 0.45);
}

.btn-primary-lg:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-size: 15px;
  font-weight: 600;
  padding: 13px 28px;
  border-radius: var(--radius-md);
}

.btn-outline-lg:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ------------------- PROGRESS & STATUS ------------------- */
.progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  margin: 24px 0;
  display: none;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3.5px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.progress-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

.progress-bar-container {
  width: 100%;
  max-width: 460px;
  height: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 auto;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.2s ease;
}

/* ------------------- RESULT SUCCESS VIEW ------------------- */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 48px 32px;
  text-align: center;
  box-shadow: var(--shadow-md);
  display: none;
}

.result-icon-success {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #EDF7ED;
  color: #2E7D32;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.result-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.result-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 24px;
}

/* Stats Comparison (Original vs Compressed) */
.comparison-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  max-width: 540px;
  margin: 0 auto 32px;
}

.comparison-box {
  text-align: center;
}

.comparison-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.comparison-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.comparison-value.success {
  color: #2E7D32;
}

.comparison-arrow {
  color: var(--text-light);
  font-size: 20px;
}

.savings-pill {
  background: #EDF7ED;
  color: #2E7D32;
  font-weight: 700;
  font-size: 12.5px;
  padding: 3px 8px;
  border-radius: 4px;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ------------------- ALERTS & NOTICES ------------------- */
.alert-box {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.alert-info {
  background: var(--primary-light);
  border: 1px solid rgba(108, 60, 233, 0.2);
  color: var(--primary);
}

.alert-error {
  background: #FEECEB;
  border: 1px solid #FFCDD2;
  color: #C62828;
}

/* ------------------- SPECIFIC TOOL COMPONENTS ------------------- */

/* Split PDF Page Grid */
.split-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.split-page-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.split-page-card:hover {
  border-color: var(--primary);
}

.split-page-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.split-page-card .page-num {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

/* Image Preview Compare */
.preview-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.preview-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.preview-box img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: white;
}

.preview-caption {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 10px;
}

/* QR Code Canvas Area */
.qr-preview-wrapper {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#qrcode-container {
  padding: 16px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: inline-block;
  margin-bottom: 16px;
}

/* Word Counter Panel */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card-mini {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.stat-num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.quick-actions-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* GST Calculator Result Invoice Table */
.gst-result-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.gst-result-table tr {
  border-bottom: 1px solid var(--border-color);
}

.gst-result-table td {
  padding: 12px 16px;
  font-size: 14.5px;
}

.gst-result-table td:last-child {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 700;
}

.gst-result-table tr.total-row {
  border-top: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  font-size: 17px;
}

@media (max-width: 768px) {
  .preview-compare-grid {
    grid-template-columns: 1fr;
  }
  .comparison-strip {
    flex-direction: column;
    gap: 12px;
  }
  .options-grid {
    grid-template-columns: 1fr;
  }
}
