/* ============================================================
   Apartments Veronika — Alerts & Notifications
   No browser alert() ever. All custom.
   ============================================================ */

/* ── TOAST CONTAINER ─────────────────────────────────────── */
.av-toasts {
  position: fixed;
  top: calc(var(--banner-h, 0px) + var(--navbar-h, 72px) + 16px);
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 400px;
  width: calc(100vw - 40px);
}

/* ── TOAST ───────────────────────────────────────────────── */
.av-toast {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  background: var(--glass-bg-heavy);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  position: relative;
  overflow: hidden;
  animation: av-toast-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.av-toast.is-leaving {
  animation: av-toast-out 0.22s ease forwards;
}

@keyframes av-toast-in {
  from {
    opacity: 0;
    transform: translateX(calc(100% + 20px)) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes av-toast-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
    max-height: 200px;
    margin-bottom: 0;
  }
  to {
    opacity: 0;
    transform: translateX(calc(100% + 20px)) scale(0.96);
    max-height: 0;
    margin-bottom: -10px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

/* Accent bar on left */
.av-toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

/* Progress bar for auto-dismiss */
.av-toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: currentColor;
  opacity: 0.25;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: av-toast-progress linear forwards;
  animation-duration: var(--toast-duration, 5s);
}

@keyframes av-toast-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* Toast variants */
.av-toast--success {
  background: var(--surface);
  border-color: rgba(46, 204, 113, 0.20);
  color: var(--text);
}
.av-toast--success::before { background: var(--success); }
.av-toast--success .av-toast__icon { color: var(--success); }

.av-toast--error {
  background: var(--surface);
  border-color: rgba(229, 62, 62, 0.20);
  color: var(--text);
}
.av-toast--error::before { background: var(--error); }
.av-toast--error .av-toast__icon { color: var(--error); }
.av-toast--error::after { animation: none; width: 0; }

.av-toast--warning {
  background: var(--surface);
  border-color: rgba(246, 173, 85, 0.20);
  color: var(--text);
}
.av-toast--warning::before { background: var(--warning); }
.av-toast--warning .av-toast__icon { color: var(--warning); }

.av-toast--info {
  background: var(--surface);
  border-color: var(--accent-mid);
  color: var(--text);
}
.av-toast--info::before { background: var(--accent); }
.av-toast--info .av-toast__icon { color: var(--accent); }

.av-toast__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
  line-height: 1;
}

.av-toast__body {
  flex: 1;
  min-width: 0;
}

.av-toast__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.3;
}

.av-toast__msg {
  font-size: 0.8125rem;
  color: var(--text2);
  line-height: 1.5;
  margin: 0;
  max-width: 100%;
}

.av-toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 2px;
  font-size: 1rem;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
  margin-top: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.av-toast__close:hover {
  color: var(--text);
  background: var(--surface2);
}

/* ── INLINE FORM FEEDBACK ────────────────────────────────── */
.av-field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 5px;
  line-height: 1.4;
  animation: av-error-in 0.20s ease both;
}

@keyframes av-error-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.av-field-error::before {
  content: '⚠';
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Fields in error state */
.av-input--error,
input.av-input--error,
select.av-input--error,
textarea.av-input--error {
  border-color: var(--error) !important;
  background-color: var(--error-bg) !important;
}

/* Field success state */
.av-input--success,
input.av-input--success {
  border-color: var(--success) !important;
}

/* ── CONFIRM MODAL ───────────────────────────────────────── */
.av-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s;
}

.av-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.av-modal {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  max-width: 440px;
  width: 100%;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.av-modal-overlay.is-open .av-modal {
  transform: translateY(0) scale(1);
}

.av-modal__icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.av-modal__icon--danger  { background: var(--error-bg);   color: var(--error); }
.av-modal__icon--warning { background: var(--warning-bg); color: var(--warning); }
.av-modal__icon--info    { background: var(--info-bg);    color: var(--info); }
.av-modal__icon--success { background: var(--success-bg); color: var(--success); }

.av-modal__title {
  font-family: 'Playfair Display', serif;
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.3;
}

.av-modal__body {
  font-size: 0.9375rem;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 28px;
  max-width: 100%;
}

.av-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.av-modal__actions .btn {
  min-width: 100px;
}

/* ── PROGRESS BAR ────────────────────────────────────────── */
.av-progress {
  width: 100%;
}

.av-progress__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.8125rem;
  color: var(--text2);
}

.av-progress__track {
  height: 6px;
  background: var(--surface2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.av-progress__fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.35s ease;
  min-width: 4px;
  position: relative;
  overflow: hidden;
}

/* Shimmer on progress bar */
.av-progress__fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: av-shimmer 1.4s ease infinite;
}

@keyframes av-shimmer {
  from { left: -60%; }
  to   { left: 160%; }
}

/* Indeterminate progress */
.av-progress--indeterminate .av-progress__fill {
  width: 40% !important;
  animation: av-indeterminate 1.4s ease-in-out infinite;
}

.av-progress--indeterminate .av-progress__fill::after { display: none; }

@keyframes av-indeterminate {
  0%   { transform: translateX(-150%); }
  100% { transform: translateX(350%); }
}

/* ── SITEMAP STATUS BAR (admin) ───────────────────────────── */
.av-sitemap-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 500;
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8125rem;
  transform: translateY(100%);
  transition: transform 0.28s ease;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.10);
}

.av-sitemap-bar.is-visible {
  transform: translateY(0);
}

.av-sitemap-bar__icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.av-sitemap-bar__text {
  flex: 1;
  color: var(--text2);
}

.av-sitemap-bar__text strong { color: var(--text); }

.av-sitemap-bar .av-progress {
  width: 180px;
  flex-shrink: 0;
}

.av-sitemap-bar__dismiss {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.av-sitemap-bar__dismiss:hover { color: var(--text); }

/* ── ALERT BANNERS (inline page alerts) ──────────────────── */
.av-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.9rem;
  line-height: 1.55;
}

.av-alert--success {
  background: var(--success-bg);
  border-color: rgba(46, 204, 113, 0.25);
  color: var(--text);
}
.av-alert--error {
  background: var(--error-bg);
  border-color: rgba(229, 62, 62, 0.25);
  color: var(--text);
}
.av-alert--warning {
  background: var(--warning-bg);
  border-color: rgba(246, 173, 85, 0.25);
  color: var(--text);
}
.av-alert--info {
  background: var(--info-bg);
  border-color: var(--accent-mid);
  color: var(--text);
}

.av-alert__icon {
  flex-shrink: 0;
  font-size: 1rem;
  margin-top: 1px;
}
.av-alert--success .av-alert__icon { color: var(--success); }
.av-alert--error   .av-alert__icon { color: var(--error); }
.av-alert--warning .av-alert__icon { color: var(--warning); }
.av-alert--info    .av-alert__icon { color: var(--accent); }

.av-alert__body { flex: 1; }
.av-alert__title { font-weight: 600; color: var(--text); margin-bottom: 3px; }

/* ── LOADING SPINNER ─────────────────────────────────────── */
.av-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: av-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.av-spinner--sm { width: 14px; height: 14px; border-width: 1.5px; }
.av-spinner--lg { width: 32px; height: 32px; border-width: 3px; }

@keyframes av-spin {
  to { transform: rotate(360deg); }
}

/* ── CAPACITY WARNING ────────────────────────────────────── */
.av-capacity-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--warning-bg);
  border: 1px solid rgba(246, 173, 85, 0.30);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text);
  margin-top: 10px;
  animation: av-error-in 0.22s ease both;
}

.av-capacity-warning__icon {
  font-size: 1.1rem;
  color: var(--warning);
  flex-shrink: 0;
}

/* ── MOBILE ADJUSTMENTS ──────────────────────────────────── */
@media (max-width: 600px) {
  .av-toasts {
    right: 10px;
    left: 10px;
    width: auto;
    max-width: 100%;
    top: calc(var(--banner-h, 0px) + var(--navbar-h, 72px) + 10px);
  }

  .av-modal {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }

  .av-modal__actions {
    flex-direction: column-reverse;
  }

  .av-modal__actions .btn {
    width: 100%;
  }
}
