/**
 * Custom-UI: Premium Notification & Modal System
 * Built for NS Pet Clinic - 2026
 */

:root {
  --ui-primary: #10b981; /* Default emerald-500 */
  --ui-success: #059669;
  --ui-error: #ef4444;
  --ui-warning: #f59e0b;
  --ui-info: #3b82f6;
  --ui-bg-glass: rgba(255, 255, 255, 0.7);
  --ui-blur: 15px;
}

/* Container for Toasts */
#app-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  top: auto;
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none; /* Allows clicks to pass through container */
}

/* Individual Toast Styling */
.app-toast {
  pointer-events: auto;
  min-width: 320px;
  max-width: 450px;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  background: var(--ui-bg-glass);
  backdrop-filter: blur(var(--ui-blur));
  -webkit-backdrop-filter: blur(var(--ui-blur));
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 1rem;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.3s ease;
  opacity: 0;
}

.app-toast.show {
  transform: translateX(0);
  opacity: 1;
}

.app-toast-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
}

.app-toast-content {
  flex-grow: 1;
}

.app-toast-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1f2937;
  margin-bottom: 0.125rem;
}

.app-toast-message {
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.25;
}

/* Variants */
.app-toast-success .app-toast-icon { background: var(--ui-success); }
.app-toast-error .app-toast-icon { background: var(--ui-error); }
.app-toast-warning .app-toast-icon { background: var(--ui-warning); }
.app-toast-info .app-toast-icon { background: var(--ui-info); }

/* Modal Backdrop */
#app-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none; /* Hidden by default */
  transition: opacity 0.3s ease;
}

#app-modal-overlay.show {
  display: flex;
  opacity: 1;
  pointer-events: auto; /* Active when shown */
}

/* Modal Content */
.app-modal {
  background: white;
  width: 90%;
  max-width: 480px;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

#app-modal-overlay.show .app-modal {
  transform: scale(1) translateY(0);
}

.app-modal-header {
  padding: 1.5rem 1.5rem 0.5rem;
  text-align: center;
}

.app-modal-icon-container {
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.75rem;
}

.app-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.app-modal-body {
  padding: 0.5rem 1.5rem 1.5rem;
  text-align: center;
  color: #64748b;
  font-size: 1rem;
  line-height: 1.5;
}

.app-modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.app-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  outline: none;
  min-width: 100px;
}

.app-btn-primary {
  background: var(--ui-primary);
  color: white;
}

.app-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.app-btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.app-btn-secondary:hover {
  background: #e2e8f0;
}

/* Animations for removal */
.app-toast.hide {
  transform: translateX(120%);
  opacity: 0;
}

/* ── Page Builder: Responsive Visibility ── */
@media (min-width: 992px) {
    .pb-hide-desktop { display: none !important; }
}

@media (min-width: 768px) and (max-width: 991px) {
    .pb-hide-tablet { display: none !important; }
}

@media (max-width: 767px) {
    .pb-hide-mobile { display: none !important; }
}

/* ── Full-width grid sections break out of any parent container ── */
.section-width-full {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}
.section-width-full > .pb-grid-section,
.section-width-full .pb-grid-section {
    width: 100% !important;
    max-width: 100% !important;
}
.section-width-full .boxed-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.section-width-full .pb-columns-wrap {
    width: 100% !important;
}

/* ── Elementor-compatible Grid Rules (global) ── */
.pb-grid-section { position: relative; width: 100%; }
.pb-columns-wrap { display: flex; flex-wrap: wrap; width: 100%; position: relative; box-sizing: border-box; }
.pb-column { position: relative; min-height: 1px; min-width: 0; display: flex; box-sizing: border-box; overflow: hidden; }
.pb-widget-wrap { position: relative; width: 100%; flex: 1; display: flex; flex-wrap: wrap; align-content: flex-start; padding: 10px; box-sizing: border-box; }
.pb-widget-wrap > .page-section-wrapper,
.pb-widget-wrap > .section-anchor {
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 20px;
    flex-shrink: 0;
    overflow: hidden;
}
.pb-widget-wrap > .page-section-wrapper:last-of-type,
.pb-widget-wrap > .section-anchor:last-of-type { margin-bottom: 0; }
.pb-widget-wrap > .page-section-wrapper *,
.app-toast-content {
  flex-grow: 1;
}

.app-toast-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1f2937;
  margin-bottom: 0.125rem;
}

.app-toast-message {
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.25;
}

/* Variants */
.app-toast-success .app-toast-icon { background: var(--ui-success); }
.app-toast-error .app-toast-icon { background: var(--ui-error); }
.app-toast-warning .app-toast-icon { background: var(--ui-warning); }
.app-toast-info .app-toast-icon { background: var(--ui-info); }

/* Modal Backdrop */
#app-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none; /* Hidden by default */
  transition: opacity 0.3s ease;
}

#app-modal-overlay.show {
  display: flex;
  opacity: 1;
  pointer-events: auto; /* Active when shown */
}

/* Modal Content */
.app-modal {
  background: white;
  width: 90%;
  max-width: 480px;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

#app-modal-overlay.show .app-modal {
  transform: scale(1) translateY(0);
}

.app-modal-header {
  padding: 1.5rem 1.5rem 0.5rem;
  text-align: center;
}

.app-modal-icon-container {
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.75rem;
}

.app-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.app-modal-body {
  padding: 0.5rem 1.5rem 1.5rem;
  text-align: center;
  color: #64748b;
  font-size: 1rem;
  line-height: 1.5;
}

.app-modal-footer {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.app-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  outline: none;
  min-width: 100px;
}

.app-btn-primary {
  background: var(--ui-primary);
  color: white;
}

.app-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.app-btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.app-btn-secondary:hover {
  background: #e2e8f0;
}

/* Animations for removal */
.app-toast.hide {
  transform: translateX(120%);
  opacity: 0;
}

/* ── Page Builder: Responsive Visibility ── */
@media (min-width: 992px) {
    .pb-hide-desktop { display: none !important; }
}

@media (min-width: 768px) and (max-width: 991px) {
    .pb-hide-tablet { display: none !important; }
}

@media (max-width: 767px) {
    .pb-hide-mobile { display: none !important; }
}

/* ── Full-width grid sections break out of any parent container ── */
.section-width-full {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}
.section-width-full > .pb-grid-section,
.section-width-full .pb-grid-section {
    width: 100% !important;
    max-width: 100% !important;
}
.section-width-full .boxed-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.section-width-full .pb-columns-wrap {
    width: 100% !important;
}

/* ── Elementor-compatible Grid Rules (global) ── */
.pb-grid-section { position: relative; width: 100%; }
.pb-columns-wrap { display: flex; flex-wrap: wrap; width: 100%; position: relative; box-sizing: border-box; }
.pb-column { position: relative; min-height: 1px; min-width: 0; display: flex; box-sizing: border-box; overflow: hidden; }
.pb-widget-wrap { position: relative; width: 100%; flex: 1; display: flex; flex-wrap: wrap; align-content: flex-start; padding: 10px; box-sizing: border-box; }
.pb-widget-wrap > .page-section-wrapper,
.pb-widget-wrap > .section-anchor {
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 20px;
    flex-shrink: 0;
    overflow: hidden;
}
.pb-widget-wrap > .page-section-wrapper:last-of-type,
.pb-widget-wrap > .section-anchor:last-of-type { margin-bottom: 0; }
.pb-widget-wrap > .page-section-wrapper *,
.pb-widget-wrap > .section-anchor * { max-width: 100% !important; box-sizing: border-box !important; }
.pb-widget-wrap img, .pb-widget-wrap video, .pb-widget-wrap iframe, .pb-widget-wrap canvas, .pb-widget-wrap svg { max-width: 100% !important; height: auto; }
.pb-widget-wrap .container, .pb-widget-wrap .container-fluid, .pb-widget-wrap .boxed-container {
    width: 100% !important; max-width: 100% !important;
    padding-left: 0 !important; padding-right: 0 !important;
    margin-left: 0 !important; margin-right: 0 !important;
}

/* ── Image Gallery Layouts ── */
.gallery-petperks { display: grid !important; grid-template-columns: repeat(5, 1fr) !important; grid-auto-rows: 150px !important; gap: 20px !important; width: 100% !important; }
.gallery-petperks img { width: 100% !important; height: 100% !important; object-fit: cover !important; }
.gallery-petperks img:nth-child(1) { grid-column: 1 !important; grid-row: 1 / span 2 !important; border-radius: 120px 0 0 0 !important; }
.gallery-petperks img:nth-child(2) { grid-column: 1 !important; grid-row: 3 / span 2 !important; border-radius: 0 0 0 120px !important; }
.gallery-petperks img:nth-child(3) { grid-column: 2 !important; grid-row: 1 / span 2 !important; border-radius: 120px 120px 0 0 !important; }
.gallery-petperks img:nth-child(4) { grid-column: 2 !important; grid-row: 3 / span 2 !important; border-radius: 0 0 120px 120px !important; }
.gallery-petperks img:nth-child(5) { grid-column: 3 !important; grid-row: 1 / span 4 !important; border-radius: 200px 200px 0 0 !important; }
.gallery-petperks img:nth-child(6) { grid-column: 4 !important; grid-row: 1 / span 2 !important; border-radius: 50% !important; }
.gallery-petperks img:nth-child(7) { grid-column: 4 !important; grid-row: 3 / span 2 !important; border-radius: 120px 120px 0 0 !important; }
.gallery-petperks img:nth-child(8) { grid-column: 5 !important; grid-row: 1 / span 2 !important; border-radius: 0 120px 0 0 !important; }
.gallery-petperks img:nth-child(9) { grid-column: 5 !important; grid-row: 3 / span 2 !important; border-radius: 0 0 120px 0 !important; }
@media(max-width: 991px) { .gallery-petperks { grid-template-columns: repeat(3, 1fr) !important; grid-auto-rows: 130px !important; } .gallery-petperks img:nth-child(6), .gallery-petperks img:nth-child(7), .gallery-petperks img:nth-child(8), .gallery-petperks img:nth-child(9) { display: none !important; } }
@media(max-width: 767px) { .gallery-petperks { grid-template-columns: repeat(2, 1fr) !important; grid-auto-rows: 150px !important; } .gallery-petperks img:nth-child(5) { display: none !important; } }

.gallery-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important; gap: 20px !important; width: 100% !important; }
.gallery-grid img { width: 100% !important; height: 240px !important; object-fit: cover !important; border-radius: 12px !important; }

.gallery-masonry { columns: 3 !important; column-gap: 20px !important; width: 100% !important; }
.gallery-masonry img { width: 100% !important; height: auto !important; object-fit: cover !important; border-radius: 12px !important; margin-bottom: 20px !important; break-inside: avoid !important; display: block !important; }
@media(max-width: 767px) { .gallery-masonry { columns: 2 !important; } } @media(max-width: 480px) { .gallery-masonry { columns: 1 !important; } }

.gallery-carousel { display: flex !important; overflow-x: auto !important; gap: 20px !important; padding-bottom: 20px !important; scroll-snap-type: x mandatory !important; }
.gallery-carousel::-webkit-scrollbar { height: 6px !important; }
.gallery-carousel::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15) !important; border-radius: 4px !important; }
.gallery-carousel img { flex: 0 0 300px !important; height: 350px !important; object-fit: cover !important; border-radius: 16px !important; scroll-snap-align: start !important; }
@media(max-width: 767px) { .gallery-carousel img { flex: 0 0 250px !important; height: 300px !important; } }

.gallery-circles { display: flex !important; flex-wrap: wrap !important; justify-content: center !important; gap: 24px !important; width: 100% !important; }
.gallery-circles img { width: 180px !important; height: 180px !important; border-radius: 50% !important; object-fit: cover !important; }
@media(max-width: 767px) { .gallery-circles img { width: 140px !important; height: 140px !important; } }

.gallery-collage { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 16px !important; width: 100% !important; grid-auto-rows: 200px !important; }
.gallery-collage img { width: 100% !important; height: 100% !important; object-fit: cover !important; border-radius: 12px !important; }
.gallery-collage img:nth-child(1) { grid-row: span 2 !important; }
.gallery-collage img:nth-child(4) { grid-column: span 2 !important; }

/* Account block (header/page builder "Account" element). No !important on
   cosmetic properties (color/background/font/border-radius/padding) — these
   are exactly what the native Style Manager's Colors/Fonts/Size sectors edit
   via a generated #id rule, which must be free to win over these defaults. */
ns-auth-nav { display: inline-flex; align-items: center; justify-content: center; }
ns-auth-nav .ns-acc-link {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%; height: 100%; box-sizing: border-box; text-decoration: none;
    color: inherit; font: inherit; background: inherit; border-radius: inherit; padding: inherit;
}
ns-auth-nav.ns-acc-icon-only .ns-acc-label { display: none; }
/* The pill background is a property of the Login/Register LINK itself, not
   the <ns-auth-nav> wrapper — header-auth.blade.php also nests the search/
   wishlist/cart icons inside that same wrapper, so painting the background
   on ns-auth-nav swept the icons into the pill too. Scoping it to
   .ns-acc-link keeps the pill tight around just the button. */
ns-auth-nav.ns-acc-button    { font-size: 13px; font-weight: 600; }
ns-auth-nav.ns-acc-button .ns-acc-link { background: #204841; color: #fff; border-radius: 6px; padding: 8px 16px; }
ns-auth-nav.ns-acc-icon-text { background: transparent; color: #222; font-size: 13px; font-weight: 600; padding: 4px; }
ns-auth-nav.ns-acc-icon-only { background: transparent; color: #222; padding: 4px; }

/* ns-acc-menu:start ─────────────────────────────────────────────────────
   Logged-in customer dropdown (header-auth.blade.php). Self-contained — no
   Bootstrap — and also inlined once per page by
   partials/blocks/_account-menu-assets.blade.php for themes that don't load
   this stylesheet (General, Scholara, …). Colours inherit theme variables
   when present: Scholara's --sc-*, then the brand tokens, then defaults. */
.ns-acc-menu {
    --ns-acc-pri: var(--sc-pri, var(--brand-primary, #204841));
    --ns-acc-ink: var(--sc-ink, var(--brand-ink, #111827));
    --ns-acc-soft: var(--sc-soft, var(--brand-surface-muted, #f3f4f6));
    --ns-acc-line: var(--sc-line, var(--brand-border-color, #e5e7eb));
    --ns-acc-r: var(--sc-r, var(--brand-radius, 12px));
    position: relative; display: inline-flex; align-items: center;
}
.ns-acc-menu .ns-acc-trigger {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    border: 0; background: transparent; color: inherit; font: inherit; line-height: 1;
    padding: 4px 6px; border-radius: 999px; width: auto; height: auto;
}
.ns-acc-menu .ns-acc-trigger:focus-visible { outline: 2px solid var(--ns-acc-pri); outline-offset: 2px; }
.ns-acc-menu .ns-acc-avatar {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--ns-acc-pri); color: #fff; font-size: 14px; font-weight: 700;
}
.ns-acc-menu .ns-acc-name { font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-acc-menu .ns-acc-caret { transition: transform .15s; opacity: .7; }
.ns-acc-menu .ns-acc-trigger[aria-expanded="true"] .ns-acc-caret { transform: rotate(180deg); }
.ns-acc-menu .ns-acc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ns-acc-menu .ns-acc-panel {
    position: absolute; top: calc(100% + 8px); right: 0; left: auto; z-index: 10050;
    min-width: 220px; max-width: calc(100vw - 24px); box-sizing: border-box;
    background: #fff; color: var(--ns-acc-ink); text-align: left;
    border: 1px solid var(--ns-acc-line); border-radius: var(--ns-acc-r);
    box-shadow: 0 18px 40px rgba(15, 23, 42, .16); padding: 6px; margin: 0; list-style: none;
    font-size: 14px; font-weight: 500; line-height: 1.35;
}
.ns-acc-menu .ns-acc-panel[hidden] { display: none; }
.ns-acc-menu .ns-acc-head { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 8px; }
.ns-acc-menu .ns-acc-head-name { font-weight: 700; color: var(--ns-acc-ink); }
.ns-acc-menu .ns-acc-head-email { font-size: 12px; opacity: .65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-acc-menu .ns-acc-item {
    display: flex; align-items: center; width: 100%; box-sizing: border-box; margin: 0;
    padding: 9px 12px; border: 0; border-radius: calc(var(--ns-acc-r) - 4px);
    background: transparent; color: var(--ns-acc-ink); font: inherit; text-align: left;
    text-decoration: none; cursor: pointer; list-style: none;
}
.ns-acc-menu .ns-acc-item:hover, .ns-acc-menu .ns-acc-item:focus-visible { background: var(--ns-acc-soft); color: var(--ns-acc-pri); outline: none; }
.ns-acc-menu .ns-acc-sep { height: 1px; margin: 6px 4px; background: var(--ns-acc-line); }
.ns-acc-menu .ns-acc-form { margin: 0; padding: 0; }
.ns-acc-menu .ns-acc-logout { color: #b91c1c; }
.ns-acc-menu .ns-acc-logout:hover, .ns-acc-menu .ns-acc-logout:focus-visible { background: #fef2f2; color: #b91c1c; }
/* Icon-only Account blocks, and Scholara's header (.sch-act forces
   .ns-acc-link into a 46px round icon): show just the initials. */
ns-auth-nav.ns-acc-icon-only .ns-acc-menu .ns-acc-name,
ns-auth-nav.ns-acc-icon-only .ns-acc-menu .ns-acc-caret,
.sch-act .ns-acc-menu .ns-acc-name,
.sch-act .ns-acc-menu .ns-acc-caret { display: none; }
.sch-act .ns-acc-menu .ns-acc-trigger { padding: 0; justify-content: center; }
.sch-act .ns-acc-menu .ns-acc-avatar { width: 100%; height: 100%; min-width: 34px; min-height: 34px; }
@media (max-width: 640px) {
    .ns-acc-menu .ns-acc-name, .ns-acc-menu .ns-acc-caret { display: none; }
    .ns-acc-menu .ns-acc-panel { min-width: 200px; }
}
/* ns-acc-menu:end ─────────────────────────────────────────────────────── */

/* Ensure header links inherit font-family in the editor and frontend */
.site-header a, .site-header span:not(.hb-badge, .fa, .fab, .fas, .far), .site-header li {
    font-family: inherit !important;
}
