/**
 * Notes System Styles
 * Styling for the presentation notes overlay, toolbar, and components
 */

/* ========================================
   Toggle Button (Fixed Position)
   ======================================== */
.notes-toggle-btn {
  position: fixed;
  left: 20px;
  top: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
  border: 2px solid #00ffff;
  color: #00ffff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  z-index: 999;
}

.notes-toggle-btn:hover {
  background: linear-gradient(135deg, #2a2a3e 0%, #1f1f2e 100%);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.6), 0 6px 16px rgba(0, 0, 0, 0.6);
  transform: scale(1.1);
}

.notes-toggle-btn.active {
  background: linear-gradient(135deg, #00ffff 0%, #00cccc 100%);
  color: #000000;
  border-color: #00ffff;
  box-shadow: 0 0 25px rgba(0, 255, 255, 0.8), 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Badge indicator for slides with notes */
.notes-toggle-btn.has-notes::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: #98C379;
  border: 2px solid #1a2340;
  border-radius: 50%;
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* ========================================
   Performance Mode Toggle Button
   ======================================== */
.performance-mode-toggle-btn {
  position: fixed;
  left: 80px;
  top: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
  border: 2px solid #ffcc00;
  color: #ffcc00;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(255, 204, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  z-index: 999;
}

.performance-mode-toggle-btn:hover {
  background: linear-gradient(135deg, #2a2a3e 0%, #1f1f2e 100%);
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.6), 0 6px 16px rgba(0, 0, 0, 0.6);
  transform: scale(1.1);
}

.performance-mode-toggle-btn.active {
  background: linear-gradient(135deg, #ffcc00 0%, #ff9900 100%);
  color: #000000;
  border-color: #ffcc00;
  box-shadow: 0 0 25px rgba(255, 204, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Performance mode override for buttons */
body.performance-mode .notes-toggle-btn,
body.performance-mode .performance-mode-toggle-btn {
  background: #ffffff !important;
  border: 3px solid #000000 !important;
  color: #000000 !important;
  box-shadow: none !important;
  transition: none !important;
}

body.performance-mode .notes-toggle-btn:hover,
body.performance-mode .performance-mode-toggle-btn:hover {
  background: #f0f0f0 !important;
  transform: none !important;
}

body.performance-mode .notes-toggle-btn.active {
  background: #000000 !important;
  color: #ffffff !important;
  border: 3px solid #000000 !important;
}

body.performance-mode .performance-mode-toggle-btn.active {
  background: #000000 !important;
  color: #ffffff !important;
  border: 3px solid #000000 !important;
}

/* ========================================
   Overlay (Full Screen)
   ======================================== */
.notes-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(17, 17, 17, 0.97);
  z-index: 1000;
  display: none;
}

/* ========================================
   Opacity Slider (Vertical, Left Side)
   ======================================== */
.notes-opacity-slider-container {
  position: fixed;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1002;
  pointer-events: auto;
}

.notes-opacity-slider-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: #00ffff;
  font-size: 14px;
  font-weight: 600;
  background: rgba(17, 17, 17, 0.95);
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid #00ffff;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.5);
  user-select: none;
}

.notes-opacity-slider-label i {
  font-size: 16px;
}

.notes-opacity-slider-label-bottom {
  color: #00ffff;
  font-size: 16px;
  background: rgba(17, 17, 17, 0.95);
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid #00ffff;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.5);
  user-select: none;
}

.notes-opacity-slider-track {
  position: relative;
  width: 8px;
  height: 200px;
  background: rgba(17, 17, 17, 0.9);
  border: 2px solid #00ffff;
  border-radius: 4px;
  box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.2), 0 0 10px rgba(0, 255, 255, 0.3);
  cursor: pointer;
}

.notes-opacity-slider-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(to top, #00ffff, #00cccc);
  border-radius: 2px;
  pointer-events: none;
  transition: height 0.1s ease;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.notes-opacity-slider-thumb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  background: #00ffff;
  border: 3px solid #000;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.7), 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  z-index: 10;
}

.notes-opacity-slider-thumb:hover {
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 0 25px rgba(0, 255, 255, 0.9), 0 3px 12px rgba(0, 0, 0, 0.6);
}

.notes-opacity-slider-thumb:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.1);
}

/* ========================================
   Toolbar (Top Bar)
   ======================================== */
.notes-toolbar {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  padding: 12px 20px;
  background: rgba(17, 17, 17, 0.98);
  border: 2px solid #00ffff;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4), 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: 1002;
}

.notes-toolbar-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.notes-divider {
  width: 1px;
  height: 30px;
  background: rgba(0, 255, 255, 0.3);
  margin: 0 5px;
}

/* ========================================
   Buttons
   ======================================== */
.notes-btn {
  min-width: 36px;
  height: 36px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 255, 255, 0.4);
  border-radius: 6px;
  color: #00ffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 14px;
}

/* Opacity display */
.notes-opacity-display {
  min-width: 45px;
  padding: 0 10px;
  color: #00ffff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  user-select: none;
  font-family: 'Montserrat', Helvetica, monospace;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.notes-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: #00ffff;
  transform: translateY(-1px);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

.notes-btn.active {
  background: #00ffff;
  color: #000;
  border-color: #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.7);
}

/* Close button */
.notes-close-btn {
  background: rgba(233, 30, 99, 0.2);
  border-color: #f92672;
  color: #f92672;
}

.notes-close-btn:hover {
  background: #f92672;
  color: #fff;
  box-shadow: 0 0 20px rgba(249, 38, 114, 0.6);
}

/* ========================================
   Text Notes (Draggable)
   ======================================== */
.text-note {
  position: absolute;
  min-width: 200px;
  max-width: 400px;
  min-height: 120px;
  width: 350px;
  height: 250px;
  background: rgba(17, 17, 17, 0.98);
  border: 2px solid #00ffff;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.6);
  z-index: 1001;
  font-family: 'Montserrat', Helvetica, sans-serif;
  animation: fadeIn 0.2s ease;
  pointer-events: auto;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: both;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.text-note.active,
.text-note:focus-within {
  border-color: #f92672;
  box-shadow: 0 0 25px rgba(249, 38, 114, 0.5), 0 4px 12px rgba(0, 0, 0, 0.6);
}

.text-note.active .note-header,
.text-note:focus-within .note-header {
  border-bottom-color: rgba(249, 38, 114, 0.3);
  background: rgba(249, 38, 114, 0.1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -8px -8px 8px -8px;
  padding: 8px 8px 8px 12px;
  border-bottom: 2px solid rgba(0, 255, 255, 0.3);
  background: rgba(0, 255, 255, 0.1);
  border-radius: 6px 6px 0 0;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  flex-shrink: 0;
  flex-grow: 0;
}

.note-handle {
  cursor: grab;
  user-select: none;
  flex: 1;
  display: flex;
  align-items: center;
}

.note-handle:hover {
  background: rgba(0, 255, 255, 0.15);
}

.note-handle:active {
  cursor: grabbing;
  background: rgba(212, 169, 96, 0.4);
}

.note-drag-indicator {
  color: #00ffff;
  font-size: 12px;
  opacity: 0.7;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.note-handle:hover .note-drag-indicator {
  opacity: 1;
}

.note-delete-btn {
  background: transparent;
  border: none;
  color: #f92672;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 14px;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}

.note-delete-btn:hover {
  background: rgba(249, 38, 114, 0.3);
  transform: scale(1.15);
  color: #fff;
  box-shadow: 0 0 10px rgba(249, 38, 114, 0.5);
}

.note-delete-btn:active {
  transform: scale(1.05);
}

.note-content {
  color: #00ffff;
  font-size: 14px;
  line-height: 1.5;
  min-height: 40px;
  overflow-y: auto;
  outline: none;
  padding: 5px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-sizing: border-box;
  flex: 1;
}

.note-content:focus {
  background: rgba(0, 255, 255, 0.1);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.note-content:empty::before {
  content: 'Enter Note...';
  color: rgba(0, 255, 255, 0.4);
  font-style: italic;
}

/* ========================================
   Scrollbar Styling for Text Notes
   ======================================== */
.note-content::-webkit-scrollbar {
  width: 6px;
}

.note-content::-webkit-scrollbar-track {
  background: rgba(0, 255, 255, 0.1);
  border-radius: 3px;
}

.note-content::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 255, 0.4);
  border-radius: 3px;
}

.note-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 255, 0.6);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
  .notes-toolbar {
    flex-wrap: wrap;
    max-width: 90vw;
    gap: 10px;
  }

  .notes-toolbar-group {
    gap: 6px;
  }

  .notes-btn {
    min-width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .notes-toggle-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
  }

  .text-note {
    min-width: 150px;
    max-width: 90vw;
  }

  .note-content {
    font-size: 13px;
  }

  .notes-opacity-slider-container {
    left: 15px;
  }

  .notes-opacity-slider-track {
    height: 150px;
  }

  .notes-opacity-slider-label,
  .notes-opacity-slider-label-bottom {
    font-size: 12px;
    padding: 6px 8px;
  }

  .notes-opacity-slider-thumb {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  .notes-toolbar {
    top: 10px;
    padding: 10px 15px;
  }

  .notes-divider {
    display: none;
  }

  .text-note {
    min-width: 120px;
  }

  .notes-opacity-slider-container {
    left: 10px;
  }

  .notes-opacity-slider-track {
    height: 120px;
    width: 6px;
  }
}

/* ========================================
   Notifications
   ======================================== */
.notes-notification {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 15px 25px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 1003;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  font-family: 'Montserrat', Helvetica, sans-serif;
}

/* ========================================
   Context Menu (for creating notes from selected text)
   ======================================== */
.notes-context-menu {
  position: fixed;
  background: rgba(17, 17, 17, 0.98);
  border: 2px solid #00ffff;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: 999;
  padding: 5px;
  min-width: 160px;
}

.notes-context-menu-btn {
  width: 100%;
  padding: 10px 15px;
  background: transparent;
  border: none;
  color: #00ffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-family: 'Montserrat', Helvetica, sans-serif;
  border-radius: 4px;
  transition: all 0.2s ease;
  text-align: left;
}

.notes-context-menu-btn:hover {
  background: rgba(0, 255, 255, 0.2);
  color: #00ffff;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.notes-context-menu-btn:active {
  background: rgba(0, 255, 255, 0.3);
  transform: scale(0.98);
}

.notes-context-menu-btn i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* ========================================
   Text Highlights (for text with notes)
   ======================================== */
.notes-highlight {
  background: rgba(0, 255, 255, 0.2) !important;
  border-bottom: 2px solid #00ffff !important;
  padding: 2px 0 !important;
  cursor: help !important;
  transition: all 0.2s ease !important;
  position: relative !important;
  box-shadow: 0 0 5px rgba(0, 255, 255, 0.3) !important;
  display: inline !important;
}

.notes-highlight:hover {
  background: rgba(0, 255, 255, 0.3) !important;
  border-bottom-width: 3px !important;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5) !important;
}

/* Note preview on highlight hover */
.notes-highlight-preview {
  position: fixed;
  max-width: 300px;
  min-width: 200px;
  padding: 12px 15px;
  background: rgba(17, 17, 17, 0.98);
  border: 2px solid #00ffff;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), 0 6px 20px rgba(0, 0, 0, 0.6);
  color: #00ffff;
  font-size: 14px;
  line-height: 1.5;
  z-index: 1004;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  pointer-events: none;
  font-family: 'Montserrat', Helvetica, sans-serif;
  word-wrap: break-word;
}

.notes-highlight-preview.show {
  opacity: 1;
  transform: translateY(0);
}

.notes-highlight-preview.pinned {
  border-color: #f92672;
  box-shadow: 0 0 25px rgba(249, 38, 114, 0.6), 0 6px 20px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

.notes-highlight-preview.pinned::before {
  content: '📌';
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 16px;
  filter: drop-shadow(0 0 3px rgba(249, 38, 114, 0.8));
}

/* ========================================
   Position Markers (for location-based notes)
   ======================================== */
.notes-position-marker {
  position: absolute;
  width: 28px;
  height: 28px;
  background: rgba(0, 255, 255, 0.9);
  border: 2px solid #00ffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  z-index: 10;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
  transition: all 0.2s ease;
  font-size: 14px;
  color: #000;
  animation: markerPulse 2s ease-in-out infinite;
}

.notes-position-marker:hover {
  transform: translate(-50%, -50%) scale(1.15);
  background: rgba(0, 255, 255, 1);
  box-shadow: 0 0 25px rgba(0, 255, 255, 0.8), 0 4px 16px rgba(0, 0, 0, 0.6);
  animation: none;
}

@keyframes markerPulse {
  0%, 100% {
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 0 8px rgba(0, 255, 255, 0.3);
  }
}

.notes-marker-preview {
  position: fixed;
  background: rgba(17, 17, 17, 0.98);
  border: 2px solid #00ffff;
  border-radius: 8px;
  padding: 12px 16px;
  max-width: 300px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), 0 4px 16px rgba(0, 0, 0, 0.6);
  color: #00ffff;
  font-size: 14px;
  line-height: 1.5;
  z-index: 1004;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  pointer-events: none;
  font-family: 'Montserrat', Helvetica, sans-serif;
  word-wrap: break-word;
}

.notes-marker-preview.show {
  opacity: 1;
  transform: translateY(0);
}

.notes-marker-preview.pinned {
  border-color: #f92672;
  box-shadow: 0 0 25px rgba(249, 38, 114, 0.6), 0 4px 16px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

.notes-marker-preview.pinned::before {
  content: '📌';
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 16px;
  filter: drop-shadow(0 0 3px rgba(249, 38, 114, 0.8));
}

.notes-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.notes-notification-success {
  background: rgba(0, 255, 255, 0.95);
  color: #000;
  border: 2px solid #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.notes-notification-error {
  background: rgba(249, 38, 114, 0.95);
  color: #fff;
  border: 2px solid #f92672;
  box-shadow: 0 0 20px rgba(249, 38, 114, 0.5);
}

.notes-notification-info {
  background: rgba(0, 255, 255, 0.95);
  color: #000;
  border: 2px solid #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

/* ========================================
   Print Styles (Hide notes when printing)
   ======================================== */
@media print {
  .notes-overlay,
  .notes-toggle-btn,
  .performance-mode-toggle-btn,
  .notes-notification,
  .notes-context-menu,
  .notes-highlight,
  .notes-highlight-preview {
    display: none !important;
  }
}

/* ========================================
   Mobile Responsive Styles
   ======================================== */
@media (max-width: 768px) {
  .notes-toggle-btn,
  .performance-mode-toggle-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
    top: 15px;
  }

  .notes-toggle-btn {
    left: 15px;
  }

  .performance-mode-toggle-btn {
    left: 70px;
  }
}

/* ========================================
   Rain Canvas (ensure it stays visible)
   ======================================== */
.rain-canvas,
.matrix-rain-canvas {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
  z-index: -1 !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Performance mode: hide rain effects */
body.performance-mode .rain-canvas,
body.performance-mode .matrix-rain-canvas {
  display: none !important;
}

/* ========================================
   Accessibility
   ======================================== */
.notes-btn:focus,
.note-delete-btn:focus,
.notes-toggle-btn:focus {
  outline: 2px solid #61AFEF;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .notes-overlay {
    background: rgba(0, 0, 0, 0.98);
  }

  .notes-toolbar,
  .notes-btn {
    border-width: 2px;
  }

  .text-note {
    border-width: 3px;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .notes-btn,
  .notes-toggle-btn,
  .text-note,
  .notes-highlight,
  .notes-highlight-preview {
    transition: none;
    animation: none;
  }

  .notes-toggle-btn.has-notes::after {
    animation: none;
  }
}
