/* BKPS — premium overrides for SweetAlert2 + NProgress + the full-page
   loader overlay. Loaded after vendor + theme CSS. */

/* ───── NProgress (top accent bar) ───── */
#nprogress { pointer-events: none; }
#nprogress .bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 99999;
    background: linear-gradient(90deg, #015825 0%, #0c8c5d 50%, #2bb673 100%);
    box-shadow: 0 0 12px rgba(12, 140, 93, 0.55);
}
#nprogress .peg {
    display: block;
    position: absolute;
    right: 0;
    width: 100px;
    height: 100%;
    box-shadow: 0 0 14px #0c8c5d, 0 0 6px #0c8c5d;
    opacity: 1;
    transform: rotate(3deg) translate(0px, -4px);
}
#nprogress .spinner { display: none !important; }

/* ───── Full-page loader overlay (modern, dim + spinner) ─────
   Sits over content while AJAX is in flight. Lock z-index above modals
   (Bootstrap modal-backdrop is 1040, modal 1050, so we go 1060+). */
#app-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 32, 0.32);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0s linear 0.18s;
    pointer-events: none;
}
#app-loader-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.18s ease;
    pointer-events: auto;
}
.app-loader-overlay__inner {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.35), 0 8px 16px -8px rgba(0, 0, 0, 0.12);
    padding: 22px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 220px;
}
.app-loader-overlay__spinner {
    color: #015825;
    width: 32px;
    height: 32px;
}
.app-loader-overlay__spinner svg {
    width: 100%;
    height: 100%;
    animation: app-loader-rotate 1.4s linear infinite;
}
.app-loader-overlay__spinner circle {
    animation: app-loader-dash 1.4s ease-in-out infinite;
    transform-origin: center;
}
@keyframes app-loader-rotate {
    100% { transform: rotate(360deg); }
}
@keyframes app-loader-dash {
    0%   { stroke-dasharray: 1, 150;   stroke-dashoffset: 0; }
    50%  { stroke-dasharray: 90, 150;  stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150;  stroke-dashoffset: -124; }
}
.app-loader-overlay__label {
    font-family: var(--default-font, "Ubuntu"), system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #1a1d23;
    letter-spacing: 0.2px;
}

/* ───── SweetAlert2 — themed dialog (delete confirm, info popup) ───── */
.swal2-popup {
    border-radius: 14px !important;
    padding: 26px 28px 22px !important;
    font-family: var(--default-font, "Ubuntu"), system-ui, sans-serif;
    box-shadow: 0 20px 56px -12px rgba(0, 0, 0, 0.32), 0 8px 16px -8px rgba(0, 0, 0, 0.16);
}
.swal2-title {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: #1a1d23 !important;
    padding: 0 !important;
}
.swal2-html-container {
    font-size: 0.95rem !important;
    color: #4a5160 !important;
    margin-top: 0.6em !important;
    line-height: 1.55 !important;
}
.swal2-icon {
    margin: 0.6em auto 0.4em !important;
    transform: scale(0.85);
}
.swal2-actions {
    margin-top: 1.5em !important;
    gap: 8px !important;
}
.swal2-styled.swal2-confirm,
.swal2-styled.swal2-cancel {
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    padding: 10px 22px !important;
    box-shadow: none !important;
    transition: filter 0.15s, transform 0.06s;
}
.swal2-styled.swal2-confirm:focus,
.swal2-styled.swal2-cancel:focus {
    box-shadow: 0 0 0 3px rgba(1, 88, 37, 0.22) !important;
}
.swal2-styled.swal2-confirm:hover { filter: brightness(1.08); }
.swal2-styled.swal2-confirm:active { transform: translateY(1px); }
.swal2-input,
.swal2-textarea {
    border-radius: 8px !important;
    border: 1px solid #ced4da !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
    box-shadow: none !important;
}
.swal2-input:focus,
.swal2-textarea:focus {
    border-color: #015825 !important;
    box-shadow: 0 0 0 3px rgba(1, 88, 37, 0.18) !important;
}
.swal2-backdrop-show {
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* ───── SweetAlert2 toast variant (top-right notifications) ───── */
.swal2-popup.app-swal-toast,
.swal2-popup.swal2-toast {
    border-radius: 12px !important;
    padding: 14px 18px !important;
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.28), 0 4px 12px -4px rgba(0, 0, 0, 0.14) !important;
    min-width: 320px;
    font-family: var(--default-font, "Ubuntu"), system-ui, sans-serif;
    background: #fff !important;
}
.swal2-popup.swal2-toast .swal2-icon {
    width: 1.6em !important;
    height: 1.6em !important;
    margin: 0 0.6em 0 0 !important;
    transform: none;
}
.swal2-popup.swal2-toast .swal2-title {
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.45 !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #1a1d23 !important;
}
.swal2-popup.swal2-toast .swal2-timer-progress-bar-container {
    border-radius: 0 0 12px 12px !important;
    overflow: hidden;
}

/* ───── File-input button — modernized look ─────
   Bootstrap default <input type="file"> is ugly. Style the form-control
   variant so it reads as a proper card-style picker. */
input[type="file"].form-control {
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="file"].form-control::file-selector-button {
    padding: 8px 14px;
    margin: -8px 12px -8px -12px;
    border: 0;
    border-right: 1px solid var(--border-color, #dee2e6);
    background: var(--surface-muted, #f1f3f5);
    color: var(--text-primary, #1a1d23);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 6px 0 0 6px;
}
input[type="file"].form-control:hover::file-selector-button {
    background: var(--primary-50, #e7f3ec);
    color: var(--primary, #015825);
}
input[type="file"].form-control:focus {
    border-color: var(--primary, #015825);
    box-shadow: 0 0 0 3px rgba(1, 88, 37, 0.15);
}

/* ───── Profile image preview — constrain so the upload preview doesn't
   blow up to fill the page (was overflowing My Profile + member edit).
   Includes the actual class used in my_profile.blade.php (image-preview__img)
   plus the historical names used elsewhere. */
.image-preview,
.image-preview__img,
.profile-photo-preview,
.member-photo-preview,
img.member-photo-preview,
.preview-image-thumb {
    max-width: 160px;
    max-height: 160px;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border-color, #dee2e6);
    box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.18);
}
/* Container variant — when the preview wrapper has the .image-preview
   class, cap it so flex parents don't stretch it to full width. */
.image-preview {
    display: inline-block;
    overflow: hidden;
}
.preview-thumb {
    max-width: 90px;
    max-height: 90px;
    object-fit: cover;
    border-radius: 8px;
}

/* ───── Per-thumb portfolio delete button ─────
   Each portfolio image is wrapped in .portfolio-thumb-wrap so the trash
   button can sit absolutely-positioned in the top-right corner. */
.portfolio-thumb-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
}
.portfolio-thumb-wrap .portfolio-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 50%;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.1s ease;
}
.portfolio-thumb-wrap:hover .portfolio-delete-btn,
.portfolio-thumb-wrap:focus-within .portfolio-delete-btn {
    opacity: 1;
}
.portfolio-thumb-wrap .portfolio-delete-btn:hover {
    transform: scale(1.08);
}
/* Touch devices don't surface :hover — keep the button visible at lower
   opacity so finger users can still find it. */
@media (hover: none) {
    .portfolio-thumb-wrap .portfolio-delete-btn {
        opacity: 0.85;
    }
}

/* ───── Profile-photo delete (single avatar) ─────
   Mirrors the portfolio-thumb pattern but anchored to the avatar preview
   on My Profile / member_edit. Visible by default since there's only one
   avatar and the user shouldn't have to hunt for the affordance. */
.profile-photo-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
}
.profile-photo-wrap .profile-photo-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.3);
    opacity: 0.92;
    transition: opacity 0.15s ease, transform 0.1s ease;
}
.profile-photo-wrap .profile-photo-delete-btn:hover {
    opacity: 1;
    transform: scale(1.08);
}

/* ───── Submit-button loading state ───── */
.btn.is-loading {
    pointer-events: none;
    opacity: 0.85;
}

/* ───── Duplicate-member review tiles (pending-approvals modal) ─────
   Each match is a clickable <a> that opens the profile in a new tab.
   Card-style hover with brand-green accent. */
.duplicate-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.duplicate-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 10px;
    background: #fff;
    text-decoration: none !important;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.06s;
}
.duplicate-row:hover {
    border-color: #015825;
    box-shadow: 0 4px 14px -6px rgba(1, 88, 37, 0.25);
    color: inherit;
    transform: translateY(-1px);
}
.duplicate-row:active { transform: translateY(0); }
.duplicate-row__main { flex: 1; min-width: 0; }
.duplicate-row__name {
    font-weight: 600;
    font-size: 15px;
    color: #1a1d23;
    line-height: 1.3;
    margin-bottom: 4px;
}
.duplicate-row__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 13px;
    color: #4a5160;
}
.duplicate-row__chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.duplicate-row__chip i { color: #6c757d; font-size: 14px; }
.duplicate-row__open {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f1f3f5;
    color: #015825;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.15s;
}
.duplicate-row:hover .duplicate-row__open {
    background: #015825;
    color: #fff;
}

/* ───── Image lightbox modal ─────
   Bootstrap 5 modal + carousel styled for an immersive "click photo to
   enlarge" experience. Markup lives in admin/member _layout.blade.php;
   activated via window.app.lightbox.show() or a `data-lightbox` /
   `data-lightbox-group` attribute on any <img>. */
.app-lightbox .modal-content {
    background: transparent;
    border: 0;
    box-shadow: none;
}
.app-lightbox .modal-dialog {
    /* Make the modal as tall as the viewport so big portraits fit. */
    max-width: 92vw;
}
.app-lightbox__close {
    position: absolute !important;
    top: 12px;
    right: 14px;
    z-index: 10;
    background: rgba(20, 20, 20, 0.65);
    border-radius: 50%;
    padding: 10px;
    opacity: 1;
    /* `btn-close-white` already gives the SVG X a white fill; the previous
       `filter: invert(1) brightness(2)` flipped it back to black against
       the dark circle, making the X effectively invisible. Removed. */
    transition: background 0.15s, transform 0.1s;
}
.app-lightbox__close:hover { background: rgba(20, 20, 20, 0.85); transform: scale(1.05); }

.app-lightbox__carousel {
    width: 100%;
    height: 86vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.app-lightbox__carousel .carousel-inner {
    height: 86vh;
}
.app-lightbox__carousel .carousel-item {
    height: 86vh;
    text-align: center;
}
.app-lightbox__carousel .carousel-item.active,
.app-lightbox__carousel .carousel-item-next,
.app-lightbox__carousel .carousel-item-prev {
    display: flex !important;
    align-items: center;
    justify-content: center;
}
.app-lightbox__img {
    max-width: 100%;
    max-height: 86vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 18px 48px -12px rgba(0, 0, 0, 0.6);
    background: #1a1d23;
}
.app-lightbox__nav {
    width: 56px;
    background: rgba(20, 20, 20, 0.5);
    height: 56px;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    border-radius: 50%;
    opacity: 0.85;
    transition: background 0.15s, opacity 0.15s, transform 0.1s;
}
.app-lightbox__nav:hover { background: rgba(20, 20, 20, 0.85); opacity: 1; }
.app-lightbox__nav--prev { left: 18px; }
.app-lightbox__nav--next { right: 18px; }
.app-lightbox__counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 13px;
    background: rgba(20, 20, 20, 0.6);
    padding: 6px 14px;
    border-radius: 999px;
    letter-spacing: 0.5pt;
    font-family: var(--default-font, "Ubuntu"), system-ui, sans-serif;
}

/* Cursor + subtle hover hint on any image flagged for the lightbox. */
img[data-lightbox],
img[data-lightbox-group] {
    cursor: zoom-in;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
img[data-lightbox]:hover,
img[data-lightbox-group]:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.28);
}

/* ───── DataTables processing indicator ─────
   DataTables ships with a centered "Processing…" panel that uses its own
   blue spinner. Hide it entirely — the global app loader (overlay +
   NProgress top bar) already covers AJAX-in-flight feedback, and having
   two competing indicators looks broken. */
.dataTables_processing,
.dt-processing,
div.dataTables_processing,
table.dataTable > tbody > tr.dataTables_empty + .dataTables_processing {
    display: none !important;
}
/* If DataTables 2.x renders the spinner via dt-processing-indicator, kill
   that too. */
.dt-processing-indicator,
.dataTables_wrapper .dataTables_processing > div {
    display: none !important;
}
