* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: Arial, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px;
  border-bottom: 1px solid #d7d7d7;
  background: #f5f5f5;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.build-info {
  font-size: 11px;
  color: #666;
}

.current-chapter {
  display: inline-block;
  font-weight: 700;
  color: #2c2c2c;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.current-sheet {
  display: inline-block;
  font-size: 13px;
  color: #444;
}

.current-chapter.is-pulsing {
  animation: chapterPulse 760ms ease-out 2;
  transform-origin: center;
}

@keyframes chapterPulse {
  0% {
    color: #2c2c2c;
    text-shadow: 0 0 0 rgba(38, 120, 210, 0);
    transform: scale(1);
  }
  35% {
    color: #0f4ea3;
    text-shadow: 0 0 14px rgba(38, 120, 210, 0.7);
    transform: scale(2);
  }
  65% {
    color: #0f4ea3;
    text-shadow: 0 0 10px rgba(38, 120, 210, 0.55);
    transform: scale(1.3);
  }
  100% {
    color: #2c2c2c;
    text-shadow: 0 0 0 rgba(38, 120, 210, 0);
    transform: scale(1);
  }
}

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

.status-header-icons {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.status-ok-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1f9d43;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
}

.status-filter-icon {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 2px 0;
  cursor: help;
  vertical-align: middle;
}

.status-filter-icon-bar {
  display: block;
  height: 2px;
  background: #3d4f6b;
  border-radius: 1px;
}

.status-filter-icon-bar:nth-child(1) {
  width: 12px;
}

.status-filter-icon-bar:nth-child(2) {
  width: 8px;
}

.status-filter-icon-bar:nth-child(3) {
  width: 4px;
}

#folderInput {
  display: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #999;
  border-radius: 4px;
  background: #fff;
  padding: 6px 10px;
  cursor: pointer;
  user-select: none;
}

.icon-button {
  min-width: 34px;
  padding: 6px 8px;
  font-size: 15px;
  line-height: 1;
}

.layout {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  padding-bottom: 112px;
}

.pane {
  flex: 1 1 0;
  min-width: 140px;
  overflow: auto;
  padding: 12px;
}

.pane h2 {
  margin: 0 0 12px 0;
  font-size: 14px;
}

.center-pane {
  background: #fafafa;
  position: relative;
}

.pdf-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.pdf-top-row h2 {
  margin: 0;
}

#pdfSearchInput {
  flex: 1 1 240px;
  min-width: 120px;
  border: 1px solid #bdbdbd;
  border-radius: 4px;
  padding: 6px 8px;
}

.pdf-search-status {
  font-size: 12px;
  color: #555;
  white-space: nowrap;
}

.pdf-page-indicator {
  font-size: 12px;
  color: #444;
  font-weight: 700;
}

.left-pane-content {
  font-size: 13px;
  color: #333;
}

.formatted-cell {
  white-space: pre-wrap;
  word-break: break-word;
}

.formatted-cell .formatted-para {
  margin: 0 0 0.85rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.formatted-cell .formatted-para:last-child {
  margin-bottom: 0;
}

.formatted-para-gap {
  display: block;
  height: 0.85rem;
}

.right-pane-content {
  font-size: 13px;
  color: #333;
}

.left-pane-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.left-pane-table td {
  vertical-align: top;
  border: 1px solid #ddd;
  padding: 6px 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.left-pane-value-cell {
  transition: background-color 120ms linear;
  cursor: pointer;
}

.value-cell-body {
  position: relative;
}

.value-cell-text {
  width: 100%;
}

.value-search-spinner {
  position: absolute;
  top: 2px;
  right: 2px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
  border: 1px solid #bdbdbd;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  width: 24px;
  height: 24px;
  pointer-events: none;
}

.value-compare-btn {
  position: absolute;
  top: 2px;
  right: 30px;
  width: 24px;
  height: 24px;
  border: 1px solid #bdbdbd;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.value-compare-btn.is-hidden {
  display: none;
}

.value-search-reset-btn {
  position: absolute;
  top: 2px;
  right: 58px;
  width: 24px;
  height: 24px;
  border: 1px solid #bdbdbd;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.value-search-reset-btn.is-hidden {
  display: none;
}

.left-pane-value-cell.is-searching .value-search-spinner,
.right-pane-value-cell.is-searching .value-search-spinner {
  display: inline-flex;
  animation: spinHourglass 900ms linear infinite;
}

@keyframes spinHourglass {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.left-pane-value-cell.match-exact {
  background: rgba(70, 168, 92, 0.22);
}

.left-pane-value-cell.match-fuzzy {
  background: rgba(232, 194, 48, 0.28);
}

.left-pane-value-cell.match-none {
  background: rgba(224, 62, 62, 0.22);
}

.left-pane-table td:first-child {
  width: 38%;
  font-weight: 700;
  background: #f5f5f5;
}

.right-pane-tag-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.right-pane-tag-item {
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e4e4;
}

.right-pane-tag {
  font-weight: 700;
  font-size: 1.2em;
  line-height: 1.25;
}

.right-pane-tag2 {
  margin-top: 2px;
  line-height: 1.35;
}

.right-pane-value-cell {
  transition: background-color 120ms linear;
  border-radius: 3px;
}

.right-pane-value-cell.match-exact {
  background: rgba(70, 168, 92, 0.22);
}

.right-pane-value-cell.match-fuzzy {
  background: rgba(232, 194, 48, 0.28);
}

.right-pane-value-cell.match-none {
  background: rgba(224, 62, 62, 0.22);
}

.left-id-vyjadreni-value {
  display: block;
  font-weight: 700;
}

.left-id-vyjadreni-value.is-pulsing {
  animation: leftPanelIdPulse 760ms ease-out 2;
  transform-origin: left center;
}

@keyframes leftPanelIdPulse {
  0% {
    color: #1f1f1f;
    text-shadow: 0 0 0 rgba(38, 120, 210, 0);
    transform: scale(1);
  }
  35% {
    color: #0f4ea3;
    text-shadow: 0 0 14px rgba(38, 120, 210, 0.7);
    transform: scale(2);
  }
  65% {
    color: #0f4ea3;
    text-shadow: 0 0 10px rgba(38, 120, 210, 0.55);
    transform: scale(1.3);
  }
  100% {
    color: #1f1f1f;
    text-shadow: 0 0 0 rgba(38, 120, 210, 0);
    transform: scale(1);
  }
}

.pdf-viewer {
  width: 100%;
  height: calc(100% - 30px);
  border: 1px solid #ddd;
  overflow: auto;
  background: #ededed;
}

.pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px;
  min-height: 100%;
}

.pdf-page {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
}

.pdf-page canvas {
  display: block;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  background: #fff;
}

.page-highlight-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.text-highlight {
  position: absolute;
  border-radius: 2px;
}

.text-highlight.match-exact {
  background: rgba(70, 168, 92, 0.35);
}

.text-highlight.match-fuzzy {
  background: rgba(232, 194, 48, 0.35);
}

.text-highlight.match-search {
  background: rgba(255, 236, 120, 0.55);
  box-shadow: 0 0 0 1px rgba(166, 125, 0, 0.45);
}

.page-mask {
  position: absolute;
  inset: 0;
  background: rgba(120, 120, 120, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms linear;
}

.pdf-page.is-dimmed .page-mask {
  opacity: 1;
}

.resizer {
  width: 8px;
  cursor: col-resize;
  background: #e5e5e5;
  border-left: 1px solid #d0d0d0;
  border-right: 1px solid #d0d0d0;
}

.resizer:hover {
  background: #d7d7d7;
}

.evaluation-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-top: 1px solid #d0d0d0;
  background: #f8f8f8;
  z-index: 20;
}

.evaluation-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.evaluation-nav-buttons {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  flex-wrap: wrap;
}

.evaluation-note-label {
  font-size: 13px;
  white-space: nowrap;
}

.evaluation-note-input {
  width: 340px;
  max-width: 40vw;
  min-width: 180px;
  min-height: 72px;
  border: 1px solid #bdbdbd;
  border-radius: 4px;
  padding: 6px 8px;
  resize: vertical;
  font-family: inherit;
}

.evaluation-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.evaluation-stats {
  width: 100%;
  font-size: 12px;
  color: #3f3f3f;
}

.evaluation-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.evaluation-option-btn {
  color: #fff;
  border: none;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
}

.evaluation-option-btn.eval-green {
  background: #2d9d4a;
}

.evaluation-option-btn.eval-red {
  background: #cc3737;
}

.evaluation-option-btn.eval-orange {
  background: #df8924;
}

.evaluation-option-btn.eval-blue {
  background: #2f76cf;
}

.evaluation-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.evaluation-status-badge {
  color: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 700;
  font-size: 12px;
}

.evaluation-status-badge.eval-green {
  background: #2d9d4a;
}

.evaluation-status-badge.eval-red {
  background: #cc3737;
}

.evaluation-status-badge.eval-orange {
  background: #df8924;
}

.evaluation-status-badge.eval-blue {
  background: #2f76cf;
}

.evaluation-note-text,
.evaluation-date-text,
.evaluation-hint {
  font-size: 12px;
  color: #444;
}

.evaluation-blocked {
  color: #b45309;
  font-weight: 600;
}

.evaluation-note-input.is-hidden {
  display: none;
}

.export-button {
  white-space: nowrap;
}

.evaluation-actions {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.sync-action-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sync-status-indicator {
  font-size: 12px;
  color: #4f4f4f;
  white-space: nowrap;
}

#importEvaluationsInput {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal-card {
  width: min(620px, 92vw);
  max-height: 80vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.modal-card h3 {
  margin: 0 0 12px 0;
}

.modal-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.worksheet-hidden-mark {
  font-size: 12px;
  color: #a05a00;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.help-modal-card {
  width: min(840px, 94vw);
}

.help-content {
  font-size: 14px;
  line-height: 1.4;
}

.help-content p {
  margin: 8px 0;
}

.help-content ul {
  margin: 6px 0 12px 20px;
  padding: 0;
}

.help-content li {
  margin: 3px 0;
}

.value-text-modal-card {
  width: min(860px, 94vw);
}

.value-text-modal-content {
  min-height: 200px;
  max-height: 56vh;
  overflow: auto;
  border: 1px solid #d7d7d7;
  border-radius: 6px;
  padding: 10px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  user-select: text;
}

.diff-equal {
  background: rgba(62, 174, 84, 0.2);
}

.diff-change {
  background: rgba(232, 194, 48, 0.35);
}
