/* =======================================
   FEEDBACK SYSTEM (ALERTS · TOASTS · CONFIRMATIONS)
======================================= */

.container-messages,
[data-feedback-stack] {
  position: fixed;
  top: clamp(72px, 6vh, 110px);
  right: clamp(16px, 4vw, 32px);
  width: min(380px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 2200;
  pointer-events: none;
}

@media (max-width: 768px) {
  .container-messages,
  [data-feedback-stack] {
    left: 16px;
    right: 16px;
    width: auto;
  }
}

/* Shared styles for inline alerts and floating messages */
:is(.alert-message, .alert) {
  --alert-bg: var(--color-accent);
  --alert-border: var(--color-secondary);
  --alert-color: var(--color-secondary);
  background: var(--alert-bg);
  border: 1px solid var(--alert-border);
  border-left-width: 4px;
  border-radius: 12px;
  padding: 0.95rem 1.15rem;
  color: var(--alert-color);
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.1);
  font-size: 0.95rem;
  line-height: 1.45;
  pointer-events: auto;
  position: relative;
}

.alert-message__content,
.alert__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.alert-message__title,
.alert__title {
  font-weight: 600;
  font-size: 1rem;
  color: inherit;
}

.alert-message__body,
.alert__body,
.alert-message p,
.alert p {
  margin: 0;
}

.alert-message__meta {
  font-size: 0.82rem;
  opacity: 0.78;
}

/* Variants */
:is(.alert-message, .alert).success,
:is(.alert-message, .alert)[data-variant="success"] {
  --alert-bg: var(--feedback-success-bg);
  --alert-border: var(--color-success);
  --alert-color: var(--feedback-success-foreground);
}

:is(.alert-message, .alert).warning,
:is(.alert-message, .alert)[data-variant="warning"],
:is(.alert-message, .alert).alert-warning {
  --alert-bg: var(--feedback-warning-bg);
  --alert-border: var(--color-warning);
  --alert-color: var(--feedback-warning-foreground);
}

:is(.alert-message, .alert).info,
:is(.alert-message, .alert)[data-variant="info"],
:is(.alert-message, .alert).alert-info {
  --alert-bg: var(--feedback-info-bg);
  --alert-border: var(--color-info);
  --alert-color: var(--feedback-info-foreground);
}

:is(.alert-message, .alert).error,
:is(.alert-message, .alert).danger,
:is(.alert-message, .alert)[data-variant="error"],
:is(.alert-message, .alert)[data-variant="danger"],
:is(.alert-message, .alert).alert-error,
:is(.alert-message, .alert).alert-danger {
  --alert-bg: var(--feedback-danger-bg);
  --alert-border: var(--color-danger);
  --alert-color: var(--feedback-danger-foreground);
}

:is(.alert-message, .alert).changed,
:is(.alert-message, .alert)[data-variant="changed"],
:is(.alert-message, .alert)[data-variant="saved"] {
  --alert-bg: var(--feedback-changed-bg);
  --alert-border: var(--color-primary);
  --alert-color: var(--feedback-changed-foreground);
}

/* Inline banners */
.alert {
  width: 100%;
  box-shadow: none;
}

/* Toast-specific styling */
.alert-message.is-toast {
  animation: feedback-toast-enter 0.35s ease forwards;
  transform: translate3d(16px, 8px, 0);
  opacity: 0;
  box-shadow: var(--feedback-shadow);
}

.alert-message.is-toast.is-visible {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.alert-message.is-toast.is-leaving {
  animation: feedback-toast-exit 0.25s ease forwards;
}

@keyframes feedback-toast-enter {
  from {
    opacity: 0;
    transform: translate3d(24px, 10px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes feedback-toast-exit {
  to {
    opacity: 0;
    transform: translate3d(16px, 0, 0);
  }
}

/* Close buttons */
.alert-message__close,
.alert .close-btn,
.alert-message .close-btn {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.65;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.1rem;
  line-height: 1;
  transition: opacity 0.2s ease;
}

.alert-message__close:hover,
.alert .close-btn:hover,
.alert-message .close-btn:hover {
  opacity: 1;
}

/* Declarative confirm overlay */
[data-feedback-confirm-overlay] {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 2300;
}

[data-feedback-confirm-overlay].is-open {
  display: flex;
}

.app-confirm {
  width: min(440px, 100%);
  background: var(--color-surface-alt);
  border: 2px solid var(--color-secondary);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.35);
  color: var(--color-secondary);
}

.app-confirm__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.app-confirm__title {
  font-size: 1.2rem;
  margin: 0;
  color: var(--color-secondary);
}

.app-confirm__message {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.app-confirm__actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
}

.app-confirm__btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.6rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.app-confirm__btn:hover {
  transform: translateY(-1px);
}

.app-confirm__btn--ghost {
  background: transparent;
  color: var(--color-secondary);
  border-color: var(--color-border-muted);
}

.app-confirm__btn--primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ================================
   TOPBAR (admin main-content header)
================================ */

.topbar-admin {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.65rem 1.5rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  background: var(--color-accent);
  border-bottom: 1px solid var(--color-border-muted);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.22);
  margin-bottom: 0;
  transition: box-shadow 0.3s ease, background 0.3s ease;
  min-height: 54px;
  box-sizing: border-box;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.topbar-admin__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

/* === Manual de Usuario button in topbar === */
.topbar-manual-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  background: rgba(212, 175, 55, 0.1);
  color: var(--color-warning);
  border: 1px solid rgba(212, 175, 55, 0.3);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
  cursor: pointer;
}

.topbar-manual-btn:hover {
  background: rgba(212, 175, 55, 0.18);
  color: var(--color-warning);
  border-color: rgba(212, 175, 55, 0.55);
  transform: translateY(-1px);
}

.topbar-manual-btn svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* ================================
   BELL ICON + DROPDOWN PANEL
================================ */

.notification-icon {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.notification-icon:hover {
  background: rgba(212, 175, 55, 0.12);
}

.notification-icon__svg {
  width: 26px;
  height: 26px;
  fill: var(--color-warning);
  transition: fill 0.2s ease;
}

.notifications-panel a {
  color: inherit;
  text-decoration: none;
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 0;
  background: var(--color-danger);
  color: #ffffff !important;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  transform: scale(0);
  transition: transform 0.25s ease;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.notification-badge.show {
  transform: scale(1);
}

.notifications-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(350px, calc(100vw - 32px));
  max-height: 420px;
  background: var(--color-surface-alt);
  border-radius: 12px;
  box-shadow: var(--feedback-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  overflow: hidden;
  border: 2px solid var(--color-secondary);
  display: flex;
  flex-direction: column;
}

.notifications-panel.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notification-header {
  padding: 16px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-bottom: 1px solid var(--color-border-muted);
  flex-shrink: 0;
}

.notification-header h4 {
  margin: 0;
  color: var(--color-secondary);
  font-size: 1rem;
  font-weight: 600;
}

#mark-all-as-read {
  background: transparent;
  border: none;
  color: var(--color-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 0;
  opacity: 0.8;
  text-align: left;
  transition: opacity 0.2s ease;
}

#mark-all-as-read:hover {
  opacity: 1;
}

.notification-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
  flex: 1;
}

.notification-list::-webkit-scrollbar {
  width: 4px;
}

.notification-list::-webkit-scrollbar-thumb {
  background: var(--color-border-muted);
  border-radius: 2px;
}

.notification-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border-muted);
  transition: background 0.2s ease;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item.unread {
  background: var(--color-surface);
  border-left: 3px solid var(--color-secondary);
}

.notification-item:hover {
  background: var(--color-border-muted);
}

.notification-item p {
  margin: 0 0 4px;
  color: var(--color-secondary);
  font-weight: 500;
  font-size: 0.88rem;
  line-height: 1.4;
}

.notification-item .timestamp {
  font-size: 0.75rem;
  color: var(--color-gray);
}

.empty-notifications {
  text-align: center;
  padding: 30px 20px;
  color: var(--color-gray);
  font-size: 0.88rem;
}

@media (max-width: 768px) {
  .topbar-admin__title {
    display: none;
  }
  .topbar-admin__user-name {
    display: none;
  }
}

@media (max-width: 480px) {
  .topbar-admin {
    padding: 0.35rem 0.5rem;
  }

  .topbar-manual-btn__text {
    display: none;
  }

  .topbar-manual-btn {
    padding: 0.4rem;
  }
}
