/* ABOUTME: Styles for the right-side "Expand this article" panel in Edit mode */
/* ABOUTME: Provides contextual suggestions and tools for article expansion */

.expand-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #a2a9b1;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  z-index: 3000;
  overflow-y: auto;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.expand-sidebar__header {
  background: #f8f9fa;
  border-bottom: 1px solid #a2a9b1;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.expand-sidebar__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #202122;
}

.expand-sidebar__close {
  background: none;
  border: none;
  font-size: 20px;
  color: #72777d;
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.expand-sidebar__close:hover {
  background: #eaecf0;
  color: #202122;
}

.expand-sidebar__content {
  padding: 0;
}

.expand-section {
  border-bottom: 1px solid #eaecf0;
  padding: 20px;
}

.expand-section:last-child {
  border-bottom: none;
}

.expand-section__title {
  margin: 0 0 16px 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #202122;
  text-transform: none;
  letter-spacing: 0.5px;
}

/* Suggestions */
.expand-suggestions {
  list-style: none;
  padding: 0;
  margin: 0;
}

.expand-suggestion {
  display: flex;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px solid #f0f0f0;
}

.expand-suggestion:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.expand-suggestion__icon {
  font-size: 18px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.expand-suggestion__content {
  flex: 1;
  min-width: 0;
}

.expand-suggestion__content h5 {
  margin: 0 0 4px 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #202122;
  line-height: 1.3;
}

.expand-suggestion__content p {
  margin: 0 0 8px 0;
  font-size: 0.8125rem;
  color: #54595d;
  line-height: 1.4;
}

.expand-suggestion__why {
  font-style: italic;
  color: #72777d !important;
  font-size: 0.75rem !important;
  margin-bottom: 12px !important;
}

.expand-suggestion__outline {
  background: #f8f9fa;
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.outline-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #202122;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.example-snippet {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
  color: #202122;
  white-space: pre-wrap;
  margin: 0;
}

.outline-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.outline-items li {
  font-size: 0.75rem;
  color: #54595d;
  line-height: 1.5;
  padding: 2px 0;
}

.expand-suggestion__actions {
  display: flex;
  gap: 8px;
}

.expand-suggestion__action {
  border: none;
  padding: 4px 12px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 0;
}

.expand-suggestion__action--primary {
  background: #3366cc;
  color: #fff;
}

.expand-suggestion__action--primary:hover {
  background: #2a4b8d;
}

/* Mobile: show as bottom drawer up to 80% height, hidden by default */
@media (max-width: 768px) {
  .expand-sidebar {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: 80vh; /* up to 80% of viewport height */
    border-left: none;
    border-top: 1px solid #a2a9b1;
    box-shadow: 0 -8px 16px rgba(0,0,0,0.2);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    transform: translateY(100%);
    transition: transform 0.25s ease;
  }

  .expand-sidebar.open {
    transform: translateY(0);
  }

  .expand-sidebar__header {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }
}

.expand-suggestion__action--dismiss {
  background: #f8f9fa;
  color: #72777d;
  border: 1px solid #a2a9b1;
}

.expand-suggestion__action--dismiss:hover {
  background: #eaecf0;
  color: #54595d;
}

/* Include guidance (What to include) */
.include-guidance {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f8f9fa;
  border-radius: 4px;
  border: 1px solid #eaecf0;
}

.include-guidance__title {
  font-size: 13px;
  font-weight: 600;
  color: #54595d;
  margin: 0 0 6px 0;
}

.include-guidance__list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  color: #202122;
  line-height: 1.5;
}

.include-guidance__list li {
  margin: 4px 0;
}

/* Wikipedia-like styling for examples */
.wiki-link {
  color: #0645ad;
  text-decoration: none;
  cursor: default;
}
.wiki-link:hover {
  text-decoration: underline;
}
.wiki-examples {
  margin-top: 10px;
}
.wiki-example { margin-bottom: 12px; }
.wiki-example__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
}
.wiki-example__excerpt {
  font-size: 13px;
  color: #54595d;
  margin-top: 2px;
  line-height: 1.45;
}

/* Tips block without grey background; use divider */
.tips-guidance {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #eaecf0;
}
.tips-guidance__title {
  font-size: 13px;
  font-weight: 600;
  color: #54595d;
  margin: 0 0 6px 0;
}
.tips-guidance__list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  color: #202122;
  line-height: 1.5;
}

/* Focus header with detached back link */
.focus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
}
.focus-title { margin: 0; }
.focus-back-link {
  font-size: 13px;
  color: #0645ad;
  text-decoration: none;
}
.focus-back-link:hover { text-decoration: underline; }

.include-guidance__link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: #3366cc;
  text-decoration: none;
}

.include-guidance__link:hover {
  text-decoration: underline;
}

/* Media block separation */

/* Statistics */
.expand-stats {
  display: flex;
  gap: 16px;
}

.expand-stat {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  background: #f8f9fa;
  border-radius: 4px;
}

.expand-stat__value {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  color: #202122;
  line-height: 1;
}

.expand-stat__label {
  display: block;
  font-size: 0.75rem;
  color: #72777d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Quick Tools */
.expand-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.expand-tool {
  background: #fff;
  border: 1px solid #a2a9b1;
  border-radius: 4px;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.expand-tool:hover {
  background: #f8f9fa;
  border-color: #72777d;
}

.expand-tool__icon {
  font-size: 16px;
}

.expand-tool__label {
  font-size: 0.75rem;
  color: #202122;
  font-weight: 500;
}

/* Layout adjustments when sidebar is open */
.ve-interface.sidebar-open {
  margin-right: 320px;
}

.ve-interface.sidebar-open .ve-content-wrap {
  max-width: none;
  margin-right: 0;
}

/* Hidden suggestion cards */
.expand-suggestion--hidden {
  display: none;
}

/* Mobile responsive */
@media (max-width: 1200px) {
  .expand-sidebar {
    width: 280px;
  }
  
  .ve-interface.sidebar-open {
    margin-right: 280px;
  }
}

@media (max-width: 1024px) {
  .expand-sidebar {
    width: 100%;
    position: fixed;
    top: 20%;
    left: 0;
    right: 0;
    height: 80vh;
    z-index: 2001;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
    background: #ffffff;
  }
  
  .ve-interface.sidebar-open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    pointer-events: auto;
  }
  
  .ve-interface.sidebar-open {
    margin-right: 0;
  }
  
  .expand-sidebar__header {
    padding: 12px 16px;
    position: relative;
    background: #ffffff;
    border-radius: 16px 16px 0 0;
  }
  
  .expand-sidebar__header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: #a2a9b1;
    border-radius: 2px;
  }
  
  .expand-section {
    padding: 16px;
    background: #ffffff;
  }
}

@media (max-width: 768px) {
  .expand-sidebar {
    animation: slideUpDrawer 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    top: 20%;
    height: 80vh;
  }
  
  @keyframes slideUpDrawer {
    from {
      transform: translateY(100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  .expand-tools {
    grid-template-columns: 1fr;
  }
  
  .expand-stats {
    flex-direction: column;
    gap: 8px;
  }
  
  .expand-suggestion__actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .expand-suggestion__action {
    flex: none;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .expand-sidebar {
    animation: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .expand-sidebar {
    border-left: 2px solid #000;
  }
  
  .expand-suggestion__action {
    border: 1px solid #000;
  }
  
  .expand-tool {
    border: 2px solid #000;
  }
}
