* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f3f4f6;
  color: #111827;
}

header {
  background: #1f2937;
  color: white;
  padding: 20px;
}

header h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

header p {
  margin: 0;
  opacity: 0.85;
  font-size: 14px;
}

main {
  padding: 20px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.hidden {
  display: none;
}

button {
  border: none;
  background: #9ca3af;
  color: white;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s ease;
}

button:hover {
  background: #6b7280;
}

button.active {
  background: #2563eb;
}

button:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.file-link {
  display: inline-block;
  margin-top: 10px;
  padding: 9px 14px;
  border-radius: 8px;
  background: #10b981;
  color: white;
  text-decoration: none;
  cursor: pointer;
  transition: 0.2s;
}

.file-link:hover {
  background: #059669;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.work-area {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  align-items: flex-start;
}

#documentWrapper {
  position: relative;
  display: inline-block;
  background: #e5e7eb;
  border: 1px solid #cbd5e1;
  overflow: auto;
  max-width: 100%;
  border-radius: 6px;
}

#fileCanvas,
#annotationCanvas {
  position: absolute;
  left: 0;
  top: 0;
}

#annotationCanvas {
  z-index: 10;
}

.comments {
  width: 320px;
  min-width: 320px;
  border-left: 4px solid #2563eb;
  padding-left: 14px;
}

.comments h3 {
  margin-top: 0;
}

textarea {
  width: 100%;
  height: 300px;
  resize: vertical;
  padding: 10px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  outline: none;
}

textarea:focus {
  border-color: #2563eb;
}

.note {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}

input[type="range"] {
  cursor: pointer;
}

input[type="color"] {
  cursor: pointer;
  border: none;
  background: none;
}

@media (max-width: 900px) {
  .work-area {
    grid-template-columns: 1fr;
  }
}

.save-comment-btn {
  width: 100%;
  margin-top: 12px;
  background: #2563eb;
}

.save-comment-btn:hover {
  background: #1d4ed8;
}

/* ===== TEXT TOOLBAR ===== */
.text-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.text-toolbar button {
  background: #e5e7eb;
  color: #111;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: bold;
}

.text-toolbar button:hover {
  background: #d1d5db;
}

/*Text editor style*/
.rich-editor {
  width: 100%;
  min-height: 300px;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  overflow-y: auto;
  font-size: 14px;
}

.rich-editor:focus {
  outline: none;
  border-color: #2563eb;
}

.rich-editor.empty:before {
  content: attr(data-placeholder);
  color: #9ca3af;
  pointer-events: none;
}

.text-toolbar button.active {
  background: #2563eb;
  color: white;
}

.shape-tooltip {
  position: fixed;
  display: none;
  max-width: 220px;
  background: #111827;
  color: white;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 9999;
  pointer-events: none;
}

.selected-annotation {
  margin-top: 14px;
  padding: 10px;
  border-left: 4px solid #2563eb;
  background: #eff6ff;
  border-radius: 6px;
}

.selected-annotation h4 {
  margin: 0 0 6px;
}

.selected-annotation p {
  margin: 0;
  font-size: 14px;
}