/* /assets/css/grammar-corrections-popup.css */
/* Inline grammar correction popups that appear near errors */

.grammar-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  z-index: 9998;
  pointer-events: none;
}

.grammar-popup {
  position: absolute;
  z-index: 9999;
  background: white;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 16px;
  min-width: 320px;
  max-width: 400px;
  font-family: system-ui, -apple-system, sans-serif;
  pointer-events: auto;
}

.grammar-popup-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: white;
  border: 2px solid #3b82f6;
  transform: rotate(45deg);
  z-index: -1;
}

.grammar-popup-arrow.arrow-left {
  left: -7px;
  top: 20px;
  border-right: none;
  border-bottom: none;
}

.grammar-popup-arrow.arrow-right {
  right: -7px;
  top: 20px;
  border-left: none;
  border-top: none;
}

.grammar-popup-arrow.arrow-top {
  top: -7px;
  left: 20px;
  border-bottom: none;
  border-right: none;
}

.grammar-popup-arrow.arrow-bottom {
  bottom: -7px;
  left: 20px;
  border-top: none;
  border-left: none;
}

.grammar-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.grammar-popup-progress {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.grammar-popup-close {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s;
}

.grammar-popup-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.grammar-popup-change {
  margin-bottom: 12px;
}

.grammar-popup-text {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.grammar-popup-original {
  color: #dc2626;
  font-weight: 500;
  padding: 2px 6px;
  background: #fee2e2;
  border-radius: 4px;
}

.grammar-popup-arrow-symbol {
  color: #6b7280;
  font-size: 14px;
}

.grammar-popup-corrected {
  color: #059669;
  font-weight: 500;
  padding: 2px 6px;
  background: #d1fae5;
  border-radius: 4px;
}

/* Ensure hidden elements are truly hidden */
.grammar-popup-arrow-symbol[style*="display: none"],
.grammar-popup-corrected[style*="display: none"] {
  display: none !important;
  visibility: hidden !important;
}

.grammar-popup-category {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 8px;
}

.grammar-popup-description {
  font-size: 14px;
  color: #374151;
  line-height: 1.5;
  margin-bottom: 8px;
}

.grammar-popup-explanation {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.grammar-popup-concept-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 6px;
}

.grammar-popup-concept-text {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.6;
  max-height: 120px;
  overflow-y: auto;
}

.grammar-popup-concept-text::-webkit-scrollbar {
  width: 6px;
}

.grammar-popup-concept-text::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.grammar-popup-concept-text::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.grammar-popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.grammar-popup-btn {
  flex: 1;
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
  color: #374151;
}

.grammar-popup-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.grammar-popup-btn-accept {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.grammar-popup-btn-accept:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.grammar-popup-btn-reveal {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.grammar-popup-btn-reveal:hover {
  background: #059669;
  border-color: #059669;
}

.grammar-popup-btn-skip {
  background: white;
  color: #6b7280;
  border-color: #d1d5db;
}

.grammar-popup-btn-skip:hover {
  background: #f9fafb;
  color: #374151;
}

/* Highlight the error in the textarea */
.grammar-highlight-active::selection {
  background: rgba(239, 68, 68, 0.3) !important;
  color: inherit;
}

.grammar-highlight-active::-moz-selection {
  background: rgba(239, 68, 68, 0.3) !important;
  color: inherit;
}

/* Enhance the textarea when showing corrections */
.grammar-highlight-active {
  background: #fef2f2 !important;
  transition: background 0.2s;
}

/* Animation */
@keyframes popup-appear {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grammar-popup {
  animation: popup-appear 0.2s ease-out;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .grammar-popup {
    min-width: 280px;
    max-width: calc(100vw - 40px);
    font-size: 13px;
  }
  
  .grammar-popup-text {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .grammar-popup-actions {
    flex-direction: column;
  }
}