/* ============================================================
   กระดิ่งแจ้งเตือน (ใช้ร่วมทั้งฝั่งผู้อ่าน / Studio / หลังบ้าน)
   เขียนแบบพึ่งพาตัวเองให้มากที่สุด จะได้หน้าตาเหมือนกันทุกที่
   ============================================================ */
.aw-noti { position: relative; display: inline-flex; }

.aw-noti-btn {
  position: relative; display: grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  border: none; border-radius: 50%;
  background: transparent; color: inherit;
  font-size: 1.05rem; line-height: 1; cursor: pointer;
  transition: background .15s, color .15s;
}
.aw-noti-btn:hover { background: rgba(125,125,125,.13); }
.aw-noti.open .aw-noti-btn { background: rgba(125,125,125,.16); }
.aw-noti.has-unread .aw-noti-btn { color: #C45E72; }

.aw-noti-badge {
  position: absolute; top: 1px; right: 0;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: #e0435c; color: #fff;
  font-size: 10px; font-weight: 700; font-family: inherit;
  display: grid; place-items: center; line-height: 1;
  box-shadow: 0 0 0 2px var(--bg, #fff);
}

/* กล่องรายการ */
.aw-noti-pop {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: min(340px, calc(100vw - 24px));
  background: var(--card, #fff); color: var(--ink, #222);
  border: 1px solid var(--line, #e6e6e6); border-radius: 16px;
  box-shadow: 0 18px 44px rgba(20, 30, 28, .18);
  z-index: 2000; overflow: hidden;
  animation: awNotiIn .18s ease;
}
@keyframes awNotiIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.aw-noti-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem .9rem; border-bottom: 1px solid var(--line, #eee);
  font-size: .95rem;
}
.aw-noti-readall {
  border: none; background: none; cursor: pointer;
  font-size: .78rem; font-weight: 600; color: var(--brand); padding: .1rem .3rem; border-radius: 8px;
}
.aw-noti-readall:hover { background: var(--brand-fade); }
.aw-noti-readall:disabled { opacity: .5; cursor: progress; }

.aw-noti-list { max-height: min(58vh, 380px); overflow-y: auto; overscroll-behavior: contain; }

.aw-noti-item {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .7rem .9rem; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--line, #f0f0f0);
  transition: background .13s;
}
.aw-noti-item:last-child { border-bottom: none; }
.aw-noti-item:hover { background: var(--brand-fade); color: inherit; }
.aw-noti-item.unread { background: var(--brand-fade); }
.aw-noti-item.unread .aw-noti-ico { background: var(--brand); color: #fff; }

.aw-noti-ico {
  flex: none; width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center; font-size: .95rem;
  background: var(--bg-soft, #f2f4f3); color: var(--brand);
}
.aw-noti-tx { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.aw-noti-tx b { font-size: .86rem; font-weight: 700; line-height: 1.35; }
.aw-noti-body {
  font-size: .78rem; opacity: .75; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.aw-noti-ago { font-size: .7rem; opacity: .55; }

.aw-noti-empty { padding: 1.6rem .9rem; text-align: center; font-size: .85rem; opacity: .6; }

.aw-noti-foot {
  display: block; padding: .6rem; text-align: center;
  font-size: .82rem; font-weight: 600; color: var(--brand);
  text-decoration: none; border-top: 1px solid var(--line, #eee);
  background: var(--bg-soft, #fafafa);
}
.aw-noti-foot:hover { background: var(--brand-fade); color: var(--brand-deep); }

/* จอเล็ก: ยึดกับ viewport ไม่ใช่ยึดกับปุ่ม
   กระดิ่งอยู่กลางแถบบน ถ้ากางกล่องกว้างเท่าจอโดยยึดขอบขวาของปุ่ม กล่องจะทะลุขอบซ้ายออกไป
   (จอ 414 เคยล้นไปถึง -84px) — fixed จึงคุมได้แน่นอนทั้งสองข้าง */
@media (max-width: 575.98px) {
  /* top อิงจากก้นแถบบนจริง ๆ ผ่านตัวแปร แถบหน้าบ้าน 55px แถบหลังบ้านตั้งค่าเองได้
     (ตัวรายการข้างในมี max-height ของตัวเองอยู่แล้ว ไม่ต้องคุมความสูงซ้ำ) */
  .aw-noti-pop {
    position: fixed; top: calc(var(--aw-navh, 55px) + 8px);
    left: 10px; right: 10px; width: auto;   /* ไม่ใช้ 100vw เพราะรวมความกว้างสกรอลบาร์เข้าไปด้วย */
  }
}
