﻿/* =========================================================
   MODAL BACKGROUND OVERLAY
   ========================================================= */
.modalBackground {
    background-color: rgba(20, 30, 45, 0.60) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 9998 !important;
}

/* =========================================================
   ALERT MODAL
   Responsive width, viewport height and content sizing
   ========================================================= */
.sweet-modal {
    background: #ffffff;
    color: #333333;
    /* Automatically grow according to content */
    width: fit-content;
    min-width: min(500px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    padding: 0;
    margin: 0 auto;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    text-align: center;
    position: relative;
    /* Prevent modal from extending beyond the screen */
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    /* Header and footer stay outside the scrolling area */
    overflow: hidden;
    font-family: Arial, "Noto Sans Gurmukhi", sans-serif;
    animation: sweetModalFadeIn 0.22s ease-out;
}

    /* Consistent sizing */
    .sweet-modal *,
    .sweet-modal *::before,
    .sweet-modal *::after {
        box-sizing: border-box;
    }

/* =========================================================
   MODAL HEADER
   ========================================================= */
.sweet-modal-header {
    background-color: #e0e7f2;
    color: #17365d;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.5;
    padding: 16px 22px;
    margin: 0;
    border-bottom: 1px solid #d9e2f0;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

/* =========================================================
   MODAL BODY
   Scroll vertically and horizontally when required
   ========================================================= */
.sweet-modal-body {
    background-color: #ffffff;
    color: #343a40;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.7;
    padding: 24px 22px;
    margin: 0;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    /* Enable scrolling for large content */
    max-height: calc(100vh - 190px);
    max-height: calc(100dvh - 190px);
    overflow-y: auto;
    overflow-x: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

    /* Avoid oversized images */
    .sweet-modal-body img {
        max-width: 100%;
        height: auto;
    }

    /* Bootstrap rows */
    .sweet-modal-body .row {
        margin-left: 0;
        margin-right: 0;
    }

        .sweet-modal-body .row[style*="border-bottom"] {
            padding-bottom: 15px;
            margin-bottom: 18px;
            border-bottom: 1px solid #e5e7eb !important;
        }

    /* Labels */
    .sweet-modal-body label {
        color: #343a40;
        font-weight: 600;
        line-height: 1.6;
    }

    /* Textboxes and form controls */
    .sweet-modal-body .form-control {
        display: block;
        width: 100%;
        max-width: 100%;
        margin-top: 6px;
        min-height: 40px;
        padding: 9px 12px;
        font-size: 15px;
        line-height: 1.5;
        color: #333333;
        background-color: #ffffff;
        border: 1px solid #cbd2da;
        border-radius: 6px;
        box-shadow: none;
        resize: vertical;
    }

        .sweet-modal-body .form-control:focus {
            border-color: #4285f4;
            outline: 0;
            box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.16);
        }

    /* Prevent form controls from exceeding the modal */
    .sweet-modal-body input,
    .sweet-modal-body select,
    .sweet-modal-body textarea {
        max-width: 100%;
    }

    /* Tables and large data */
    .sweet-modal-body table {
        max-width: 100%;
    }

    .sweet-modal-body td,
    .sweet-modal-body th {
        overflow-wrap: anywhere;
        word-break: normal;
    }

    /* Allow code or preformatted content to scroll horizontally */
    .sweet-modal-body pre {
        max-width: 100%;
        overflow-x: auto;
    }

    /* Validation messages */
    .sweet-modal-body .text-danger {
        display: block;
        margin: 6px 0;
        color: #b42318;
        font-size: 13px;
        line-height: 1.5;
        font-weight: 500;
    }

/* =========================================================
   MODAL FOOTER
   Remains visible while the body scrolls
   ========================================================= */
.sweet-modal-footer {
    padding: 5px 20px;
    text-align: center;
    background-color: #e0e7f2;
    border-top: 1px solid #e5e7eb;
}

    /* =========================================================
   BUTTONS
   ========================================================= */
    .sweet-modal-footer .btn {
        display: inline-block;
        min-width: 100px;
        min-height: 42px;
        margin: 2px 4px;
        padding: 10px 24px;
        border: 1px solid transparent;
        border-radius: 6px;
        font-size: 15px;
        font-weight: 600;
        line-height: 1.4;
        text-align: center;
        color: #ffffff;
        cursor: pointer;
        box-shadow: none;
        transition: background-color 0.18s ease, box-shadow 0.18s ease;
    }

    /* Primary / OK button */
    .sweet-modal-footer .btn-default {
        background-color: #2864dc;
        border-color: #2864dc;
        color: #ffffff;
    }

        .sweet-modal-footer .btn-default:hover {
            background-color: #1e4fb5;
            border-color: #1e4fb5;
            color: #ffffff;
        }

        .sweet-modal-footer .btn-default:focus {
            background-color: #1e4fb5;
            color: #ffffff;
            outline: 2px solid #2864dc;
            outline-offset: 3px;
        }

    /* Button press */
    .sweet-modal-footer .btn:active {
        transform: translateY(1px);
    }

    /* Success button */
    .sweet-modal-footer .btn-success {
        background-color: #218838;
        border-color: #218838;
        color: #ffffff;
    }

        .sweet-modal-footer .btn-success:hover,
        .sweet-modal-footer .btn-success:focus {
            background-color: #19692c;
            color: #ffffff;
        }

    /* Danger button */
    .sweet-modal-footer .btn-danger {
        background-color: #c82333;
        border-color: #c82333;
        color: #ffffff;
    }

        .sweet-modal-footer .btn-danger:hover,
        .sweet-modal-footer .btn-danger:focus {
            background-color: #a71d2a;
            color: #ffffff;
        }





/* =========================================================
   ANIMATION
   ========================================================= */
@keyframes sweetModalFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Respect accessibility preferences */
@media (prefers-reduced-motion: reduce) {
    .sweet-modal {
        animation: none;
    }

    .sweet-modal-footer .btn {
        transition: none;
    }
}

/* =========================================================
   TABLETS AND MOBILE
   ========================================================= */
@media (max-width: 600px) {
    .sweet-modal {
        width: calc(100vw - 28px);
        min-width: 0;
        max-width: calc(100vw - 28px);
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: 10px;
    }

    .sweet-modal-header {
        font-size: 18px;
        padding: 14px 16px;
    }

    .sweet-modal-body {
        max-height: calc(100vh - 180px);
        max-height: calc(100dvh - 180px);
        overflow-y: auto;
        overflow-x: auto;
        font-size: 15px;
        line-height: 1.7;
        padding: 20px 16px;
    }

    .sweet-modal-footer {
        padding: 14px 12px;
    }

        .sweet-modal-footer .btn {
            min-width: 100px;
            min-height: 44px;
            padding: 10px 20px;
            font-size: 15px;
        }
}

/* =========================================================
   SMALL MOBILE SCREENS
   ========================================================= */
@media (max-width: 360px) {
    .sweet-modal {
        width: calc(100vw - 20px);
        min-width: 0;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
    }

    .sweet-modal-header {
        font-size: 17px;
        padding: 12px;
    }

    .sweet-modal-body {
        max-height: calc(100vh - 160px);
        max-height: calc(100dvh - 160px);
        overflow-y: auto;
        overflow-x: auto;
        padding: 16px 12px;
        font-size: 14px;
    }
}

/* =========================================================
   VALIDATION MESSAGE LIST
   ========================================================= */
.sweet-modal-body .validation-list {
    list-style-type: decimal;
    list-style-position: outside;
    margin: 0;
    padding-left: 32px;
    text-align: left;
}

    .sweet-modal-body .validation-list li {
        padding: 3px 0;
        margin: 0;
        text-align: left;
        line-height: 1.7;
        overflow-wrap: anywhere;
        word-wrap: break-word;
    }

/* Keep Punjabi and English text readable on mobile */
@media (max-width: 600px) {
    .sweet-modal-body .validation-list {
        padding-left: 28px;
    }

        .sweet-modal-body .validation-list li {
            padding: 5px 0;
        }
}
