* {
  box-sizing: border-box;
}

:root {
  --magicbell-font-family: Verdana, Tahoma, sans-serif;

  --magicbell-text-dimm: #EDEDEF;
  --magicbell-text-muted: #A09FA6;
  --magicbell-text-default: #3b3b3b;
  --magicbell-text-contrast: #EDEDEF;
  --magicbell-text-highlight: #FFEF5C;
  --magicbell-text-link: #6E56CF;
  --magicbell-text-link-hover: #7C66DC;
  --magicbell-text-link-active: #9E8CFC;
  --magicbell-text-info: #849DFF;
  --magicbell-text-success: #63C174;
  --magicbell-text-warning: #F1A10D;
  --magicbell-text-error: #F16A50;

  --magicbell-bg-default: #fff;
  --magicbell-bg-active: #f8f5ff;
  --magicbell-bg-hover: #f2edfc;

  --magicbell-surface-bg: #fff;
  --magicbell-surface-bg-hover: #f2edfc;
  --magicbell-surface-bg-active: #f8f5ff;
  --magicbell-surface-text: #3b3b3b;
  --magicbell-surface-text-hover: #3b3b3b;
  --magicbell-surface-text-active: #3b3b3b;

  --magicbell-primary-bg: #6E56CF;
  --magicbell-primary-bg-hover: #7C66DC;
  --magicbell-primary-bg-active: #9E8CFC;

  --magicbell-error-bg: #E54D2E;
  --magicbell-error-bg-hover: #EC5E41;
  --magicbell-error-bg-active: #F17B5A;

  --magicbell-success-bg: #46A758;
  --magicbell-success-bg-hover: #5DB46B;
  --magicbell-success-bg-active: #7AC58A;

  --magicbell-border-muted: #EDEDEF;
  --magicbell-border-default: #A09FA6;
  --magicbell-border-highlight: #4D5E94;

  --magicbell-spacing-xs: 0.25rem;
  --magicbell-spacing-sm: 0.5rem;
  --magicbell-spacing-md: 0.75rem;
  --magicbell-spacing-lg: 1rem;
  --magicbell-spacing-xl: 1.5rem;

  --magicbell-radius-xs: 0.125rem;
  --magicbell-radius-sm: 0.25rem;
  --magicbell-radius-md: 0.5rem;
  --magicbell-radius-lg: 0.75rem;
  --magicbell-radius-xl: 1rem;

  --magicbell-shadow-base: 0px -1px 1px 0px rgba(0, 0, 0, .05), 0px 1px 2px 0px rgba(0, 0, 0, .15);
  --magicbell-shadow-elevated: 0px -1px 1px 0px rgba(0, 0, 0, .05), 0px 8px 14px 3px rgba(31, 41, 51, .08), 0px 2px 2px 0px rgba(0, 0, 0, .07)
}

@keyframes magicbell-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes magicbell-fade-out-down {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes magicbell-pulse {
  0% {
    transform: scale(.33);
  }
  80%, 100% {
    opacity: 0;
  }
}

@keyframes magicbell-scale-in {
  from {
    opacity: 0;
    transform: scale(0);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes magicbell-scale-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0);
  }
}

.magicbell--floating-menu {
  display: block;
  box-shadow: var(--magicbell-shadow-base);
  margin: 0;
  padding: var(--magicbell-spacing-xs) 0;
  background: var(--magicbell-surface-bg);
  border-radius: var(--magicbell-radius-sm);
  list-style: none;
}

.magicbell--floating-menu--item {
  display: block;
  white-space: nowrap;
}

.magicbell--floating-menu--item > button {
  font-family: var(--magicbell-font-family);
  font-size: 0.875rem;
  color: var(--magicbell-surface-text);
  border: none;
  padding: var(--magicbell-spacing-sm) var(--magicbell-spacing-lg);
  margin: 0;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.magicbell--floating-menu--item > button:hover, .magicbell--floating-menu--item > button:focus {
  background-color: var(--magicbell-surface-bg-hover);
  color: var(--magicbell-surface-text-hover);
}

.magicbell--floating-menu--item > button:active {
  background-color: var(--magicbell-surface-bg-active);
  color: var(--magicbell-surface-text-active);
}

.magicbell--menu-button {
  color: var(--magicbell-text-default);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
}

.magicbell--inbox {
  font-family: var(--magicbell-font-family);
  background-color: var(--magicbell-bg-default);
  border: 1px solid var(--magicbell-border-muted);
  border-radius: var(--magicbell-radius-lg);
  overflow: hidden;
}

.magicbell--inbox[data-floating="true"] {
  box-shadow: var(--magicbell-shadow-elevated);
  overflow: hidden;
}

.magicbell--inbox-header {
  display: flex;
  padding: 0 1rem;
  gap: .75rem;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--magicbell-border-muted);
}

.magicbell--inbox-header--title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--magicbell-text-default);
  padding: 0.75rem 0;
}

.magicbell--inbox-header--actions {
  display: flex;
  gap: var(--magicbell-spacing-sm);
}

.magicbell--inbox-header--button {
  font-family: var(--magicbell-font-family);
  font-size: 0.875rem;
  padding: var(--magicbell-spacing-xs);
  border: none;
  color: var(--magicbell-text-default);
  background: none;
  cursor: pointer;
  border-radius: var(--magicbell-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.magicbell--inbox-header--button svg {
  width: 1.25rem;
  height: 1.25rem;
}

.magicbell--inbox-header--button:hover, .magicbell--inbox-header--button:focus {
  background-color: var(--magicbell-bg-hover);
}

.magicbell--inbox-footer {
  padding: .5rem 1rem;
  border-top: 1px solid var(--magicbell-border-muted);
  line-height: 1rem;
  display: flex;
  align-items: center;
}

.magicbell--inbox-footer--logo, .magicbell--inbox-footer--logo a {
  display: inline-flex;
  align-items: center;
  color: #5225c1;
  line-height: 1rem;
}

.magicbell--inbox-item {
  width: 100%;
  height: 100%;
  padding: .5rem 1rem;
  display: grid;
  grid-template-areas:
    "title date"
    "content action";
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  font-size: .875rem;
  line-height: 1.4;
  color: var(--magicbell-text-default);
  cursor: pointer;
}

.magicbell--inbox-item:not(:last-child) {
  border-bottom: 1px solid var(--magicbell-border-muted);
}

.magicbell--inbox-item[data-status="unread"] {
  background-color: var(--magicbell-bg-active);
}

.magicbell--inbox-item:not(:has(.magicbell--inbox-item--content)) {
  grid-template-areas:
    "title date"
    "title action";
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
}

.magicbell--inbox-item:hover, .magicbell--inbox-item:focus-within {
  background-color: var(--magicbell-bg-hover);
}

.magicbell--inbox-item .magicbell--menu-button {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.magicbell--inbox-item .magicbell--menu-button svg {
  transform: rotate(90deg);
}

.magicbell--inbox-item:hover .magicbell--menu-button, .magicbell--inbox-item:focus-within .magicbell--menu-button {
  opacity: 1;
}

.magicbell--inbox-item--action {
  grid-area: action;
  margin: .5rem 0 0 .5rem;
  justify-self: end;
}

.magicbell--inbox-item--title {
  grid-area: title;
  margin: .5rem 0 0 0;
}

.magicbell--inbox-item--date {
  grid-area: date;
  font-size: .75rem;
  color: var(--magicbell-text-muted);
  margin: .5rem 0 0 0;
}

.magicbell--inbox-item--content {
  grid-area: content;
  margin: .5rem 0;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  text-overflow: ellipsis;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

.magicbell--inbox--empty-state {
  font-family: var(--magicbell-font-family);
  color: var(--magicbell-text-default);
  font-size: 0.875rem;
  font-style: italic;
  text-align: center;
  padding: 2.5rem;
  overflow: hidden;
}

.magicbell--inbox--empty-state p {
  margin: 0;
}

.magicbell--inbox--empty-state img {
  display: block;
  margin: 2rem auto;
}

.magicbell--inbox .magicbell--user-preferences {
  padding: 1rem;
  overflow-y: auto;
  scrollbar-gutter: stable;
  height: 100%;
}

.magicbell--notification-bar {
  font-family: var(--magicbell-font-family);
  background: var(--magicbell-primary-bg);
  color: var(--magicbell-text-default);
  width: 100%;
  padding: .5rem 1rem;

  display: grid;
  grid-template-areas:
    "title content action";
  grid-template-columns: auto 1fr auto;
  font-size: .875rem;
}

.magicbell--notification-bar--title {
  grid-area: title;
  align-self: center;
}

.magicbell--notification-bar--date {
  display: none;
  font-size: .75rem;
  color: var(--magicbell-text-muted);
}

.magicbell--notification-bar--action {
  grid-area: action;
  display: flex;
  align-items: center;
}

.magicbell--notification-bar--content {
  grid-area: content;
}

.magicbell--inline-notification[data-variant="bar"][data-status="active"] {
  animation-name: magicbell-fade-in-up;
}

.magicbell--inline-notification[data-variant="bar"][data-status="inactive"] {
  animation-name: magicbell-fade-out-down;
}

.magicbell--notification-dot {
  background: rgb(229, 77, 46);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
  animation: pulse 2s infinite;
}

.magicbell--notification-dot:before {
  content: '';
  display: block;
  width: 300%;
  height: 300%;
  box-sizing: border-box;
  position: absolute;
  left: 0;
  top: 0;
  margin-top: -100%;
  margin-left: -100%;
  border-radius: 50%;
  background: rgb(229, 77, 46);
  animation: magicbell-pulse 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.magicbell--inline-notification {
  width: 100%;
  height: 100%;
  animation-duration: 0.3s;
  animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  animation-fill-mode: both;
}

.magicbell--inline-notification[data-variant="dot"][data-status="active"] {
  animation-name: magicbell-scale-in;
}

.magicbell--inline-notification[data-variant="dot"][data-status="inactive"] {
  animation-name: magicbell-scale-out;
}

/** further animations are applied via the children **/

.magicbell--inbox-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.magicbell--inbox-button-badge {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(35%, -35%);
}

.magicbell--inbox[data-floating="true"] {
  box-shadow: var(--magicbell-shadow-elevated);
  overflow: hidden;
}

.magicbell--button {
  font-family: var(--magicbell-font-family);
}

.magicbell--button {
  border: none;
  font-size: .75rem;
  font-weight: 300;
  line-height: 1;
  padding: var(--magicbell-spacing-sm) var(--magicbell-spacing-md);
  border-radius: var(--magicbell-radius-sm);
  transition: background-color 0.2s ease-in-out;
  background-color: var(--magicbell-primary-bg);
  color: var(--magicbell-text-contrast);
}

.magicbell--button[data-status="loading"] {
  background-color: var(--magicbell-primary-bg);
  opacity: 0.5;
}

.magicbell--button[data-status="loading"]:hover, .magicbell--button[data-status="loading"]:focus {
  background-color: var(--magicbell-primary-bg-hover);
}

.magicbell--button[data-status="loading"]:active {
  background-color: var(--magicbell-primary-bg-active);
}

.magicbell--button[data-status="success"] {
  background-color: var(--magicbell-success-bg);
}

.magicbell--button[data-status="success"]:hover {
  background-color: var(--magicbell-success-bg-hover);
}

.magicbell--button[data-status="success"]:active {
  background-color: var(--magicbell-success-bg-active);
}

.magicbell--button[data-status="error"] {
  background-color: var(--magicbell-error-bg);
}

.magicbell--button[data-status="error"]:hover {
  background-color: var(--magicbell-error-bg-hover);
}

.magicbell--button[data-status="error"]:active {
  background-color: var(--magicbell-error-bg-active);
}

[data-magicbell-toaster] {
  --width: min(356px, 90vw);
  --offset-right: var(--magicbell-spacing-lg);
  --offset-bottom: var(--magicbell-spacing-lg);
  --gap: 14px;
  --border-radius: var(--magicbell-radius-md);
  --normal-bg: var(--magicbell-surface-bg);
  --normal-border: var(--magicbell-border-color);
  --normal-text: var(--magicbell-surface-text);
  position: fixed;
  width: var(--width);
  z-index: 9999;
  box-sizing: border-box;
  font-family: var(--magicbell-font-family, ui-sans-serif, system-ui, -apple-system);
  transition: transform 400ms ease;
}

[data-magicbell-toaster][data-x-position='right'] {
  right: var(--offset-right);
}

[data-magicbell-toaster][data-y-position='bottom'] {
  bottom: var(--offset-bottom);
}

.magicbell--toast-list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.magicbell--toast {
  --toast-accent: var(--normal-text);
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--width);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px;
  background: var(--normal-bg);
  border: 1px solid var(--normal-border);
  color: var(--normal-text);
  border-radius: var(--border-radius);
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
  font-size: 13px;
  line-height: 1.4;
  box-sizing: border-box;
  z-index: var(--toast-z-index);
  opacity: 0;
  transform: translateY(100%);
  transition: transform 400ms, opacity 400ms, box-shadow 200ms, height 400ms;
  will-change: transform, opacity;
}

.magicbell--toast[data-type='success'] {
  --toast-accent: var(--magicbell-text-success);
  --normal-border: color-mix(
    in srgb,
    var(--magicbell-text-success) 25%,
    transparent
  );
}

.magicbell--toast[data-type='info'] {
  --toast-accent: var(--magicbell-text-info);
  --normal-border: color-mix(
    in srgb,
    var(--magicbell-text-info) 25%,
    transparent
  );
}

.magicbell--toast[data-type='warning'] {
  --toast-accent: var(--magicbell-text-warning, #f59e0b);
  --normal-border: color-mix(
    in srgb,
    var(--magicbell-text-warning, #f59e0b) 25%,
    transparent
  );
}

.magicbell--toast[data-type='error'] {
  --toast-accent: var(--magicbell-text-error);
  --normal-border: color-mix(
    in srgb,
    var(--magicbell-text-error) 25%,
    transparent
  );
}

.magicbell--toast[data-mounted='true'] {
  opacity: 1;
  transform: translateY(0);
}

.magicbell--toast[data-expanded='false'][data-front='false'] {
  transform: translateY(calc(var(--toast-collapsed-offset) * -1))
    scale(calc(1 - var(--toast-index) * 0.05));
  opacity: calc(1 - var(--toast-index) * 0.12);
}

.magicbell--toast-container[data-expanded='true'] .magicbell--toast {
  transform: translateY(calc(var(--toast-offset) * -1));
  opacity: 1;
  transition-delay: calc(var(--toast-index) * 30ms);
}

.magicbell--toast-container[data-expanded='true']
  .magicbell--toast[data-visible='false'] {
  opacity: 0;
  pointer-events: none;
}

.magicbell--toast[data-removed='true'] {
  opacity: 0;
  transform: translateY(100%);
  transition-delay: 0ms;
}

.magicbell--toast[data-expanded='true']::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 100%;
  width: 100%;
  height: calc(var(--gap) + 2px);
}

.magicbell--toast[data-visible='false'] {
  opacity: 0;
  pointer-events: none;
}

.magicbell--toast[data-expanded='false'][data-front='false'][data-visible='false'] {
  opacity: 0;
}

.magicbell--toast-icon {
  display: flex;
  height: 16px;
  width: 16px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--toast-accent);
}

.magicbell--toast-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.magicbell--toast-title {
  font-weight: 500;
  color: inherit;
  line-height: 1.5;
}

.magicbell--toast-description {
  font-weight: 400;
  color: var(--magicbell-text-muted);
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.magicbell--toast-close {
  position: absolute;
  top: 0;
  right: 0;
  height: 20px;
  width: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  color: var(--normal-text);
  background: var(--normal-bg);
  border: 1px solid var(--normal-border);
  transform: translate(35%, -35%);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms, background 200ms, border-color 200ms;
}

.magicbell--toast:hover .magicbell--toast-close,
.magicbell--toast:focus-within .magicbell--toast-close {
  opacity: 1;
}

.magicbell--toast-close:hover,
.magicbell--toast-close:focus {
  background: color-mix(in srgb, var(--normal-bg) 80%, var(--normal-text));
}

.magicbell--toast-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.magicbell--toast-loader[data-visible='false'] {
  display: none;
}

.magicbel--toast-loader svg {
  width: 16px;
  height: 16px;
  animation: magicbell-toast-spin 1s linear infinite;
}

@keyframes magicbell-toast-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.magicbell--user-preferences {
  font-family: var(--magicbell-font-family);
  color: var(--magicbell-text-default);
}

/* States */

.magicbell--user-preferences--loading {
  font-size: 0.875rem;
  color: var(--magicbell-text-muted);
  padding: var(--magicbell-spacing-lg);
}

.magicbell--user-preferences--error {
  font-size: 0.875rem;
  color: var(--magicbell-text-error);
  background: color-mix(in srgb, var(--magicbell-error-bg) 10%, #fff);
  border: 1px solid var(--magicbell-error-bg);
  border-radius: var(--magicbell-radius-sm);
  padding: var(--magicbell-spacing-sm) var(--magicbell-spacing-md);
}

.magicbell--user-preferences--section {
  display: block;
}

.magicbell--user-preferences--section:not(:first-child) {
  margin-top: var(--magicbell-spacing-lg);
}

.magicbell--user-preferences--title {
  font-size: .875rem;
  font-weight: 400;
  margin: 0 0 var(--magicbell-spacing-sm) 0;
  color: var(--magicbell-text-default);
}

/* Channel row */

.magicbell--user-preferences--channel {
  font-size: .875rem;
  font-weight: 300;
  line-height: 1;
  display: flex;
  align-items: normal;
  gap: var(--magicbell-spacing-sm);
  padding: var(--magicbell-spacing-xs) var(--magicbell-spacing-sm);
  border-radius: var(--magicbell-radius-sm);
  cursor: pointer;
  color: var(--magicbell-text-default);
  transition: background-color 0.2s ease-in-out;
}

.magicbell--user-preferences--channel:hover,
.magicbell--user-preferences--channel:focus-within {
  background-color: var(--magicbell-surface-bg-hover);
}

.magicbell--user-preferences--channel:active {
  background-color: var(--magicbell-surface-bg-active);
}

/* Checkbox styling */

.magicbell--user-preferences--channel > input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--magicbell-primary-bg);
  border-radius: var(--magicbell-radius-xs);
}
