/* public/assets/user-notifications.css
   Premium light / glass notifications for mobile + capacitor
*/

.notify-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 241;
}

/* === Bell === */
.notify-bell{
  position: relative;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  line-height: 0;
  overflow: visible;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.82);
  color: #1f2f46;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.92),
    0 8px 18px rgba(84,105,148,.06);
  transition:
    transform .12s ease,
    background .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    color .18s ease;
  -webkit-tap-highlight-color: transparent;
}

.notify-bell:hover{
  background: rgba(255,255,255,.94);
  border-color: rgba(143,161,194,.28);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.96),
    0 10px 20px rgba(84,105,148,.09);
}

.notify-bell:active{
  transform: translateY(1px);
}

.notify-bell[aria-expanded="true"]{
  background: rgba(255,255,255,.96);
  border-color: rgba(143,161,194,.30);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.98),
    0 12px 24px rgba(84,105,148,.10);
}

.notify-bell__icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.notify-bell__icon svg{
  width: 100%;
  height: 100%;
}

.notify-bell .badge{
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff5f5f, #ff3b30);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 3px rgba(255,255,255,.92);
  z-index: 2;
}

/* === Dropdown === */
.notify-dropdown{
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: 380px;
  max-width: min(380px, calc(100vw - 20px));
  max-height: min(72vh, 560px);
  overflow-y: auto;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(181,194,222,.24);
  border-radius: 22px;
  box-shadow:
    0 22px 54px rgba(71,85,105,.14),
    inset 0 1px 0 rgba(255,255,255,.72);
  z-index: 10090;
  padding: 12px;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.notify-dropdown.is-hidden{
  display: none;
}

.notify-dropdown:empty{
  padding: 14px;
  min-height: 72px;
}

.notify-dropdown::-webkit-scrollbar{
  width: 8px;
}
.notify-dropdown::-webkit-scrollbar-thumb{
  background: rgba(148,163,184,.34);
  border-radius: 999px;
}

/* === Dropdown header === */
.notify-dropdown__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 6px 10px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(181,194,222,.22);
}

.notify-dropdown__title{
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.01em;
}

.notify-dropdown__head-actions{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.notify-dropdown__count{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(59,130,246,.12);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.notify-dropdown__mark-all{
  border: none;
  background: transparent;
  color: #215f9a;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}

.notify-dropdown__mark-all:hover{
  background: rgba(33,95,154,.08);
  color: #1a4f82;
}

.notify-dropdown__foot{
  margin-top: 8px;
  padding: 8px 6px 2px;
  border-top: 1px solid rgba(181,194,222,.22);
  text-align: center;
}

.notify-dropdown__all-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: #475569 !important;
  text-decoration: none !important;
  border-radius: 10px;
  transition: background .15s ease, color .15s ease;
}

.notify-dropdown__all-link:hover{
  background: rgba(241,245,249,.95);
  color: #1e293b !important;
}

.notify-dropdown__list{
  display: grid;
  gap: 8px;
}

/* === Empty state === */
.notify-empty{
  padding: 22px 14px 18px;
  text-align: center;
}

.notify-empty__icon{
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(241,245,249,.95);
  color: #64748b;
}

.notify-empty__icon svg{
  width: 22px;
  height: 22px;
}

.notify-empty__title{
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.notify-empty__text{
  margin-top: 4px;
  font-size: 13px;
  color: #64748b;
}

/* === Items === */
.notify-item{
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  margin: 0;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(181,194,222,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.46);
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .12s ease;
}

.notify-item:last-child{
  margin-bottom: 0;
}

.notify-item:hover{
  background: rgba(246,249,253,.92);
  border-color: rgba(181,194,222,.28);
}

.notify-item.unread{
  background: rgba(255,255,255,.88);
  border-color: rgba(181,194,222,.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.56),
    0 8px 18px rgba(71,85,105,.04);
  position: relative;
}

.notify-item.unread::before{
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #3b82f6, #215f9a);
}

.notify-item__icon{
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #215f9a;
  background: rgba(59,130,246,.10);
}

.notify-item__icon svg{
  width: 20px;
  height: 20px;
}

.notify-item--success .notify-item__icon{
  color: #047857;
  background: rgba(16,185,129,.12);
}

.notify-item--error .notify-item__icon{
  color: #b91c1c;
  background: rgba(239,68,68,.10);
}

.notify-item--warn .notify-item__icon{
  color: #b45309;
  background: rgba(245,158,11,.12);
}

.notify-item--security .notify-item__icon{
  color: #7c3aed;
  background: rgba(139,92,246,.10);
}

.notify-item--vpn .notify-item__icon{
  color: #0369a1;
  background: rgba(14,165,233,.12);
}

.notify-item__body{
  min-width: 0;
  flex: 1 1 auto;
}

.notify-item__top{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.notify-item__titles{
  min-width: 0;
}

.notify-item__title{
  font-weight: 800;
  font-size: 14px;
  line-height: 1.3;
  color: #0f172a;
}

.notify-item__subtitle{
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.notify-item__time{
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}

.notify-item__meta{
  margin: 8px 0 0;
  display: grid;
  gap: 4px;
}

.notify-item__meta-row{
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.35;
}

.notify-item__meta-row dt{
  margin: 0;
  color: #64748b;
  font-weight: 600;
}

.notify-item__meta-row dd{
  margin: 0;
  color: #334155;
  font-weight: 650;
  word-break: break-word;
}

.notify-item__meta-row--reason dd{
  color: #64748b;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.45;
}

.notify-item__meta-note{
  font-size: 12px;
  line-height: 1.4;
  color: #475569;
}

.notify-item__actions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.notify-item__btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}

.notify-item__btn:active{
  transform: translateY(1px);
}

.notify-item__btn--primary{
  background: linear-gradient(180deg, #2f74b8, #215f9a);
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(33,95,154,.18);
}

.notify-item__btn--primary:hover{
  background: linear-gradient(180deg, #3580c7, #2569a8);
  text-decoration: none;
}

.notify-item__btn--ghost,
.notify-item__btn--read{
  background: rgba(255,255,255,.88);
  color: #475569 !important;
  border: 1px solid rgba(148,163,184,.35);
}

.notify-item__btn--ghost:hover,
.notify-item__btn--read:hover{
  background: #fff;
  border-color: rgba(100,116,139,.42);
  color: #1e293b !important;
}

/* legacy selectors kept for compatibility */
.notify-item .title{
  font-weight: 800;
  font-size: 14px;
  line-height: 1.3;
  margin-bottom: 4px;
  color: #0f172a;
}

.notify-item .message{
  font-size: 13px;
  line-height: 1.42;
  color: #475569;
}

.notify-item .actions{
  margin-top: 10px;
}

.notify-item a,
.notify-item button{
  font: inherit;
}

.notify-item a:not(.notify-item__btn){
  color: var(--theme-color, #215f9a);
  text-decoration: none;
  font-weight: 700;
}

/* === Desktop header harmony === */
.site-header .notify-wrap{
  z-index: 241;
}

body.site-bg .notify-bell{
  color: #1e314b;
  background: rgba(255,255,255,.28);
  border: 1px solid rgba(176,195,224,.20);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.28),
    0 6px 14px rgba(73,102,148,.035);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

body.site-bg .notify-bell:hover,
body.site-bg .notify-bell[aria-expanded="true"]{
  background: rgba(255,255,255,.42);
  border-color: rgba(126,156,198,.26);
}

body.site-bg .notify-dropdown{
  background: rgba(255,255,255,.86);
  border-color: rgba(181,194,222,.22);
  box-shadow:
    0 18px 40px rgba(101,123,170,.10),
    inset 0 1px 0 rgba(255,255,255,.24);
  backdrop-filter: blur(16px) saturate(145%);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
}

/* === Mobile / tablet === */
@media (max-width: 1024px){
  .notify-wrap{
    display: inline-flex;
    align-items: center;
  }

  .notify-bell{
    width: 42px;
    height: 42px;
    border-radius: 16px;
  }

  .notify-bell__icon{
    width: 20px;
    height: 20px;
  }

  .notify-dropdown{
    right: 0;
    top: calc(100% + 10px);
    width: min(360px, calc(100vw - 20px));
    max-height: min(66vh, 520px);
    border-radius: 20px;
    padding: 8px;
  }
}

/* narrow phones */
@media (max-width: 480px){
  .notify-dropdown{
    position: fixed;
    top: calc(72px + env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    max-height: min(62vh, 520px);
    border-radius: 20px;
  }

  .notify-item{
    border-radius: 15px;
    padding: 11px;
  }

  .notify-item .title{
    font-size: 13px;
  }

  .notify-item .message{
    font-size: 13px;
  }
}

/* notification content often injected by script; keep old compatibility */
.notify-bell .icon{
  display: none !important;
}

@media (prefers-reduced-motion: reduce){
  .notify-bell,
  .notify-dropdown,
  .notify-item{
    transition: none !important;
    animation: none !important;
  }
}
