/* Global toasts + modal alerts/confirm
   Included via menu bars.
*/

:root{
  --toast-shadow: 0 14px 34px rgba(2,6,23,.18);
}

#eos-toast-region{
  position: fixed;
  z-index: 1000000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2-5);
  pointer-events: none;
  padding: var(--space-3-5);
}

/* Desktop: top-right */
@media (min-width: 721px){
  #eos-toast-region{
    top: 62px; /* below menu */
    right: 10px;
    max-width: min(420px, calc(100vw - 20px));
  }
}

/* Mobile: bottom-center */
@media (max-width: 720px){
  #eos-toast-region{
    left: 50%;
    transform: translateX(-50%);
    bottom: 14px;
    width: calc(100vw - 20px);
    max-width: 520px;
  }
}

.eos-toast{
  pointer-events: auto;
  position: relative;
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-3-5);
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(15,23,42,.12);
  box-shadow: var(--toast-shadow);
  overflow: hidden;
  color: #0f172a;
  font-family: var(--font-family-base);
  touch-action: pan-y;
}

.eos-toast::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width: 5px;
  background: rgba(100,116,139,.55);
}

.eos-toast[data-kind="success"]::before{ background: linear-gradient(180deg, #22c55e, #16a34a); }
.eos-toast[data-kind="info"]::before{ background: linear-gradient(180deg, #0ea5e9, #007bbd); }
.eos-toast[data-kind="warning"]::before{ background: linear-gradient(180deg, #f59e0b, #d97706); }
.eos-toast[data-kind="error"]::before{ background: linear-gradient(180deg, #ef4444, #dc2626); }

.eos-toast__row{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: var(--space-2-5);
}

.eos-toast__title{
  font-weight: 900;
  font-size: .92rem;
  line-height: 1.15;
  margin: 0;
}

.eos-toast__msg{
  margin-top: var(--space-1);
  font-size: .90rem;
  font-weight: 650;
  line-height: 1.35;
  color: rgba(15,23,42,.92);
  white-space: pre-wrap;
}

.eos-toast__meta{
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid rgba(15,23,42,.08);
  font-size: .78rem;
  font-weight: 700;
  color: rgba(100,116,139,.95);
}

.eos-toast__close{
  border: 0;
  background: rgba(15,23,42,.06);
  color: rgba(15,23,42,.85);
  border-radius: var(--radius-lg);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-weight: 900;
}
.eos-toast__close:hover{ background: rgba(15,23,42,.10); }

.eos-toast__progress{
  position:absolute;
  left: 5px;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(2,6,23,.08);
}
.eos-toast__progress > div{
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: rgba(2,132,199,.45);
}

/* Enter/exit */
.eos-toast{
  animation: eosToastIn .18s ease-out;
}
@keyframes eosToastIn{
  from { transform: translateY(-6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.eos-toast.is-leaving{
  animation: eosToastOut .14s ease-in forwards;
}
@keyframes eosToastOut{
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-6px); opacity: 0; }
}

/*
  IMPORTANT:
  Legacy CSS (styles_parts.css) defines `.eos-toast` for an old, page-local toast.
  Our global toasts live inside `#eos-toast-region`.
  To prevent flicker/instant-hide due to cascade or slow CSS loads, we scope
  critical toast properties to `#eos-toast-region .eos-toast` with higher specificity.
*/
#eos-toast-region .eos-toast{
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  opacity: 1;
  transition: none;
}

/* Modal (alert/confirm) */
#eos-modal-root{
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* modern mobile viewport */
  z-index: 1000001;
  display: none;
  align-items: center;
  justify-content: center;

  /* iOS safe-area can shift visual centring if not accounted for */
  padding-top: var(--space-18px);
  padding-bottom: var(--space-18px);
  padding-left: calc(var(--space-18px) + env(safe-area-inset-left));
  padding-right: calc(var(--space-48px) + env(safe-area-inset-right));

  background: rgba(2,6,23,.62);
  backdrop-filter: blur(2px);
  overscroll-behavior: contain;
  touch-action: none;
}

body.eos-modal-open{
  overflow: hidden;
}

#eos-modal-root.is-open{ display:flex; }

.eos-modal{
  width: min(560px, calc(100vw - 36px));
  margin: 0 auto;
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(15,23,42,.14);
  border-radius: var(--radius-xl);
  box-shadow: 0 18px 48px rgba(0,0,0,.28);
  overflow: hidden;
}

.eos-modal__head{
  padding: var(--space-3-5) var(--space-4);
  border-bottom: 1px solid rgba(15,23,42,.08);
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: var(--space-3);
}

.eos-modal__title{
  font-size: 1.02rem;
  font-weight: 950;
  margin: 0;
  color: #0f172a;
}

/* Modal body */
.eos-modal__body{
  /* tighter, no big dead space */
  padding: var(--space-2-5) var(--space-3) var(--space-2px);
  color: rgba(15,23,42,.92);
  font-size: .95rem;
  font-weight: 650;
  line-height: 1.45;
}

/* Basic form styling for modal bodies (calendar create event, etc.) */
.eos-form label{
  display:block;
  font-weight: 900;
  margin: 0 0 var(--space-6px);
}

.eos-form input,
.eos-form select,
.eos-form textarea{
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-2-5) var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15,23,42,.16);
  background: #fff;
  font: inherit;
}

/* Keep modal forms tight (match copier modals vibe) */
.eos-form__row{ margin-bottom: var(--space-2); }

/* Let the native colour picker show the full palette (no weird padding) */
.eos-form input[type="color"]{
  padding: 0;
  height: 42px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
}

/* (deduped) */

.eos-modal__actions{
  padding: var(--space-3) var(--space-4) var(--space-4);
  display:flex;
  gap: var(--space-2-5);
  justify-content: center;
  flex-wrap: wrap;
}

.eos-btn{
  border: 0;
  border-radius: var(--radius-lg);
  padding: var(--space-2-5) var(--space-3-5);
  font-weight: 900;
  cursor:pointer;
}

.eos-btn--ghost{
  background: rgba(15,23,42,.06);
  color: rgba(15,23,42,.90);
}

.eos-btn--primary{
  background: #007bbd;
  color: #fff;
  box-shadow: 0 10px 20px rgba(37,99,235,.18);
}

.eos-btn--danger{
  background: #dc2626;
  color: #fff;
  box-shadow: 0 10px 20px rgba(220,38,38,.18);
}

