/**
 * iGrade Animation Styles
 * Styles for the animated mockup on the marketing website
 * Includes dialog styles for rubric selection, prompt customization, and edit grades
 */

/* ========================================
   FAKE CURSOR
   ======================================== */

.anim-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s ease;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.anim-cursor.visible {
  opacity: 1;
}

.anim-cursor svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   MESSAGE ANIMATIONS
   ======================================== */

.mock-message.animated {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease-out;
}

.mock-message.animated.ai {
  transform: translateX(-20px) translateY(10px);
}

.mock-message.animated.user {
  transform: translateX(20px) translateY(10px);
}

.mock-message.animated.visible {
  opacity: 1;
  transform: translateX(0) translateY(0);
}

/* ========================================
   TYPING ANIMATION
   ======================================== */

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #000;
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: blink 0.7s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Input field typing state */
.mock-input.typing {
  color: #000000 !important;
}

/* ========================================
   CLICK EFFECTS
   ======================================== */

.click-effect {
  animation: clickScale 0.2s ease-out;
}

@keyframes clickScale {
  0% { transform: scale(1); }
  50% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* Send button active state */
.mock-send-btn.active {
  transform: scale(0.9);
  transition: transform 0.1s ease;
}

.mock-send-btn.clicked {
  animation: sendPulse 0.3s ease-out;
}

@keyframes sendPulse {
  0% { transform: scale(1); box-shadow: none; }
  50% { transform: scale(0.85); box-shadow: 0 0 12px rgba(91, 141, 239, 0.5); }
  100% { transform: scale(1); box-shadow: none; }
}

/* Sidebar item click */
.mock-sidebar-item.clicked {
  animation: itemClick 0.3s ease-out;
}

@keyframes itemClick {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* ========================================
   SPINNER / LOADING
   ======================================== */

.anim-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #E5E5E5;
  border-top-color: #5B8DEF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   SCROLL ANIMATIONS
   ======================================== */

.mock-content {
  scroll-behavior: smooth;
}

.mock-content.scrolling {
  overflow-y: hidden;
}

/* ========================================
   EDIT LINK
   ======================================== */

.edit-link {
  padding-left: 20px;
  margin-top: 2px;
  margin-bottom: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.edit-link.visible {
  opacity: 1;
}

.edit-link span {
  font-size: 10px;
  color: #8E8E93;
  cursor: pointer;
  transition: color 0.2s ease;
}

.edit-link span:hover {
  color: #5B8DEF;
}

.edit-link.clicked span {
  color: #5B8DEF;
}

/* ========================================
   DIALOG OVERLAY & CONTAINER
   ======================================== */

.anim-dialog-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  pointer-events: none;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.anim-dialog-overlay.visible {
  background: rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.anim-dialog {
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 501;
  max-width: 90%;
  max-height: 90%;
}

.anim-dialog.visible {
  transform: scale(1);
  opacity: 1;
}

/* ========================================
   DIALOG CONTENT COMMON
   ======================================== */

.dialog-content {
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 20px;
  min-width: 280px;
  max-width: 350px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.dialog-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.dialog-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #000;
  margin: 0;
}

.dialog-icon {
  font-size: 16px;
}

.dialog-subtitle {
  font-size: 10px;
  color: #8E8E93;
  margin: 0 0 12px 0;
}

.dialog-footer {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

/* ========================================
   RUBRIC SELECTION DIALOG
   ======================================== */

.rubric-dialog .dialog-option {
  background: #F8F9FA;
  border: 1px solid #E5E5E5;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rubric-dialog .dialog-option.selected {
  background: #FFF9C4;
  border-color: #FFE082;
}

.rubric-dialog .dialog-option input[type="radio"] {
  margin-top: 2px;
  accent-color: #5B8DEF;
}

.rubric-dialog .option-content {
  flex: 1;
}

.rubric-dialog .option-content strong {
  font-size: 11px;
  color: #000;
  display: block;
  margin-bottom: 2px;
}

.rubric-dialog .option-content p {
  font-size: 9px;
  color: #8E8E93;
  margin: 0;
}

.rubric-dialog .saved-rubric-dropdown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FFFFFF;
  border: 1px solid #E5E5E5;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 9px;
  margin-top: 4px;
}

.rubric-dialog .dropdown-arrow {
  font-size: 8px;
  color: #8E8E93;
}

.rubric-dialog .select-btn {
  background: #5B8DEF;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 9px;
  font-weight: 500;
  cursor: pointer;
  margin-left: auto;
  align-self: center;
}

.continue-btn {
  background: #5B8DEF;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.continue-btn:hover {
  background: #4A7DD9;
}

.continue-btn.clicked {
  animation: btnClick 0.2s ease-out;
}

@keyframes btnClick {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* ========================================
   PROMPT CUSTOMIZATION DIALOG
   ======================================== */

.prompt-dialog .dialog-checkbox-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 10px;
  color: #000;
}

.prompt-dialog .default-option {
  background: #FFF9C4;
  border-radius: 4px;
}

.prompt-dialog .settings-group {
  margin-bottom: 12px;
}

.prompt-dialog .settings-group h4 {
  font-size: 11px;
  font-weight: 600;
  color: #000;
  margin: 0 0 6px 0;
}

.prompt-dialog .radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #5B8DEF;
  cursor: pointer;
  padding: 2px 0;
}

.prompt-dialog .radio-option input[type="radio"] {
  accent-color: #5B8DEF;
  margin: 0;
}

.prompt-dialog .radio-option.selected {
  font-weight: 500;
}

/* ========================================
   EDIT GRADES DIALOG
   ======================================== */

.edit-dialog {
  min-width: 300px;
}

.edit-dialog .dialog-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.edit-dialog .dialog-header-row h3 {
  font-size: 14px;
  font-weight: 600;
  color: #000;
  margin: 0;
}

.edit-dialog .fullscreen-btn {
  background: #F0F0F0;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 9px;
  color: #666;
  cursor: pointer;
}

.edit-dialog .student-edit-form {
  background: #F8F9FA;
  border-radius: 6px;
  padding: 12px;
}

.edit-dialog .student-name {
  font-size: 13px;
  font-weight: 600;
  color: #8B4513;
  margin: 0 0 12px 0;
}

.edit-dialog .form-label {
  font-size: 10px;
  color: #8E8E93;
  display: block;
  margin-bottom: 4px;
}

.edit-dialog .grade-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.edit-dialog .grade-input {
  width: 50px;
  padding: 6px 8px;
  border: 1px solid #E5E5E5;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.edit-dialog .grade-max {
  font-size: 11px;
  color: #8E8E93;
}

.edit-dialog .feedback-textarea {
  width: 100%;
  height: 80px;
  padding: 8px;
  border: 1px solid #E5E5E5;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.4;
  resize: none;
  font-family: inherit;
  background: #F8F9FA;
}

.edit-dialog .edit-footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
}

.edit-dialog .cancel-btn {
  background: #F0F0F0;
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.edit-dialog .save-btn {
  background: #5B8DEF;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.edit-dialog .save-btn:hover {
  background: #4A7DD9;
}

.edit-dialog .save-btn.clicked,
.edit-dialog .cancel-btn.clicked {
  animation: btnClick 0.2s ease-out;
}

/* ========================================
   TRANSITIONS FOR SMOOTH PLAYBACK
   ======================================== */

/* GPU-accelerated properties only */
.mock-message,
.mock-sidebar-item,
.mock-send-btn,
.anim-cursor,
.edit-link,
.anim-dialog {
  will-change: transform, opacity;
}

/* Prevent layout thrashing */
.mock-content * {
  backface-visibility: hidden;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
  .anim-cursor {
    display: none;
  }

  .mock-message.animated {
    transform: translateY(10px);
  }

  .mock-message.animated.ai,
  .mock-message.animated.user {
    transform: translateY(10px);
  }

  .dialog-content {
    min-width: 250px;
    max-width: 95%;
    padding: 16px;
  }
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .mock-message.animated,
  .anim-cursor,
  .anim-spinner,
  .click-effect,
  .anim-dialog {
    transition: none;
    animation: none;
  }

  .mock-message.animated.visible {
    opacity: 1;
    transform: none;
  }

  .anim-dialog.visible {
    opacity: 1;
    transform: none;
  }
}
