/* ==========================================================================
   GOOGLE DOCS STYLE REVIEW & COMMENT SYSTEM
   - Floating comment triggers on text selection AND paragraph/bullet-point hover
   - Yellow text highlights (.gdoc-highlight) & block markers (.gdoc-commented-block)
   - Inline section approval chips on section headings (SA, QA, PM matrix)
   - Cascading approvals (Section 1 -> 1.1 to 1.5)
   - Right-side Google Docs comment stream drawer with inline reply & resolve
   ========================================================================== */

/* --- Google Docs Yellow Highlights --- */
mark.gdoc-highlight {
  background-color: #fef08a !important;
  color: #1e293b !important;
  border-bottom: 2px solid #eab308;
  padding: 1px 3px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
mark.gdoc-highlight:hover,
mark.gdoc-highlight.active {
  background-color: #fde047 !important;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.45);
}

@keyframes gdocHighlightPulse {
  0% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.7); background-color: #fef08a !important; }
  50% { box-shadow: 0 0 0 8px rgba(234, 179, 8, 0); background-color: #facc15 !important; }
  100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0); background-color: #fef08a !important; }
}
mark.gdoc-highlight.pulse {
  animation: gdocHighlightPulse 1.4s ease-out;
}

/* Commented Entire Paragraph or Bullet Point */
.gdoc-commented-block {
  border-left: 3.5px solid #f59e0b !important;
  background-color: rgba(254, 240, 138, 0.16) !important;
  padding-left: 10px !important;
  border-radius: 4px;
  position: relative;
  transition: background-color 0.2s ease;
}
.gdoc-commented-block:hover {
  background-color: rgba(254, 240, 138, 0.3) !important;
}

/* Inline badge on commented bullet/paragraph */
.gdoc-inline-comment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1a73e8;
  color: #ffffff;
  font-size: 11px;
  margin-left: 8px;
  cursor: pointer;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.gdoc-inline-comment-badge:hover {
  transform: scale(1.15);
  background: #1557b0;
}
.gdoc-inline-comment-badge.sa { background: #0284c7; }
.gdoc-inline-comment-badge.qa { background: #16a34a; }
.gdoc-inline-comment-badge.pm { background: #9333ea; }
.gdoc-inline-comment-badge.tw { background: #d97706; }

/* --- Floating Comment Triggers --- */

/* 1. Selection Trigger (blue bubble near selection) */
.gdoc-comment-trigger {
  position: absolute;
  z-index: 1000;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1a73e8;
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 3px 10px rgba(26, 115, 232, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.15s ease, background-color 0.15s ease;
  animation: gdocScaleIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.gdoc-comment-trigger:hover {
  background: #1557b0;
  transform: scale(1.12);
}

/* 2. Hover Comment Trigger (appears on right margin of hovered paragraph/step) */
.gdoc-hover-trigger {
  position: absolute;
  z-index: 995;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  color: #1a73e8;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.15s ease;
  opacity: 0.9;
}
.gdoc-hover-trigger:hover {
  background: #1a73e8;
  color: #ffffff;
  border-color: #1a73e8;
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(26, 115, 232, 0.4);
}

@keyframes gdocScaleIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

/* --- Google Docs Comment Input Box --- */
.gdoc-comment-box {
  position: absolute;
  z-index: 1010;
  width: 330px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.08);
  padding: 14px 16px;
  font-family: 'Source Sans 3', Arial, sans-serif;
  animation: gdocFadeIn 0.15s ease-out;
}
@keyframes gdocFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.gdoc-comment-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.gdoc-comment-box-role {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
}
.gdoc-role-select {
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  font-size: 11.5px;
  font-weight: 700;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  outline: none;
}
.gdoc-role-select:focus {
  border-color: #1a73e8;
}
.gdoc-quote-preview {
  font-size: 12px;
  color: #713f12;
  font-style: italic;
  padding: 5px 8px;
  background: #fef9c3;
  border-left: 3px solid #eab308;
  border-radius: 4px;
  margin-bottom: 8px;
  max-height: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.gdoc-textarea {
  width: 100%;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
  outline: none;
  line-height: 1.4;
}
.gdoc-textarea:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}
.gdoc-comment-box-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.gdoc-comment-hint {
  font-size: 11px;
  color: #94a3b8;
}
.gdoc-comment-box-actions {
  display: flex;
  gap: 6px;
}
.gdoc-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.15s ease;
}
.gdoc-btn-primary { background: #1a73e8; color: #fff; }
.gdoc-btn-primary:hover { background: #1557b0; }
.gdoc-btn-cancel { background: transparent; color: #5f6368; }
.gdoc-btn-cancel:hover { background: #f1f3f4; color: #202124; }

/* --- Section-Level Approval Chips on Headings --- */
.gdoc-sec-approval {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Source Sans 3', Arial, sans-serif;
}
.gdoc-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.gdoc-role-chip.pending { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.gdoc-role-chip.approved { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.gdoc-role-chip.inherited { background: #ecfdf5; color: #059669; border: 1px dashed #6ee7b7; }
.gdoc-role-chip.changes { background: #ffedd5; color: #c2410c; border: 1px solid #fdba74; }
.gdoc-approval-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #ffffff;
  color: #1C4F92;
  border: 1px solid #bfdbfe;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.gdoc-approval-trigger-btn:hover { background: #eff6ff; border-color: #1C4F92; }

/* --- Section Approval Popover Modal --- */
.gdoc-popover-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gdoc-popover {
  width: 92%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  font-family: 'Source Sans 3', Arial, sans-serif;
  animation: gdocFadeIn 0.15s ease-out;
}
.gdoc-popover-header {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gdoc-popover-title { margin: 0; font-size: 14px; font-weight: 700; color: #0f172a; }
.gdoc-popover-subtitle { font-size: 11px; color: #64748b; margin-top: 1px; }
.gdoc-popover-body { padding: 14px 16px; max-height: 75vh; overflow-y: auto; }
.gdoc-cascade-banner {
  padding: 7px 10px;
  border-radius: 6px;
  background: #eff6ff;
  border-left: 3px solid #2563eb;
  font-size: 11.5px;
  color: #1e40af;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.gdoc-role-matrix-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 7px;
  background: #ffffff;
}
.gdoc-role-matrix-info { display: flex; align-items: center; gap: 8px; }
.gdoc-role-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  color: #ffffff;
}
.gdoc-role-avatar.sa { background: #0284c7; }
.gdoc-role-avatar.qa { background: #16a34a; }
.gdoc-role-avatar.pm { background: #9333ea; }
.gdoc-role-avatar.tw { background: #d97706; }
.gdoc-role-status-text { font-size: 10.5px; color: #64748b; margin-top: 1px; }
.gdoc-role-actions { display: flex; align-items: center; gap: 5px; }
.gdoc-role-btn-approve {
  padding: 4px 10px;
  border-radius: 4px;
  background: #16a34a;
  color: #ffffff;
  border: none;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.gdoc-role-btn-approve:hover { background: #15803d; }
.gdoc-role-btn-revision {
  padding: 4px 8px;
  border-radius: 4px;
  background: #ffffff;
  color: #ea580c;
  border: 1px solid #fdba74;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.gdoc-role-btn-revision:hover { background: #fff7ed; }

/* --- Right Side Comments Stream (Google Docs Drawer) --- */
.gdoc-comments-stream {
  position: fixed;
  top: 50px;
  right: 0;
  bottom: 0;
  width: 350px;
  background: #ffffff;
  border-left: 1px solid #dadce0;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
  z-index: 990;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Source Sans 3', Arial, sans-serif;
}
.gdoc-comments-stream.open { transform: translateX(0); }
.gdoc-stream-header {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gdoc-stream-header h3 { margin: 0; font-size: 13.5px; font-weight: 700; color: #0f172a; }
.gdoc-stream-filters {
  display: flex;
  gap: 4px;
  padding: 6px 14px;
  border-bottom: 1px solid #f1f5f9;
  background: #fafafa;
}
.gdoc-stream-filter-btn {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
}
.gdoc-stream-filter-btn.active {
  background: #1a73e8;
  color: #ffffff;
  border-color: #1a73e8;
}
.gdoc-stream-list { flex: 1; overflow-y: auto; padding: 12px 14px; }
.gdoc-stream-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
}
.gdoc-stream-card:hover { border-color: #93c5fd; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
.gdoc-stream-card.active { border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2); }
.gdoc-stream-card.resolved { opacity: 0.65; background: #f8fafc; }
.gdoc-stream-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.gdoc-stream-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}
.gdoc-stream-card-role {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  color: #ffffff;
}
.gdoc-stream-card-role.sa { background: #0284c7; }
.gdoc-stream-card-role.qa { background: #16a34a; }
.gdoc-stream-card-role.pm { background: #9333ea; }
.gdoc-stream-card-role.tw { background: #d97706; }
.gdoc-stream-card-time { font-size: 10.5px; color: #94a3b8; }
.gdoc-stream-card-quote {
  font-size: 11.5px;
  color: #713f12;
  font-style: italic;
  border-left: 2.5px solid #eab308;
  background: #fef9c3;
  padding: 3px 6px;
  border-radius: 3px;
  margin: 4px 0;
  max-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.gdoc-stream-card-text { font-size: 12.5px; color: #0f172a; line-height: 1.4; margin: 4px 0; }

/* Reply Thread */
.gdoc-stream-replies {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}
.gdoc-stream-reply-item {
  font-size: 11.5px;
  padding: 4px 8px;
  background: #f8fafc;
  border-radius: 4px;
  margin-top: 4px;
  line-height: 1.35;
}
.gdoc-stream-reply-item strong {
  color: #1e293b;
}

/* Inline Reply Form inside Card */
.gdoc-inline-reply-box {
  margin-top: 8px;
  display: flex;
  gap: 4px;
}
.gdoc-inline-reply-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-family: inherit;
  outline: none;
}
.gdoc-inline-reply-input:focus {
  border-color: #1a73e8;
}
.gdoc-inline-reply-btn {
  padding: 4px 10px;
  border-radius: 4px;
  background: #1a73e8;
  color: #ffffff;
  border: none;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.gdoc-inline-reply-btn:hover {
  background: #1557b0;
}

.gdoc-stream-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}
.gdoc-stream-card-act-btn {
  font-size: 11px;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.gdoc-stream-card-act-btn:hover { color: #1a73e8; background: #eff6ff; }
.gdoc-stream-card-act-btn.delete:hover { color: #dc2626; background: #fef2f2; }

/* Topbar Comment Button */
.gdoc-topbar-comment-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #ffffff;
  color: #1C4F92;
  border: 1px solid #cbd5e1;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.gdoc-topbar-comment-btn:hover { background: #f1f5f9; border-color: #1C4F92; }
.gdoc-topbar-badge {
  background: #1a73e8;
  color: #ffffff;
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
}

/* Topbar Approval Progress Widget */
.gdoc-topbar-progress-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.gdoc-topbar-progress-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.gdoc-topbar-progress-btn:hover {
  background: #dcfce7;
  border-color: #86efac;
}
.gdoc-topbar-progress-btn i.fa-circle-check {
  font-size: 13px;
  color: #16a34a;
}
.gdoc-topbar-progress-bar {
  width: 44px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
}
.gdoc-topbar-progress-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 999px;
  transition: width 0.3s ease;
  min-width: 0;
}
.gdoc-topbar-progress-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 250px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  padding: 12px 14px;
  z-index: 1050;
  display: none;
  font-family: 'Source Sans 3', Arial, sans-serif;
  animation: gdocFadeIn 0.15s ease-out;
}
.gdoc-topbar-progress-dropdown.open {
  display: block;
}
.gdoc-prog-head {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gdoc-prog-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 11.5px;
  color: #475569;
  border-bottom: 1px dashed #f1f5f9;
}
.gdoc-prog-stat-row:last-child {
  border-bottom: none;
}
.gdoc-prog-stat-val {
  font-weight: 700;
  color: #0f172a;
}

/* TOC Approval Badges */
.toc-approval-badges {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  flex-shrink: 0;
}
.toc-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 4.5px;
  font-size: 8.5px;
  font-weight: 800;
  border-radius: 4px;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.toc-badge.sa {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}
.toc-badge.qa {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.toc-badge.pm {
  background: #f3e8ff;
  color: #7e22ce;
  border: 1px solid #d8b4fe;
}

