/**
 * Glossary Slide-Over Styles — P3 Sprint 6 Task 6.1
 * Persistent glossary panel with pin/unpin functionality
 * Scoped styling for discovery-zone context
 */

/* Glossary Button (persistent FAB) */
.glossary-button {
  position: fixed;
  top: 100px;
  right: 20px;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  background: var(--forest, #2D6A4F);
  border: none;
  border-radius: 24px;
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.glossary-button:hover {
  background: #24563F;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(45, 106, 79, 0.4);
}

.glossary-button:focus {
  outline: 2px solid var(--gold, #C8963E);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .glossary-button {
    bottom: 20px;
    top: auto;
    right: 20px;
    padding: 0.9rem 1.1rem;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .glossary-button::before {
    content: '📖';
  }
  
  /* Hide text on mobile */
  .glossary-button {
    text-indent: -9999px;
    line-height: 0;
  }
}

/* Glossary Overlay */
.glossary-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.glossary-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

/* Glossary Panel */
.glossary-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background: white;
  z-index: 1999;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.glossary-panel.is-open {
  transform: translateX(0);
}

/* Pinned mode */
.glossary-panel.is-pinned {
  position: fixed;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
}

body.glossary-pinned {
  margin-right: 420px;
}

@media (max-width: 1200px) {
  body.glossary-pinned {
    margin-right: 0;
  }
  
  .glossary-panel.is-pinned {
    width: 100%;
    max-width: 420px;
  }
}

@media (max-width: 768px) {
  .glossary-panel {
    width: 100%;
    max-width: 100%;
  }
  
  body.glossary-pinned {
    margin-right: 0;
  }
}

/* Glossary Header */
.glossary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: var(--ocean, #0D3B6E);
  color: white;
  flex-shrink: 0;
}

.glossary-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.glossary-controls {
  display: flex;
  gap: 0.75rem;
}

.glossary-pin-btn,
.glossary-close-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.glossary-pin-btn:hover,
.glossary-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.glossary-pin-btn:focus,
.glossary-close-btn:focus {
  outline: 2px solid var(--gold, #C8963E);
  outline-offset: 2px;
}

/* Alphabet Tabs */
.glossary-alphabet-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem;
  background: rgba(13, 59, 110, 0.05);
  border-bottom: 2px solid #e0e0e0;
  overflow-x: auto;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.glossary-alphabet-tab {
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ocean, #0D3B6E);
  background: white;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.glossary-alphabet-tab:hover {
  border-color: var(--ocean, #0D3B6E);
  background: rgba(13, 59, 110, 0.05);
}

.glossary-alphabet-tab:focus {
  outline: 2px solid var(--gold, #C8963E);
  outline-offset: 2px;
}

.glossary-alphabet-tab.active {
  background: var(--ocean, #0D3B6E);
  color: white;
  border-color: var(--ocean, #0D3B6E);
}

/* Glossary Content */
.glossary-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.glossary-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: #666;
  font-size: 1rem;
}

/* Glossary Entry */
.glossary-entry {
  padding: 1.25rem;
  margin-bottom: 1rem;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.glossary-entry:hover {
  border-color: var(--forest, #2D6A4F);
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.1);
}

.glossary-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.glossary-entry-symbol {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--forest, #2D6A4F);
}

.glossary-entry-sankhya-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ocean, #0D3B6E);
  margin-bottom: 0.25rem;
}

.glossary-entry-physics-name {
  font-size: 0.9rem;
  font-style: italic;
  color: #666;
  margin-bottom: 0.75rem;
}

.glossary-entry-definition {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #555;
  margin-bottom: 0.75rem;
}

.glossary-entry-value {
  padding: 0.5rem 0.75rem;
  background: rgba(45, 106, 79, 0.08);
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  margin-bottom: 0.75rem;
}

.glossary-entry-value strong {
  color: var(--forest, #2D6A4F);
}

.glossary-entry-source {
  font-size: 0.75rem;
  color: #777;
  font-style: italic;
  margin-bottom: 0.75rem;
}

.glossary-entry-related {
  padding-top: 0.75rem;
  border-top: 1px solid #e0e0e0;
  font-size: 0.85rem;
  color: #555;
}

.glossary-related-link {
  padding: 0.2rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--forest, #2D6A4F);
  font-weight: 600;
  font-family: 'Courier New', monospace;
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
  transition: all 0.2s ease;
}

.glossary-related-link:hover {
  color: var(--gold, #C8963E);
  text-decoration-style: solid;
}

.glossary-related-link:focus {
  outline: 2px solid var(--gold, #C8963E);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .glossary-panel,
  .glossary-overlay,
  .glossary-button {
    transition: none;
  }
}
