/* ===================================================================
   SYS_ALERTS.CSS — GrowIndia notification layer (ported from Udyamika)
   Inline alert banners, corner toasts and SweetAlert2 skinning.
   Paired with SYS_alerts.php and js/sys_alerts.js.
   =================================================================== */

html {
    --g1a-ink: #f1f5f9;
    --g1a-muted: #9aa0b8;
    --g1a-surface: rgba(11, 13, 28, .97);
    --g1a-ease: cubic-bezier(.4, 0, .2, 1);

    --g1a-success: #10B981;
    --g1a-success-ink: #6EE7B7;
    --g1a-danger: #FF334B;
    --g1a-danger-ink: #FCA5A5;
    --g1a-warning: #F59E0B;
    --g1a-warning-ink: #FCD34D;
    --g1a-info: #00E5FF;
    --g1a-info-ink: #67E8F9;
}

html[data-theme="light"] {
    --g1a-ink: #0f172a;
    --g1a-muted: #475569;
    --g1a-surface: rgba(255, 255, 255, .98);
    --g1a-success-ink: #065F46;
    --g1a-danger-ink: #9F1239;
    --g1a-warning-ink: #92400E;
    --g1a-info-ink: #0E7490;
    --g1a-info: #0891B2;
}

/* ===================================================================
   1. INLINE ALERT BANNERS
   =================================================================== */
.g1-alert {
    display: flex;
    align-items: center !important;
    gap: .75rem;
    padding: .75rem 1rem;
    margin: 0 0 .75rem;
    border-radius: 14px;
    border: 1px solid transparent;
    border-left-width: 4px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: g1a-in .35s var(--g1a-ease) both;
}

@keyframes g1a-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}

.g1-alert__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 1.1rem;
    line-height: 1;
}

.g1-alert__body {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.g1-alert__body > :last-child {
    margin-bottom: 0;
}

/* the app frequently passes <center> / headings inside alert bodies */
.g1-alert__body h1,
.g1-alert__body h2,
.g1-alert__body h3,
.g1-alert__body h4,
.g1-alert__body h5 {
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 .2rem;
    color: inherit;
}

.g1-alert__body p {
    color: inherit;
}

.g1-alert__close {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    font-size: .7rem;
    line-height: 1;
    color: inherit;
    background: transparent;
    opacity: .5;
    cursor: pointer;
    transition: all .2s var(--g1a-ease);
}

.g1-alert__close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, .07);
}

html:not([data-theme="light"]) .g1-alert__close:hover {
    background: rgba(255, 255, 255, .12);
}

/* --- variants --- */
.g1-alert--success {
    background: rgba(16, 185, 129, .10);
    border-color: rgba(16, 185, 129, .28);
    border-left-color: var(--g1a-success);
    color: var(--g1a-success-ink);
}

.g1-alert--success .g1-alert__icon { color: var(--g1a-success); }

.g1-alert--danger {
    background: rgba(255, 51, 75, .10);
    border-color: rgba(255, 51, 75, .30);
    border-left-color: var(--g1a-danger);
    color: var(--g1a-danger-ink);
}

.g1-alert--danger .g1-alert__icon { color: var(--g1a-danger); }

.g1-alert--warning {
    background: rgba(245, 158, 11, .10);
    border-color: rgba(245, 158, 11, .28);
    border-left-color: var(--g1a-warning);
    color: var(--g1a-warning-ink);
}

.g1-alert--warning .g1-alert__icon { color: var(--g1a-warning); }

.g1-alert--info,
.g1-alert--primary,
.g1-alert--secondary,
.g1-alert--light,
.g1-alert--dark {
    background: rgba(0, 229, 255, .08);
    border-color: rgba(0, 229, 255, .28);
    border-left-color: var(--g1a-info);
    color: var(--g1a-info-ink);
}

.g1-alert--info .g1-alert__icon,
.g1-alert--primary .g1-alert__icon,
.g1-alert--secondary .g1-alert__icon,
.g1-alert--light .g1-alert__icon,
.g1-alert--dark .g1-alert__icon { color: var(--g1a-info); }

/* ===================================================================
   2. TOASTS
   =================================================================== */
.g1-toasts {
    position: fixed;
    z-index: 20000;
    top: max(14px, env(safe-area-inset-top));
    right: 14px;
    left: auto;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: min(360px, calc(100vw - 28px));
    pointer-events: none;
}

.g1-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .8rem .9rem;
    border-radius: 16px;
    overflow: hidden;
    background: var(--g1a-surface);
    border: 1px solid rgba(148, 163, 184, .25);
    box-shadow: 0 12px 34px rgba(10, 25, 47, .18);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--g1a-ink);
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: transform .4s var(--g1a-ease), opacity .3s var(--g1a-ease), margin .3s var(--g1a-ease);
}

.g1-toast.is-in {
    transform: none;
    opacity: 1;
}

.g1-toast.is-out {
    transform: translateX(120%);
    opacity: 0;
    margin-bottom: -3.6rem;
}

.g1-toast__ico {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 1rem;
    color: #fff;
}

.g1-toast__body {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: .1rem;
}

.g1-toast__title {
    display: block;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: -.01em;
    line-height: 1.25;
    margin-bottom: .1rem;
}

.g1-toast__msg {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--g1a-muted);
    overflow-wrap: anywhere;
}

.g1-toast__msg br + br { display: none; }

.g1-toast__close {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--g1a-muted);
    font-size: .65rem;
    cursor: pointer;
    opacity: .6;
    transition: opacity .2s var(--g1a-ease);
}

.g1-toast__close:hover { opacity: 1; }

/* auto-dismiss progress rail */
.g1-toast__bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    opacity: .85;
}

.g1-toast--success .g1-toast__ico { background: linear-gradient(135deg, #10B981, #059669); }
.g1-toast--success .g1-toast__bar { background: #10B981; }
.g1-toast--danger  .g1-toast__ico { background: linear-gradient(135deg, #FF334B, #DC2626); }
.g1-toast--danger  .g1-toast__bar { background: #EF4444; }
.g1-toast--warning .g1-toast__ico { background: linear-gradient(135deg, #F59E0B, #D97706); }
.g1-toast--warning .g1-toast__bar { background: #F59E0B; }
.g1-toast--info    .g1-toast__ico { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.g1-toast--info    .g1-toast__bar { background: #06b6d4; }

@keyframes g1a-drain {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (max-width: 575.98px) {
    .g1-toasts {
        top: auto;
        bottom: max(14px, env(safe-area-inset-bottom));
        right: 10px;
        left: 10px;
        width: auto;
    }

    .g1-toast,
    .g1-toast.is-out {
        transform: translateY(120%);
    }

    .g1-toast.is-in {
        transform: none;
    }
}


/* in-form alert slot (e.g. Activate With Funds): breathing room above and below */
.g1-alert.g1-alert--slot { margin: 16px 0; }

/* ===================================================================
   3. SWEETALERT2 SKIN (ported from Udyamika; light + dark via the --g1a-* tokens)
   customClass: popup g1-swal | title g1-swal__title | htmlContainer g1-swal__text | confirmButton g1-swal__btn[--type]
   =================================================================== */
.swal2-popup.g1-swal {
    position: relative;
    overflow: hidden !important;
    font-family: 'Inter', system-ui, sans-serif !important;
    border-radius: 24px !important;
    padding: 1.75rem 1.5rem 1.5rem !important;
    background: var(--g1a-surface) !important;
    color: var(--g1a-ink) !important;
    border: 1px solid rgba(245, 158, 11, .30) !important;
    box-shadow: 0 30px 70px rgba(10, 15, 30, .35) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
}
.g1-swal::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: none;
}
.g1-swal .g1-swal__title,
.g1-swal__title {
    font-family: 'Inter', sans-serif !important;
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    letter-spacing: -.01em !important;
    color: var(--g1a-ink) !important;
    margin-top: .6rem !important;
}
.g1-swal .g1-swal__text,
.g1-swal__text {
    font-size: .88rem !important;
    font-weight: 500 !important;
    line-height: 1.6 !important;
    color: var(--g1a-muted) !important;
    margin: .5rem 0 0 !important;
    overflow: visible !important;
}
.g1-swal__btn {
    font-family: 'Inter', sans-serif !important;
    font-size: .8rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: .06em !important;
    padding: .7rem 2rem !important;
    margin-top: 1.1rem !important;
    border: 0 !important;
    border-radius: 13px !important;
    color: #fff !important;
    cursor: pointer !important;
    outline: none !important;
    transition: transform .2s var(--g1a-ease), box-shadow .2s var(--g1a-ease) !important;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
    box-shadow: 0 6px 18px rgba(16, 185, 129, .35) !important;
}
.g1-swal__btn:hover { transform: translateY(-2px) !important; }
.g1-swal__btn:active { transform: translateY(0) !important; }
.g1-swal__btn:focus,
.g1-swal__btn:focus-visible { outline: none !important; box-shadow: 0 6px 18px rgba(16, 185, 129, .35) !important; }
.g1-swal__btn--danger,
.g1-swal__btn--error { background: linear-gradient(135deg, #FF334B 0%, #DC2626 100%) !important; box-shadow: 0 6px 18px rgba(255, 51, 75, .35) !important; }
.g1-swal__btn--warning,
.g1-swal__btn--question { color: #0b0914 !important; background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%) !important; box-shadow: 0 6px 18px rgba(245, 158, 11, .4) !important; }
.g1-swal__btn--info { color: #0b0914 !important; background: linear-gradient(135deg, #22D3EE 0%, #06B6D4 100%) !important; box-shadow: 0 6px 18px rgba(6, 182, 212, .35) !important; }
.g1-swal .swal2-timer-progress-bar { background: rgba(245, 158, 11, .55); }

/* flash alerts (modern-alert): small close button pinned to the top-right corner */
.alert.modern-alert { position: relative; padding-right: 2.4rem !important; }
.alert.modern-alert .btn-close {
    position: absolute !important; top: 8px; right: 8px; margin: 0 !important;
    width: .5em; height: .5em; padding: .3em !important; box-sizing: content-box;
    background-size: .5em; border-radius: 6px; opacity: .5;
}
.alert.modern-alert .btn-close:hover { opacity: 1; background-color: rgba(100, 116, 139, .15); }
.alert.modern-alert .btn-close:focus-visible { outline: 2px solid #0e9bb5; outline-offset: 1px; box-shadow: none; }

/* confirm dialogs: Cancel + Confirm side by side, equal width and height */
.g1-swal .swal2-actions { flex-wrap: nowrap !important; width: 100% !important; gap: 10px !important; margin: 1.1rem 0 0 !important; }
.g1-swal .swal2-actions .g1-swal__cancel { flex: 1 1 0 !important; min-width: 0 !important; margin: 0 !important; padding: .8rem 1rem !important; min-height: 46px; display: inline-flex !important; align-items: center; justify-content: center; }
/* smaller, tinted status icon so the dialog stays compact */
/* scale through font-size: SweetAlert draws the tick / cross strokes in em for a 5em icon, so a fixed px size misplaces them */
.g1-swal .swal2-icon { font-size: 12.8px !important; width: 5em !important; height: 5em !important; margin: .4rem auto .6rem !important; }
.g1-swal .swal2-icon .swal2-icon-content { font-size: 2.4rem !important; }
.g1-swal .swal2-icon.swal2-question { color: #F59E0B !important; border-color: rgba(245, 158, 11, .45) !important; background: rgba(245, 158, 11, .1) !important; }
.g1-swal .swal2-icon.swal2-warning { color: #F59E0B !important; border-color: rgba(245, 158, 11, .45) !important; background: rgba(245, 158, 11, .1) !important; }
.g1-swal .swal2-icon.swal2-info { color: #06B6D4 !important; border-color: rgba(6, 182, 212, .45) !important; background: rgba(6, 182, 212, .1) !important; }
.g1-swal .swal2-icon.swal2-error { color: #FF334B !important; border-color: rgba(255, 51, 75, .45) !important; background: rgba(255, 51, 75, .1) !important; }
.g1-swal .swal2-actions .g1-swal__btn { flex: 1 1 0 !important; min-width: 0 !important; margin: 0 !important; padding: .8rem 1rem !important; min-height: 46px; display: inline-flex !important; align-items: center; justify-content: center; }
.g1-swal__cancel {
    font-family: 'Inter', sans-serif !important; font-size: .8rem !important; font-weight: 700 !important; text-transform: uppercase !important; letter-spacing: .06em !important;
    border-radius: 13px !important; cursor: pointer !important; color: var(--g1a-muted) !important; background: transparent !important;
    border: 1.5px solid rgba(148, 163, 184, .4) !important; box-shadow: none !important; transition: border-color .2s, color .2s, transform .2s !important;
}
.g1-swal__cancel:hover { color: var(--g1a-ink) !important; border-color: rgba(148, 163, 184, .8) !important; transform: translateY(-1px) !important; }
.g1-swal__cancel:focus-visible, .g1-swal__btn:focus-visible { outline: 2px solid #0e9bb5 !important; outline-offset: 2px !important; }

/* summary body used inside confirm dialogs (amount + rows + notice) */
.g1-sum { text-align: left; }
.g1-sum__amt { text-align: center; font-size: 2rem; font-weight: 800; line-height: 1.1; color: var(--g1a-ink); margin: .1rem 0 .7rem; font-variant-numeric: tabular-nums; }
.g1-sum__row { display: flex; justify-content: space-between; gap: 12px; padding: .55rem 0; border-top: 1px dashed rgba(148, 163, 184, .35); font-size: .85rem; color: var(--g1a-muted); }
.g1-sum__row b { color: var(--g1a-ink); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.g1-sum__row b.pos { color: #10B981; }
.g1-sum__note { display: flex; gap: 8px; align-items: flex-start; margin-top: .8rem; padding: .6rem .8rem; border-radius: 12px; font-size: .78rem; line-height: 1.5; color: var(--g1a-ink); background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .35); }
.g1-sum__note i { margin-top: 2px; color: #F59E0B; }

/* the success tick is drawn with masks coloured like the default popup background; hide them so no wedges show */
.swal2-popup.g1-swal .swal2-success-circular-line-left,
.swal2-popup.g1-swal .swal2-success-circular-line-right,
.swal2-popup.g1-swal .swal2-success-fix,
.swal2-popup.g1-swal [class^='swal2-success-circular-line'] { display: none !important; background: transparent !important; }
.g1-swal .swal2-icon.swal2-success { border-color: rgba(16, 185, 129, .45) !important; color: #10B981 !important; }
.g1-swal .swal2-icon.swal2-success [class^='swal2-success-line'] { background: #10B981 !important; }
.g1-swal .swal2-icon.swal2-success .swal2-success-ring { border-color: rgba(16, 185, 129, .25) !important; }

/* body used by the "saved / activated" popups */
.gi-sw { margin-top: .2rem; }
.gi-sw .amt { font-size: 2rem; font-weight: 800; color: var(--g1a-warning); line-height: 1.1; }
html[data-theme="light"] .gi-sw .amt { color: #b45309; }
.gi-sw .amt.addr {
    font-family: 'Space Grotesk', ui-monospace, monospace;
    font-size: .92rem !important;
    font-weight: 700;
    line-height: 1.5;
    color: var(--g1a-ink);
    word-break: break-all;
    padding: .65rem .8rem;
    border-radius: 12px;
    background: rgba(148, 163, 184, .12);
    border: 1px solid rgba(148, 163, 184, .28);
}
.gi-sw .tier {
    display: inline-block; margin: .5rem 0 .9rem; padding: .28rem .85rem; border-radius: 999px;
    font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    color: var(--g1a-success-ink); background: rgba(16, 185, 129, .12); border: 1px solid rgba(16, 185, 129, .35);
}
.gi-sw .rows { border-top: 1px solid rgba(148, 163, 184, .25); padding-top: .7rem; }
.gi-sw .rows div { display: flex; justify-content: space-between; padding: .25rem 0; font-size: .85rem; color: var(--g1a-muted); }
.gi-sw .rows b { color: var(--g1a-ink); }
.gi-sw .rows .g b { color: #10B981; }

/* Toknex adaptation: light admin panels, theme-aware customer portal, large touch targets. */
html[data-gw-alert-theme="light"] { --g1a-ink:#0f172a; --g1a-muted:#475569; --g1a-surface:rgba(255,255,255,.98); --g1a-success-ink:#065f46; --g1a-danger-ink:#9f1239; --g1a-warning-ink:#92400e; --g1a-info-ink:#0e7490; --g1a-info:#0891b2; }
.g1-toast__ico svg { width:20px; height:20px; }
.g1-toast__close { width:36px; height:36px; font-size:24px; }
.swal2-container { z-index:10000 !important; }
.swal2-popup.g1-swal { width:min(460px,calc(100vw - 24px)); max-width:calc(100vw - 24px); padding:24px !important; border-color:rgba(99,102,241,.22) !important; }
.g1-swal .swal2-actions { gap:8px; flex-wrap:wrap; }
.g1-swal .swal2-confirm, .g1-swal .swal2-cancel { min-height:44px; border-radius:11px !important; font:inherit; font-weight:600; padding:10px 18px; }
.g1-swal .swal2-confirm { background:#4f46e5 !important; color:#fff !important; }
.g1-swal .swal2-cancel { background:rgba(148,163,184,.15) !important; color:var(--g1a-ink) !important; }
.g1-swal .swal2-input, .g1-swal .swal2-textarea { box-sizing:border-box; max-width:100%; margin:16px 0 0; color:var(--g1a-ink); font:inherit; font-size:16px; border:1px solid rgba(148,163,184,.4); border-radius:10px; background:transparent; }
.g1-swal .swal2-html-container { margin:12px 0 0; overflow-wrap:anywhere; white-space:pre-line; }
.al-alert.g1-alert, .cg-banner.g1-alert { font-family:inherit; border-left-width:4px; box-shadow:0 4px 18px rgba(15,23,42,.06); }
@media (prefers-reduced-motion:reduce) { .g1-toast,.g1-toast__bar,.g1-alert,.swal2-popup { animation:none !important; transition:none !important; } }

/* Respect SweetAlert visibility even when source theme button rules use !important. */
.g1-swal .swal2-actions button[style*="display: none"] { display:none !important; }
.g1-swal .swal2-actions { flex-wrap:wrap !important; }
