/* eMedics — UI discoverability (Apka-32ja, 2026-05-22) */

/* ============================================================================
   1. HELP TOOLTIPS (data-help)
   ========================================================================== */

.help-tooltip {
  position: absolute;
  z-index: 9999;
  max-width: 280px;
  padding: 8px 12px;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  pointer-events: none;
  /* Fade in subtle */
  animation: help-tooltip-fade 0.12s ease-out;
}

/* Strzałka pod tooltipem (gdy tooltip pod elementem) */
.help-tooltip::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #1e293b;
  border-top: 0;
}

/* Gdy tooltip nad elementem (flip) */
.help-tooltip-above::before {
  top: auto;
  bottom: -5px;
  border-bottom: 0;
  border-top: 5px solid #1e293b;
}

@keyframes help-tooltip-fade {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Wizualne afford-y dla elementów z data-help (subtelne, nie krzykliwe) */
button[data-help],
a[data-help],
summary[data-help],
[data-help].help-target {
  position: relative;
}

/* Ikona ℹ na hoverze przy elementach z data-help (opt-in przez klasę) */
[data-help].help-target::after {
  content: "ℹ";
  display: inline-block;
  margin-left: 4px;
  font-size: 0.85em;
  color: var(--muted, #64748b);
  opacity: 0.7;
  transition: opacity 0.15s;
}
[data-help].help-target:hover::after,
[data-help].help-target:focus-visible::after {
  opacity: 1;
  color: var(--brand, #0d6efd);
}

/* ============================================================================
   2. BELL PANEL "Co nowego"
   ========================================================================== */

/* Wrapper bellsa w topbar */
.rn-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--ink, #0f172a);
  font-size: 18px;
  border-radius: 6px;
  transition: background 0.15s;
}
.rn-bell:hover,
.rn-bell:focus-visible {
  background: var(--bg, #f8fafc);
  outline: none;
}
.rn-bell:focus-visible {
  box-shadow: 0 0 0 2px var(--brand, #0d6efd);
}

/* Badge unread count */
.rn-bell-badge {
  position: absolute;
  top: 0;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  border-radius: 9px;
  text-align: center;
  box-shadow: 0 0 0 2px #ffffff;
}

/* Wrapper panelu (absolutnie pozycjonowany via JS) */
.rn-panel-wrapper {
  /* JS ustawia top/right/zIndex inline */
  pointer-events: auto;
}

/* Panel dropdown */
.rn-panel {
  width: min(380px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 80px));
  background: #ffffff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: rn-panel-fade 0.14s ease-out;
}

@keyframes rn-panel-fade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.rn-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: var(--bg, #f8fafc);
}
.rn-panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #0f172a);
}

.rn-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--muted, #64748b);
  cursor: pointer;
  padding: 0 6px;
  border-radius: 4px;
}
.rn-close:hover,
.rn-close:focus-visible {
  background: var(--line, #e2e8f0);
  color: var(--ink, #0f172a);
  outline: none;
}

.rn-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.rn-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}
.rn-item:last-child { border-bottom: 0; }

.rn-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--muted, #64748b);
}

.rn-badge-new {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.rn-item-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #0f172a);
  line-height: 1.3;
}

.rn-item-body {
  font-size: 13px;
  color: var(--ink, #0f172a);
  line-height: 1.45;
}

.rn-learn-more {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--brand, #0d6efd);
  text-decoration: none;
}
.rn-learn-more:hover { text-decoration: underline; }

.rn-unread {
  background: #f0f9ff;
}

.rn-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--line, #e2e8f0);
  background: var(--bg, #f8fafc);
}

.rn-see-all {
  font-size: 12px;
  color: var(--brand, #0d6efd);
  text-decoration: none;
}
.rn-see-all:hover { text-decoration: underline; }

.rn-empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted, #64748b);
}
.rn-empty p:first-child { margin-bottom: 4px; font-weight: 500; }

/* Full-page list (release_notes_list.html) */
.rn-page-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.rn-page-item {
  /* dziedziczy .card */
}

.rn-page-meta {
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-bottom: 4px;
}

.rn-page-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.rn-page-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink, #0f172a);
}

.rn-page-link {
  margin-top: 12px;
  display: inline-block;
}

/* ============================================================================
   3. HELP MODAL (❓ topbar → modal)
   ========================================================================== */

.help-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 24px;
  z-index: 1000;
  animation: help-modal-backdrop-fade 0.16s ease-out;
}
.help-modal-backdrop[hidden] {
  display: none;
}

@keyframes help-modal-backdrop-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.help-modal {
  background: #ffffff;
  width: min(620px, 100%);
  max-height: calc(100vh - 84px);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  outline: none;
  animation: help-modal-slide 0.18s ease-out;
}

@keyframes help-modal-slide {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: var(--bg, #f8fafc);
}

.help-modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink, #0f172a);
}

.help-modal-close {
  background: transparent;
  border: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--muted, #64748b);
  cursor: pointer;
  padding: 0 8px;
  border-radius: 4px;
}
.help-modal-close:hover,
.help-modal-close:focus-visible {
  background: var(--line, #e2e8f0);
  color: var(--ink, #0f172a);
  outline: none;
}

.help-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.help-section {
  margin-bottom: 22px;
}
.help-section:last-child { margin-bottom: 0; }

.help-section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.help-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.help-feature-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line, #e2e8f0);
  font-size: 14px;
  line-height: 1.45;
}
.help-feature-list li:last-child { border-bottom: 0; }
.help-feature-list .small { color: var(--muted, #64748b); }

.help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* Help toggle button w topbar */
.help-toggle {
  background: transparent;
  border: 0;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--ink, #0f172a);
  font-size: 16px;
  border-radius: 6px;
  transition: background 0.15s;
}
.help-toggle:hover,
.help-toggle:focus-visible {
  background: var(--bg, #f8fafc);
  outline: none;
}
.help-toggle:focus-visible {
  box-shadow: 0 0 0 2px var(--brand, #0d6efd);
}

/* Modal-open state (zablokuj scroll body) */
body.modal-open { overflow: hidden; }

/* ============================================================================
   4. MOBILE / RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
  .help-tooltip {
    max-width: calc(100vw - 32px);
    font-size: 12px;
    padding: 7px 10px;
  }

  .rn-panel {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 100px);
  }

  .rn-panel-wrapper {
    /* Mobile — pełna szerokość, fixed prawym brzegiem */
    right: 8px !important;
    left: 8px !important;
  }
  .rn-panel-wrapper .rn-panel {
    width: 100%;
  }

  .help-modal-backdrop {
    padding: 12px;
  }
  .help-modal {
    max-height: calc(100vh - 24px);
  }
  .help-modal-header {
    padding: 14px 16px;
  }
  .help-modal-body {
    padding: 16px;
  }
  .help-actions {
    flex-direction: column;
  }
  .help-actions .btn {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
}

/* ============================================================================
   5. PRINT
   ========================================================================== */

@media print {
  .help-tooltip,
  .rn-panel-wrapper,
  .help-modal-backdrop,
  .rn-bell,
  .help-toggle { display: none !important; }
}
