/* ==========================================
   SYSTEM MESSAGES
   ========================================== */

/* Section wrapper - sits below .home-summary-panel */
.sysMsg-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

/* Base card */
.sysMsg {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px;
  font-size: 13px;
  position: relative;
  transition: box-shadow 180ms ease;
}

.sysMsg:hover {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

/* Type variants */
.sysMsg--critical {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.07);
}

.sysMsg--warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.07);
}

.sysMsg--info {
  border-color: rgba(3, 202, 252, 0.35);
  background: rgba(3, 202, 252, 0.06);
}

/* Header row */
.sysMsg__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sysMsg__header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Type icon */
.sysMsg__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sysMsg--critical .sysMsg__icon { stroke: #ef4444; }
.sysMsg--warning  .sysMsg__icon { stroke: #f59e0b; }
.sysMsg--info     .sysMsg__icon { stroke: #03cafc; }

.sysMsg__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sysMsg--critical .sysMsg__title { color: #f87171; }
.sysMsg--warning  .sysMsg__title { color: #fbbf24; }
.sysMsg--info     .sysMsg__title { color: #67e8f9; }

/* Close button - only for info, appears on hover */
.sysMsg__close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 160ms ease, background 160ms ease;
  color: var(--text-muted);
}

.sysMsg__close svg {
  width: 14px;
  height: 14px;
}

.sysMsg:hover .sysMsg__close {
  opacity: 1;
}

.sysMsg__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Divider */
.sysMsg__divider {
  height: 1px;
  margin: 10px 0;
}

.sysMsg--critical .sysMsg__divider { background: rgba(239, 68, 68, 0.25); }
.sysMsg--warning  .sysMsg__divider { background: rgba(245, 158, 11, 0.25); }
.sysMsg--info     .sysMsg__divider { background: rgba(3, 202, 252, 0.2); }

/* Body */
.sysMsg__body {
  color: var(--text-secondary);
  line-height: 1.55;
}

.sysMsg__body p {
  margin: 0 0 6px 0;
}

.sysMsg__body p:last-child {
  margin-bottom: 0;
}

/* Expand button */
.sysMsg__expand-btn {
  display: inline-block;
  margin-top: 8px;
  background: transparent;
  border: 1px solid rgba(3, 202, 252, 0.3);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #67e8f9;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
  font-family: var(--font-family);
}

.sysMsg__expand-btn:hover {
  background: rgba(3, 202, 252, 0.1);
  border-color: rgba(3, 202, 252, 0.55);
}

.sysMsg--warning .sysMsg__expand-btn {
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.sysMsg--warning .sysMsg__expand-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.6);
}

.sysMsg--critical .sysMsg__expand-btn {
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.sysMsg--critical .sysMsg__expand-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.6);
}

/* Dismiss animation */
@keyframes sysMsgDismiss {
  to {
    opacity: 0;
    transform: scale(0.97) translateY(-4px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
  }
}

.sysMsg--dismissing {
  overflow: hidden;
  animation: sysMsgDismiss 240ms ease forwards;
}

/* ==========================================
   EXPANDED NOTIFICATION OVERLAY
   (like login modal)
   ========================================== */

.sysMsgOverlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: sysMsgOverlayIn 0.28s ease-out both;
}

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

.sysMsgOverlay--closing {
  animation: sysMsgOverlayOut 0.2s ease-out both;
}

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

.sysMsgOverlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 25, 0.87);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.sysMsgOverlay__card {
  position: relative;
  background: rgba(30, 35, 50, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 28px 32px;
  max-width: 680px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  animation: sysMsgCardIn 0.32s ease-out both;
  font-size: 14px;
}

/* Type border accent on card */
.sysMsgOverlay--info     .sysMsgOverlay__card { border-color: rgba(3, 202, 252, 0.3); }
.sysMsgOverlay--critical .sysMsgOverlay__card { border-color: rgba(239, 68, 68, 0.4); }
.sysMsgOverlay--warning  .sysMsgOverlay__card { border-color: rgba(245, 158, 11, 0.4); }

@keyframes sysMsgCardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.sysMsgOverlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sysMsgOverlay__header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sysMsgOverlay__header .sysMsg__icon {
  width: 20px;
  height: 20px;
}

.sysMsgOverlay__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.sysMsgOverlay--critical .sysMsgOverlay__title { color: #f87171; }
.sysMsgOverlay--warning  .sysMsgOverlay__title { color: #fbbf24; }
.sysMsgOverlay--info     .sysMsgOverlay__title { color: #67e8f9; }

.sysMsgOverlay__close {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background 160ms ease, color 160ms ease, transform 200ms ease;
}

.sysMsgOverlay__close svg {
  width: 16px;
  height: 16px;
}

.sysMsgOverlay__close:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  transform: rotate(90deg);
}

.sysMsgOverlay__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 18px 0;
}

.sysMsgOverlay--critical .sysMsgOverlay__divider { background: rgba(239, 68, 68, 0.2); }
.sysMsgOverlay--warning  .sysMsgOverlay__divider { background: rgba(245, 158, 11, 0.2); }
.sysMsgOverlay--info     .sysMsgOverlay__divider { background: rgba(3, 202, 252, 0.18); }

/* Body content inside overlay */
.sysMsgOverlay__body {
  color: var(--text-secondary);
  line-height: 1.65;
}

.sysMsgOverlay__body p {
  margin: 0 0 12px 0;
}

.sysMsgOverlay__body p:last-child {
  margin-bottom: 0;
}

/* Heading tag [h] */
.sysMsg-content-heading {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

/* Scrollbar inside overlay card */
.sysMsgOverlay__card::-webkit-scrollbar {
  width: 6px;
}

.sysMsgOverlay__card::-webkit-scrollbar-track {
  background: transparent;
}

.sysMsgOverlay__card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
  .sysMsgOverlay__card {
    padding: 20px 18px;
    border-radius: 16px;
  }

  .sysMsgOverlay__title {
    font-size: 15px;
  }
}
