/* tools.css - Shared styles for utility pages */

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.breadcrumb a {
  color: var(--text-secondary);
}

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

.breadcrumb-separator {
  display: flex;
  align-items: center;
}

.breadcrumb-separator svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* Tool Layout */
.tool-header {
  margin-bottom: 32px;
}

.tool-header h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
}

.tool-header p {
  font-size: 18px;
  color: var(--text-secondary);
}

.tool-container {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 48px;
  transition: border-color var(--transition-normal);
}

/* Drag & Drop Upload Zone */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-primary);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--brand-primary);
  background-color: var(--brand-light);
}

[data-theme="dark"] .upload-zone:hover, 
[data-theme="dark"] .upload-zone.dragover {
  background-color: rgba(99, 102, 241, 0.05);
}

.upload-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background-color: var(--bg-secondary);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal);
}

.upload-zone:hover .upload-icon {
  transform: translateY(-4px);
}

.upload-icon svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.upload-zone h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.upload-zone p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

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

/* File Input Hack */
.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Loading & Progress States */
.progress-container {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--brand-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.progress-bar-wrapper {
  width: 100%;
  max-width: 320px;
  height: 6px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--brand-primary);
  border-radius: var(--radius-full);
  transition: width 0.1s linear;
}

.progress-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Preview & Editor States */
.preview-container {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.preview-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  position: relative;
}

.preview-card h4 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  position: absolute;
  top: 12px;
  left: 16px;
}

.preview-card-info {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.preview-image {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

/* Tool Controls */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  background-color: var(--bg-primary);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.control-group label span {
  font-weight: 500;
  color: var(--brand-primary);
}

/* Slider Style */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--border-color);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background-color: var(--brand-primary);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* PDF Pages Grid */
.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  max-height: 480px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-tertiary);
}

.pdf-page-item {
  position: relative;
  background-color: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pdf-page-item:hover, .pdf-page-item.selected {
  border-color: var(--brand-primary);
}

.pdf-page-item.deleted {
  opacity: 0.4;
  border-color: var(--danger);
}

.pdf-page-canvas {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  box-shadow: var(--shadow-sm);
  background-color: #ffffff;
}

.pdf-page-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.pdf-page-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.pdf-page-actions button {
  flex: 1;
  font-size: 11px;
  padding: 4px;
}

.pdf-page-checkbox {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

/* Wortzähler & Zeichenzähler Dashboards */
.counter-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.counter-stat-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.counter-stat-val {
  font-size: 32px;
  font-weight: 800;
  color: var(--brand-primary);
  line-height: 1;
  margin-bottom: 8px;
}

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

/* Keyword Density Table */
.keyword-table-wrapper {
  margin-top: 24px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.keyword-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.keyword-table th, .keyword-table td {
  padding: 12px 16px;
  font-size: 14px;
}

.keyword-table th {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.keyword-table tr:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

.keyword-table td {
  color: var(--text-secondary);
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 24px;
}

@media (max-width: 480px) {
  .action-bar {
    flex-direction: column-reverse;
  }
}

/* FAQ Accordion */
.faq-section {
  margin-top: 64px;
  border-top: 1px solid var(--border-color);
  padding-top: 64px;
}

.faq-section h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 32px;
  text-align: center;
}

.faq-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  overflow: hidden;
  transition: border-color var(--transition-normal);
}

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

.faq-question {
  width: 100%;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  text-align: left;
}

.faq-question svg {
  width: 20px;
  height: 20px;
  fill: var(--text-secondary);
  transition: transform var(--transition-normal);
}

.faq-item.active .faq-question svg {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal) ease-out;
}

.faq-answer-inner {
  padding: 0 24px 20px;
  color: var(--text-secondary);
  font-size: 15px;
}

/* Image Cropper Overlay Styling */
.cropper-wrapper {
  position: relative;
  max-width: 100%;
  overflow: hidden;
  background-color: #0b0f19;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.cropper-canvas-container {
  position: relative;
}

.crop-overlay-box {
  position: absolute;
  border: 2px dashed #ffffff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  cursor: move;
  box-sizing: border-box;
}

/* Crop handles */
.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: var(--brand-primary);
  border: 2px solid #ffffff;
  border-radius: var(--radius-full);
}

.crop-handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.crop-handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
