/* =========================================================
   LOGIN MODAL
   Scoped only to #modal2
   Premium • Clean • Responsive • Theme Aware
========================================================= */

#modal2.modal-overlay.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
/* =========================================================
   OVERLAY
========================================================= */

#modal2.modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        radial-gradient(
            circle at center,
            rgba(0, 0, 0, 0.28),
            rgba(0, 0, 0, 0.68)
        );

    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);

    z-index: 10000;

    overflow-y: auto;
    box-sizing: border-box;
}


/* Open modal */

#modal2.modal-overlay.show {
    display: flex;
}


/* =========================================================
   LOGIN MODAL BOX
========================================================= */

#modal2 .modal-content {
    position: relative;

    width: 100% !important;
    max-width: 430px !important;

    min-height: auto;
    max-height: calc(100vh - 40px);

    margin: 0 !important;
    padding: 0 !important;

    background:
        linear-gradient(
            145deg,
            var(--surface-primary, #ffffff),
            var(--surface-secondary, #f8faf9)
        );

    border: 1px solid
        var(--border-primary, rgba(0, 0, 0, 0.08));

    border-radius: 22px;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.25),
        0 8px 25px rgba(0, 0, 0, 0.12);

    overflow: visible;

    opacity: 0;
    transform: translateY(20px) scale(0.96);

    transition:
        opacity 0.3s ease,
        transform 0.3s ease;

    animation: none;
}


/* Modal active animation */

#modal2.show .modal-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}


/* =========================================================
   LOGO
========================================================= */

#modal2 .logo-floating {
    position: absolute;

    top: -48px;
    left: 50%;

    transform: translateX(-50%);

    width: 88px;
    height: 88px;

    padding: 5px;

    border-radius: 50%;

    background: #ffffff;

    border: 4px solid
        var(--surface-primary, #ffffff);

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(0, 0, 0, 0.05);

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 20;

    box-sizing: border-box;
}


/* Logo image */

#modal2 .logo-floating img {
    display: block;

    width: 100%;
    height: 100%;

    max-width: 100%;
    max-height: 100%;

    object-fit: contain;

    border-radius: 50%;
}


/* =========================================================
   HEADER
========================================================= */

#modal2 .modal-head-container {
    position: relative;

    width: 100%;

    min-height: 90px;

    margin: 0 !important;
    padding: 48px 55px 18px !important;

    display: flex;
    align-items: center;
    justify-content: center;

    border-bottom: 1px solid
        var(--border-primary, #e8ecea);

    box-sizing: border-box;
}


/* Login title */

#modal2 .modal-title {
    width: 100%;

    margin: 0 !important;
    padding: 0;

    text-align: center;

    color:
        var(--on-surface-primary, #18352d);

    font-size: 22px !important;
    font-weight: 700;

    line-height: 1.3;

    letter-spacing: -0.2px;
}


/* =========================================================
   CLOSE BUTTON
========================================================= */

#modal2 .modal-close-btn {
    position: absolute;

    top: 14px;
    right: 14px;

    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    color:
        var(--on-surface-primary, #52635d);

    background:
        var(--surface-tertiary, #f2f5f3);

    border: 1px solid
        var(--border-primary, #e2e8e5);

    border-radius: 50%;

    font-size: 23px;
    font-weight: 400;

    line-height: 1;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.25s ease,
        box-shadow 0.2s ease;
}


#modal2 .modal-close-btn:hover {
    color: #ffffff;

    background:
        var(--brand-primary, #368f86);

    border-color:
        var(--brand-primary, #368f86);

    transform: rotate(90deg);

    box-shadow:
        0 5px 15px rgba(54, 143, 134, 0.25);
}


/* =========================================================
   ERROR MESSAGE
========================================================= */

#modal2 .error-message {
    margin: 18px 24px 0;

    padding: 12px 14px;

    background: #fff5f5;

    border: 1px solid #ffd6d6;

    border-left: 4px solid #dc3545;

    border-radius: 10px;

    color: #a52828;

    font-size: 13px;

    line-height: 1.5;

    box-sizing: border-box;
}


#modal2 .error-message p {
    margin: 2px 0;
}


/* =========================================================
   LOGIN FORM
========================================================= */

#modal2 .login-form {
    width: 100%;

    padding: 26px 30px 30px;

    box-sizing: border-box;
}


/* =========================================================
   INPUT CONTAINER
========================================================= */

#modal2 .login-container {
    width: 100%;

    display: flex;
    flex-direction: column;

    gap: 16px;

    margin: 0;
}


/* =========================================================
   INPUT FIELDS
========================================================= */

#modal2 .login-container .inputs {
    width: 100%;

    height: 50px;

    margin: 0;
    padding: 0 16px;

    box-sizing: border-box;

    color:
        var(--on-surface-primary, #263b35);

    background:
        var(--surface-primary, #ffffff);

    border: 1px solid
        var(--border-primary, #dce5e1);

    border-radius: 12px;

    outline: none;

    font-family: inherit;
    font-size: 15px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}


/* Placeholder */

#modal2 .login-container .inputs::placeholder {
    color: #9aa7a2;
}


/* Focus */

#modal2 .login-container .inputs:focus {
    border-color:
        var(--brand-primary, #368f86);

    background:
        var(--surface-primary, #ffffff);

    box-shadow:
        0 0 0 4px rgba(54, 143, 134, 0.10);
}


/* Autofill */

#modal2 .login-container .inputs:-webkit-autofill {
    -webkit-box-shadow:
        0 0 0 1000px #ffffff inset;

    -webkit-text-fill-color:
        var(--on-surface-primary, #263b35);
}


/* =========================================================
   LOGIN BUTTON
========================================================= */

#modal2 .login-form > button {
    width: 100%;

    height: 50px;

    margin: 22px 0 0;
    padding: 0 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--brand-primary, #368f86),
            var(--brand-secondary, #24776f)
        );

    border: none;

    border-radius: 12px;

    font-family: inherit;
    font-size: 15px;
    font-weight: 700;

    letter-spacing: 0.2px;

    cursor: pointer;

    box-shadow:
        0 8px 18px rgba(54, 143, 134, 0.20);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;
}


#modal2 .login-form > button:hover {
    transform: translateY(-2px);

    filter: brightness(1.05);

    box-shadow:
        0 12px 24px rgba(54, 143, 134, 0.28);
}


#modal2 .login-form > button:active {
    transform: translateY(0);
}


/* =========================================================
   HIDDEN DEVICE ID
========================================================= */

#modal2 .device_id {
    display: none;
}


/* =========================================================
   RESPONSIVE — TABLET
========================================================= */

@media (max-width: 600px) {

    #modal2.modal-overlay {
        padding: 18px;
    }

    #modal2 .modal-content {
        max-width: 410px !important;
        border-radius: 20px;
    }

    #modal2 .modal-head-container {
        min-height: 86px;

        padding:
            46px 48px 17px !important;
    }

    #modal2 .modal-title {
        font-size: 20px !important;
    }

    #modal2 .login-form {
        padding: 24px 24px 26px;
    }

    #modal2 .logo-floating {
        width: 82px;
        height: 82px;

        top: -43px;
    }
}


/* =========================================================
   RESPONSIVE — MOBILE
========================================================= */

@media (max-width: 420px) {

    #modal2.modal-overlay {
        padding: 15px;
    }

    #modal2 .modal-content {
        width: 100% !important;
        max-width: 100% !important;

        border-radius: 18px;
    }

    #modal2 .modal-head-container {
        min-height: 82px;

        padding:
            43px 45px 15px !important;
    }

    #modal2 .modal-title {
        font-size: 19px !important;
    }

    #modal2 .modal-close-btn {
        top: 11px;
        right: 11px;

        width: 32px;
        height: 32px;

        font-size: 21px;
    }

    #modal2 .login-form {
        padding: 22px 18px 22px;
    }

    #modal2 .login-container {
        gap: 13px;
    }

    #modal2 .login-container .inputs {
        height: 48px;

        font-size: 14px;
    }

    #modal2 .login-form > button {
        height: 48px;

        margin-top: 18px;
    }

    #modal2 .logo-floating {
        width: 76px;
        height: 76px;

        top: -39px;

        border-width: 3px;
    }

    #modal2 .error-message {
        margin:
            15px 18px 0;

        font-size: 12px;
    }
}


/* =========================================================
   VERY SMALL DEVICES
========================================================= */

@media (max-width: 340px) {

    #modal2.modal-overlay {
        padding: 10px;
    }

    #modal2 .login-form {
        padding-left: 15px;
        padding-right: 15px;
    }

    #modal2 .modal-head-container {
        padding-left: 40px !important;
        padding-right: 40px !important;
    }
}