/* ? Ensure the login modal shows content properly */
#login-username-modal {
    position: absolute;
    top: var(--cf-login-modal-top, 48px);
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    margin: 0;
    width: min(80vw, 260px);
    scroll-margin-top: var(--cf-login-modal-top, 48px);
    background-color: #ffffcc;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 12010; /* above login overlay (12005) */
}

/* ? Inner modal container */
#login-username-modal .modal-cont {
    display: block;
    position: relative;
}

#login-password-modal {
    position: absolute;
    top: var(--cf-login-modal-top, 48px);
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    margin: 0;
    width: min(90vw, 260px);
    scroll-margin-top: var(--cf-login-modal-top, 48px);
    background-color: #ffffcc;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 12010; /* above login overlay (12005) */
}

/* ? Inner modal container */
#login-password-modal .modal-cont {
    display: block;
    position: relative;
}

/* fieldset/legend styling*/
#login-username-form fieldset,
#login-password-form fieldset {
    background-color: #f4f4eb;
    border: 1px solid #000;
    border-radius: 4px;
    padding: 6px 8px;
    box-sizing: border-box;
}
#login-username-form legend,
#login-password-form legend {
    font-weight: bold;
}

/* ? Force form block to expand properly */
#login-password-form,
#login-username-form {
    display: block;
    width: 100%;
}

/* ? Utility to hide things (used by JS/PHP) */
.hidden {
    display: none !important;
    visibility: hidden;
}

/* ? Label + heading text styling */
#login-username-form h2,
#login-username-form label {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}

/* ? Input field styling */
#login-username-form input[type="text"] {
    width: 98%;
    padding: 2px;
    margin-bottom: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
}

/* ? Input field styling */
#login-password-form input[type="password"] {
    width: 96%;
    padding: 2px;
    margin-bottom: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
}

/* ? Submit button styling */
#login-password-form button,
#login-username-form button {
    width: 100%;
    background-color: #007bff;
    color: white;
    font-weight: bold;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
}

/* ? Add margin between buttons */
#login-password-form button + button {
    margin-top: 2px;
}

/* ? Disabled state */
#login-username-form button:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ? Enabled hover state */
#login-username-form button:hover:not(:disabled) {
    background-color: #0056b3;
}

/* ? Error javascript message styling */
.error {
    color: red;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    margin: 5px 0;
}


/* ? Server-side feedback container for login modal */
.login-feedback {
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    padding: 6px;
    width: 90%;
    margin: 8px auto;
    border-radius: 5px;
}

/* ? Specific colors */
.login-feedback .error {
    color: #b30000;
    background-color: #ffe6e6;
}

.login-feedback .success {
    color: #006600;
    background-color: #e6ffe6;
}


/* ? Close button (X in top-right) */
.close-button {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 20px;
    font-weight: bold;
    text-decoration: none;
    color: #444;
}

/* =========================================================
   ? Universal "App Message" slot (login modals only for now)
   ---------------------------------------------------------
   Container is empty server-side; app_messages.js fills it
   on DOMContentLoaded. When there are no messages the wrap
   stays collapsed (no padding/border thanks to :empty), so
   the modal layout is unchanged.
   ========================================================= */
.app-message-container {
    display: block;
    margin: 4px 0 6px;
}

.app-message-container:empty {
    display: none; /* never reserve vertical space when no messages */
}

.app-message {
    border-radius: 4px;
    padding: 4px 6px;
    margin: 4px 0;
    font-size: 12px;
    line-height: 1.3;
    text-align: left;
    box-sizing: border-box;
    word-wrap: break-word;
}

.app-message-body {
    white-space: pre-line; /* respect admin-typed line breaks */
}

/* Normal: subtle neutral box that blends with the modal */
.app-message-normal {
    background-color: #f4f4eb;
    border: 1px solid #cdcdbf;
    color: #333;
}

/* Important: warmer attention-grabbing box, but still soft enough
   not to dominate the modal or the input field below it. */
.app-message-important {
    background-color: #fff4d6;
    border: 1px solid #d9a91a;
    color: #6b4d00;
    font-weight: 600;
}

