/* ===============================
   COMMENTS MODULE STYLES
   =============================== */

/* Comment Mode Indicator */
#commentModeIndicator {
  background: rgba(46, 207, 176, 0.95);
  border-color: var(--brand-teal, #2ECFB0);
}

#commentModeIndicator.active {
  display: block;
}

/* Comment Section in Toolbar */
.comments-section {
  background: rgba(46, 207, 176, 0.1);
  border: 2px solid var(--brand-teal, #2ECFB0);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 15px;
}

.comments-section-title {
  color: var(--brand-teal, #2ECFB0);
  font-size: 1em;
  font-weight: bold;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(46, 207, 176, 0.3);
}

/* Comment Controls */
.comment-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-btn {
  width: 100%;
  padding: 10px 15px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.comment-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.comment-btn:active {
  transform: translateY(0);
}

#toggleCommentMode {
  background: var(--brand-teal, #2ECFB0);
  color: var(--bg-base, #0E1117);
  font-weight: bold;
}

#toggleCommentMode.active {
  background: #ff6600;
  color: white;
  animation: commentPulse 2s infinite;
}

@keyframes commentPulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(46, 207, 176, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(46, 207, 176, 0.8), 0 0 30px rgba(46, 207, 176, 0.4);
  }
}

/* Comment Count Badge */
.comment-count-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e74c3c;
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Comments List (inside floating panel) */
#commentsList {
  overflow-y: visible;
  margin-top: 0;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

#commentsList::-webkit-scrollbar {
  width: 6px;
}

#commentsList::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

#commentsList::-webkit-scrollbar-thumb {
  background: rgba(46, 207, 176, 0.5);
  border-radius: 3px;
}

#commentsList::-webkit-scrollbar-thumb:hover {
  background: rgba(46, 207, 176, 0.8);
}

/* Individual Comment Item in List */
.comment-list-item {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  border-left: 3px solid var(--brand-teal, #2ECFB0);
  transition: all 0.2s ease;
}

.comment-list-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(-3px);
}

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

.comment-list-title {
  font-weight: bold;
  color: var(--brand-teal, #2ECFB0);
  font-size: 13px;
  flex: 1;
}

.comment-list-controls {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.comment-list-item:hover .comment-list-controls {
  opacity: 1;
}

.comment-list-btn {
  min-height: 24px;
  min-width: 24px;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transition: all 0.2s ease;
}

.comment-list-btn:hover {
  transform: scale(1.1);
}

.comment-list-btn.edit-btn:hover {
  background: #2196f3;
}

.comment-list-btn.delete-btn:hover {
  background: #e74c3c;
}

.comment-list-text {
  font-size: 12px;
  color: #ccc;
  margin-bottom: 6px;
  line-height: 1.4;
}

.comment-list-meta {
  font-size: 10px;
  color: #888;
}

/* Comment Dialog */
#commentDialog {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

#commentDialog input,
#commentDialog textarea,
#commentDialog select {
  font-family: inherit;
}

#commentDialog input:focus,
#commentDialog textarea:focus,
#commentDialog select:focus {
  outline: none;
  border-color: var(--brand-teal, #2ECFB0);
  box-shadow: 0 0 0 2px rgba(46, 207, 176, 0.2);
}

/* Comment Info Box */
.comment-info {
  background: rgba(46, 207, 176, 0.1);
  border-left: 3px solid var(--brand-teal, #2ECFB0);
  padding: 10px;
  border-radius: 4px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
}

.comment-info strong {
  color: var(--brand-teal, #2ECFB0);
}

/* Modern InfoBox Styles for Comments */
.modern-infobox {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  padding: 0;
  color: #e0e0e0;
  line-height: 1.6;
}

.modern-infobox h3 {
  color: var(--brand-teal, #2ECFB0);
  font-size: 18px;
  margin: 0;
  font-weight: 600;
  padding: 15px;
  background: rgba(46, 207, 176, 0.1);
  border-bottom: 2px solid rgba(46, 207, 176, 0.3);
}

/* Priority Indicators */
.priority-high {
  border-left-color: #e74c3c !important;
}

.priority-normal {
  border-left-color: var(--brand-teal, #2ECFB0) !important;
}

.priority-low {
  border-left-color: #95a5a6 !important;
}

/* Responsive Design for Comments */
@media (max-width: 768px) {
  #commentDialog {
    left: 10px !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    max-width: none !important;
    min-width: 0 !important;
    width: calc(100vw - 20px) !important;
  }

  .comments-section {
    margin-bottom: 10px;
  }

  #commentsList {
    max-height: 200px;
  }
}

/* Animation for new comments notification */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.comment-notification {
  animation: slideInRight 0.3s ease-out;
}

/* Comment Filters (if needed later) */
.comment-filters {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.comment-filter-btn {
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: #ccc;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.comment-filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.comment-filter-btn.active {
  background: var(--brand-teal, #2ECFB0);
  color: var(--bg-base, #0E1117);
  border-color: var(--brand-teal, #2ECFB0);
}

/* Empty State */
.comments-empty-state {
  text-align: center;
  padding: 30px 20px;
  color: #666;
}

.comments-empty-state svg {
  width: 60px;
  height: 60px;
  margin-bottom: 15px;
  opacity: 0.3;
}

/* Loading State */
.comments-loading {
  text-align: center;
  padding: 20px;
  color: var(--brand-teal, #2ECFB0);
}

.comments-loading::after {
  content: '...';
  animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ===============================
   COMMENT DIALOG (was inline styles)
   =============================== */
#commentDialog {
  position: fixed;
  display: none;
  background: rgba(26, 32, 44, 0.98);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-2xl, 16px);
  color: white;
  z-index: var(--z-dialogs, 300);
  box-shadow: var(--shadow-xl, 0 16px 48px rgba(0,0,0,0.6)), 0 0 0 1px rgba(255,255,255,0.08);
  min-width: 380px;
  max-width: 420px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
}

#commentDialogHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--space-xl, 20px);
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  cursor: grab;
  user-select: none;
}

#commentDialogHeader:active {
  cursor: grabbing;
}

#commentDialogTitle {
  margin: 0;
  color: var(--brand-teal);
  font-size: 16px;
  font-weight: 700;
}

.cd-close-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm, 4px);
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cd-close-btn:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}

.cd-body {
  padding: var(--space-xl, 20px);
}

.cd-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm, 6px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cd-label-sm {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--space-xs, 4px);
  font-weight: 600;
}

.cd-field {
  margin-bottom: var(--space-lg, 16px);
}

.cd-input {
  width: 100%;
  padding: var(--space-md, 12px) 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md, 8px);
  background: var(--input-bg);
  color: white;
  box-sizing: border-box;
  font-size: 14px;
  transition: all 0.2s ease;
}

.cd-input:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(var(--brand-teal-rgb), 0.2);
  outline: none;
}

.cd-textarea {
  width: 100%;
  padding: var(--space-md, 12px) 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md, 8px);
  background: var(--input-bg);
  color: white;
  min-height: 120px;
  resize: vertical;
  box-sizing: border-box;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.cd-textarea:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(var(--brand-teal-rgb), 0.2);
  outline: none;
}

.cd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md, 12px);
  margin-bottom: var(--space-xl, 20px);
}

.cd-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-sm, 10px);
}

.cd-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md, 8px);
  background: var(--input-bg-solid);
  color: white;
  box-sizing: border-box;
  font-size: 14px;
}

.cd-select:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(var(--brand-teal-rgb), 0.2);
  outline: none;
}

.cd-select option {
  background: var(--input-bg-solid);
  color: white;
}

.cd-select-sm {
  width: 100%;
  padding: var(--space-sm, 8px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm, 6px);
  background: var(--input-bg-solid);
  color: white;
  font-size: 13px;
}

.cd-select-sm option {
  background: var(--input-bg-solid);
}

.cd-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 8px);
  cursor: pointer;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}

.cd-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--warning);
  cursor: pointer;
}

.cd-inspection-fields {
  display: none;
  margin-bottom: var(--space-lg, 16px);
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: var(--radius-lg, 10px);
  padding: 14px;
  background: rgba(251,191,36,0.05);
}

.cd-buttons {
  display: flex;
  gap: var(--space-md, 12px);
}

.cd-btn-cancel {
  flex: 1;
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid var(--border-default);
  padding: var(--space-md, 12px) var(--space-lg, 16px);
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.cd-btn-cancel:hover {
  background: rgba(255,255,255,0.15);
}

.cd-btn-save {
  flex: 1;
  background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-teal-dark) 100%);
  color: var(--bg-base);
  border: none;
  padding: var(--space-md, 12px) var(--space-lg, 16px);
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(var(--brand-teal-rgb), 0.3);
  transition: all 0.2s ease;
}

.cd-btn-save:hover {
  box-shadow: 0 6px 16px rgba(var(--brand-teal-rgb), 0.4);
  transform: translateY(-1px);
}

.cd-btn-save:active,
.cd-btn-cancel:active {
  transform: scale(0.98);
}

@media (max-width: 768px) {
  #commentDialog {
    min-width: auto;
    max-width: none;
    width: calc(100vw - 20px);
    left: 10px !important;
    right: 10px !important;
  }

  .cd-grid-3 {
    grid-template-columns: 1fr;
  }

  .cd-select-sm {
    min-height: 44px;
    font-size: 14px;
  }
}

/* ===============================
   ANNOTATIONS SIDEBAR (Type grid, list items, hints)
   Moved from ui-comments-extension.js
   =============================== */

.modern-btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.modern-btn-group.annotation-type-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.modern-btn-icon-only {
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  font-size: 20px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
}

.modern-btn-icon-only.active {
  background: linear-gradient(135deg, var(--brand-teal, #2ECFB0) 0%, var(--brand-teal-dark, #3DB8A0) 100%) !important;
  color: var(--bg-base, #0E1117) !important;
  border-color: var(--brand-teal, #2ECFB0) !important;
  box-shadow: 0 4px 12px rgba(46, 207, 176, 0.4) !important;
  transform: translateY(-1px);
}

.modern-btn-icon-only:not(.active) {
  background: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.6);
}

.modern-btn-icon-only:not(.active):hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.9);
}

.modern-btn-small {
  padding: 8px 12px !important;
  font-size: 13px !important;
}

.modern-btn-small .modern-btn-icon {
  font-size: 16px;
}

.modern-btn-small.active {
  background: linear-gradient(135deg, var(--brand-teal, #2ECFB0) 0%, var(--brand-teal-dark, #3DB8A0) 100%) !important;
  color: var(--bg-base, #0E1117) !important;
  border-color: var(--brand-teal, #2ECFB0) !important;
  box-shadow: 0 4px 12px rgba(46, 207, 176, 0.4) !important;
  transform: translateY(-1px);
}

.modern-btn-small:not(.active) {
  background: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.6);
}

.modern-btn-small:not(.active):hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.9);
}

.modern-btn-danger {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #F87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  box-shadow: none !important;
}

.modern-btn-danger:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
}

/* Modern Comment List Item */
.modern-comment-item {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid #2ECFB0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modern-comment-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-2px);
}

.modern-comment-item.priority-high {
  border-left-color: #F87171;
}

.modern-comment-item.priority-normal {
  border-left-color: #2ECFB0;
}

.modern-comment-item.priority-low {
  border-left-color: #718096;
}

.modern-comment-item.type-area {
  border-left-width: 4px;
  border-left-style: dashed;
}

.modern-comment-item.type-circle {
  border-left-width: 4px;
  border-left-style: dotted;
}

.modern-comment-item.type-polyline {
  border-left-width: 4px;
  border-left-style: double;
}

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

.modern-comment-title {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 13px;
  flex: 1;
}

.modern-comment-controls {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modern-comment-item:hover .modern-comment-controls {
  opacity: 1;
}

.modern-comment-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modern-comment-btn:hover {
  transform: scale(1.1);
}

.modern-comment-btn.edit-btn:hover {
  background: #2ECFB0;
}

.modern-comment-btn.delete-btn:hover {
  background: #ee0979;
}

.modern-comment-btn.bcf-btn:hover {
  background: #2ECFB0;
}

.modern-comment-text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.modern-comment-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
}

.modern-comment-type {
  background: rgba(46, 207, 176, 0.3);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.modern-comment-category {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.modern-comment-priority {
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.modern-comment-priority.high {
  background: rgba(238, 9, 121, 0.2);
  color: #ff6a9e;
}

.modern-comment-priority.normal {
  background: rgba(46, 207, 176, 0.2);
  color: #2ECFB0;
}

.modern-comment-priority.low {
  background: rgba(113, 128, 150, 0.2);
  color: #cbd5e0;
}

/* Modern Hidden Features List Item */
.modern-hidden-item {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid #ee0979;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.modern-hidden-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modern-hidden-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modern-hidden-name {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 13px;
  flex: 1;
}

.modern-hidden-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

/* Modern Saved View Item */
.modern-view-item {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid #11998e;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.modern-view-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modern-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.modern-view-name {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 13px;
}

.modern-view-controls {
  display: flex;
  gap: 4px;
}

.modern-view-details {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

/* Enhanced hints section */
.modern-hint {
  background: rgba(46, 207, 176, 0.1);
  border-left: 3px solid #2ECFB0;
  padding: 10px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 12px;
}

.modern-hint strong {
  color: #a5b4fc;
  font-weight: 600;
}
