/* static/css/analytics.css */
/* Comprehensive styling for analytics and interactive features */

/* CSS Variables for accessibility */
:root {
  --base-font-size: 16px;
  --line-spacing: 1.5;
  --transition-duration: 0.3s;
}

/* Search functionality */
.search-results {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  max-height: 70vh;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 1050;
  display: none;
}

.search-header {
  padding: 1rem;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.search-section {
  padding: 0.5rem 1rem;
}

.search-section h6 {
  margin: 0.5rem 0;
  color: var(--secondary-color);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-item {
  display: block;
  padding: 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  transition: background-color var(--transition-duration);
}

.search-item:hover {
  background: var(--bg-color);
  text-decoration: none;
}

.search-item-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.search-item-subtitle {
  font-size: 0.9rem;
  color: #666;
}

.search-no-results {
  padding: 2rem;
  text-align: center;
  color: #666;
}

/* Glossary tooltips */
.glossary-term {
  border-bottom: 1px dotted var(--primary-color);
  cursor: help;
  transition: background-color var(--transition-duration);
}

.glossary-term:hover {
  background: rgba(52, 152, 219, 0.1);
}

.glossary-tooltip {
  position: fixed;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  padding: 0.75rem;
  max-width: 300px;
  z-index: 1060;
  display: none;
  font-size: 0.9rem;
}

.tooltip-header {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.tooltip-category {
  background: var(--primary-color);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

.tooltip-content {
  line-height: 1.4;
}

/* Accessibility panel */
.accessibility-panel {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.15);
  width: 280px;
  z-index: 1040;
  display: none;
}

.accessibility-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  border-radius: 8px 8px 0 0;
}

.accessibility-header h6 {
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
}

.accessibility-content {
  padding: 1rem;
}

.setting-group {
  margin-bottom: 1rem;
}

.setting-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.setting-group input[type="range"] {
  width: 100%;
  margin-bottom: 0.25rem;
}

.setting-group input[type="checkbox"] {
  margin-right: 0.5rem;
}

/* Accessibility classes */
.high-contrast {
  --text-color: #000;
  --bg-color: #fff;
  --border-color: #000;
  --card-bg: #fff;
}

.high-contrast .card {
  border: 2px solid #000;
}

.dyslexic-font {
  font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif;
}

/* Streaks and badges */
.streak-container {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.streak-info {
  display: flex;
  gap: 1rem;
}

.streak-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-color);
  border-radius: 20px;
  font-size: 0.9rem;
}

.streak-item i {
  color: var(--primary-color);
}

.badge-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  border: 1px solid #e6c200;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  z-index: 1070;
  transform: translateX(100%);
  transition: transform var(--transition-duration);
}

.badge-notification.show {
  transform: translateX(0);
}

.badge-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-content i {
  font-size: 1.5rem;
  color: #b8860b;
}

/* Notes functionality */
.note-editor {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  width: 90%;
  max-width: 500px;
  z-index: 1080;
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  border-radius: 8px 8px 0 0;
}

.note-header h6 {
  margin: 0;
}

.note-editor textarea {
  width: 100%;
  min-height: 200px;
  border: none;
  padding: 1rem;
  resize: vertical;
  font-family: inherit;
}

.note-actions {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-color);
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 8px 8px;
}

.note-actions button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: background-color var(--transition-duration);
}

.note-actions button:first-child {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.note-actions button:hover {
  background: var(--bg-color);
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  box-shadow: 0 5px 15px rgba(0,0,0,0.15);
  z-index: 1090;
  transition: transform var(--transition-duration);
}

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

.notification-success {
  border-color: #28a745;
  background: #d4edda;
  color: #155724;
}

.notification-error {
  border-color: #dc3545;
  background: #f8d7da;
  color: #721c24;
}

.notification-warning {
  border-color: #ffc107;
  background: #fff3cd;
  color: #856404;
}

/* PWA Install prompt */
.install-prompt {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.15);
  z-index: 1100;
  max-width: 300px;
}

.install-content {
  padding: 1rem;
}

.install-content h6 {
  margin: 0 0 0.5rem 0;
}

.install-content p {
  margin: 0 0 1rem 0;
  color: #666;
  font-size: 0.9rem;
}

.install-buttons {
  display: flex;
  gap: 0.5rem;
}

.install-buttons button {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: background-color var(--transition-duration);
}

.install-buttons .btn-primary {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Global search input */
#global-search {
  width: 100%;
  max-width: 300px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: white;
  transition: border-color var(--transition-duration);
}

#global-search:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Responsive design */
@media (max-width: 768px) {
  .search-results {
    width: 95%;
    left: 2.5%;
    transform: none;
  }
  
  .accessibility-panel {
    right: 10px;
    width: 260px;
  }
  
  .badge-notification {
    right: 10px;
    left: 10px;
    transform: translateY(-100%);
  }
  
  .badge-notification.show {
    transform: translateY(0);
  }
  
  .note-editor {
    width: 95%;
    max-height: 80vh;
  }
  
  .install-prompt {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* Dark theme support */
body.dark-theme .search-results,
body.dark-theme .glossary-tooltip,
body.dark-theme .accessibility-panel,
body.dark-theme .note-editor,
body.dark-theme .install-prompt {
  background: var(--card-bg);
  border-color: var(--border-color);
  color: var(--text-color);
}

body.dark-theme .search-item:hover {
  background: rgba(255,255,255,0.1);
}

body.dark-theme .glossary-term {
  border-bottom-color: #5dade2;
}

body.dark-theme .glossary-term:hover {
  background: rgba(93, 173, 226, 0.2);
}

/* Animation classes */
@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.slide-in {
  animation: slideIn var(--transition-duration) ease-out;
}

.fade-in {
  animation: fadeIn var(--transition-duration) ease-out;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .search-results,
  .glossary-tooltip,
  .accessibility-panel,
  .note-editor,
  .install-prompt {
    border-width: 2px;
  }
  
  .search-item:hover,
  .glossary-term:hover {
    background: #000;
    color: #fff;
  }
}
