/* ============================================================
   ZAIAORG SHARED GLOBAL STYLES: common-styles.css
   Contains Loaders, Scroll-to-Top, Auth Modals, and shared utilities.
   ============================================================ */

/* --- Database-First Loading Screen --- */
#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #fdf9e3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#global-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    border: 5px solid #E87A7A;
    border-top: 5px solid #6F5ACD;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loader-text-1 {
    font-family: 'Lexend Deca', sans-serif;
    text-align: center;
    color: #6F5ACD;
    font-size: 19px;
    font-weight: bold;
    animation: pulse 1.8s infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }

/* Database-First Main Content Hiding */
.page-container.db-loading {
    display: none !important;
}

/* --- Global Scroll-to-Top Button --- */
.global-scroll-top {
    display: none; 
    position: fixed; 
    bottom: 30px; 
    right: 30px; 
    z-index: 900;
    border: none; 
    background-color: transparent; 
    cursor: pointer;
    width: 50px; 
    height: 50px; 
    opacity: 0.8; 
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.global-scroll-top.is-visible {
    display: block;
}

.global-scroll-top:hover { 
    opacity: 1; 
    transform: translateY(-3px);
}

.global-scroll-top img { 
    width: 100%; 
    height: 100%; 
    display: block; 
    object-fit: contain; 
}

/* --- Reusable Auth Modal Styles (Migrated from login-modal.css) --- */
.auth-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(176, 164, 255, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s ease; padding: 20px; box-sizing: border-box;
}
.auth-modal-overlay.is-open { opacity: 1; visibility: visible; }
.auth-modal-wrapper { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; max-width: 500px; }
.auth-modal-card {
    position: relative; width: 100%; background: #e2e2ff; border: 2px solid #ffffff; border-radius: 8px;
    padding: 10px 24px 24px 24px; box-shadow: 0 10px 30px rgba(111, 90, 205, 0.3); box-sizing: border-box;
    font-family: 'Lexend Deca', 'Inter', sans-serif; transform: translateY(-15px); transition: transform 0.25s ease;
}
.auth-modal-overlay.is-open .auth-modal-card { transform: translateY(0); }
.auth-modal-close {
    width: 40px; height: 40px; border-radius: 50%; background-color: #6f5acd; color: #ffffff; border: 2px solid #ffffff;
    font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); transition: transform 0.15s ease, background-color 0.15s ease;
}
.auth-modal-close:hover { background-color: #5d4cb0; transform: scale(1.08); }
.auth-modal-tabs { display: flex; gap: 0px; margin-bottom: 20px; border-radius: 6px; overflow: hidden; }
.auth-tab-btn {
    flex: 1; padding: 12px 16px; font-family: inherit; font-size: 17px; font-weight: bold; letter-spacing: 0.05em;
    text-transform: uppercase; text-decoration: underline; text-underline-offset: 3px; border: 2px solid #ffffff;
    border-radius: 6px; cursor: pointer; background-color: #e2e2ff; color: #8977d8; transition: all 0.2s ease;
}
.auth-tab-btn:hover { background-color: #d1d1ff; color: #6f5acd; }
.auth-tab-btn.active { background-color: #6f5acd; color: #ffffff; border-color: #d1d1ff; }
.auth-error-message {
    font-size: 13px; font-weight: 600; color: #db276c; background-color: rgba(255, 237, 248, 0.9);
    border: 1px solid #ffcdf0; border-radius: 6px; padding: 8px 12px; margin-bottom: 16px; display: none; text-align: center;
}
.auth-error-message.is-visible { display: block; }
.auth-modal-form { display: none; flex-direction: column; gap: 12px; }
.auth-modal-form.active { display: flex; }
.auth-field-group { display: flex; flex-direction: column; gap: 3px; }
.auth-label { font-size: 13px; font-weight: bold; color: #6f5acd; text-transform: uppercase; }
.auth-input {
    width: 100%; background-color: #beb2f5; color: #000; border: 1px solid #ffffff; border-radius: 6px; padding: 10px;
    font-family: inherit; font-size: 13px; box-sizing: border-box; outline: none; letter-spacing: 0.02em; transition: border-color 0.2s ease;
}
.auth-input::placeholder { color: #fff; font-weight: 400; }
.auth-input:focus { border-color: #ffffff; box-shadow: 0 0 0 2px rgba(111, 90, 205, 0.4); }
.auth-btn-row { display: flex; justify-content: center; margin-top: 16px; }
.auth-submit-btn {
    background-color: #6f5acd; color: #ffffff; border: 2px solid #ffffff; border-radius: 5px; padding: 10px 32px;
    font-family: inherit; font-size: 16px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase;
    cursor: pointer; min-width: 140px; transition: transform 0.15s ease, background-color 0.15s ease;
}
.auth-submit-btn:hover { background-color: #5d4cb0; transform: translateY(-1px); }
.auth-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* User Display Format Utility */
.user-display-block {
    display: inline-flex;
    flex-direction: column;
    line-height: 1.1;
}
.user-display-name {
    font-weight: bold;
}
.user-display-id {
    font-size: 0.75em;
    color: #555;
}

.auth-error-message {
    font-size: 13px; font-weight: 600; color: #db276c; background-color: rgba(255, 237, 248, 0.9);
    border: 1px solid #ffcdf0; border-radius: 6px; padding: 8px 12px; margin-bottom: 16px; display: none; text-align: center;
    transition: all 0.2s ease;
}
.auth-error-message.is-visible { display: block; }
.auth-error-message.error { color: #db276c; background-color: rgba(255, 237, 248, 0.9); border-color: #ffcdf0; }
.auth-error-message.info { color: #4338ca; background-color: rgba(238, 242, 255, 0.95); border-color: #c7d2fe; }
.auth-error-message.success { color: #15803d; background-color: rgba(240, 253, 244, 0.95); border-color: #bbf7d0; }

@media (max-width: 520px) {
    .auth-modal-card { padding: 24px 18px; }
    .auth-tab-btn { font-size: 15px; padding: 10px; }
    .auth-input { font-size: 13px; padding: 10px; }
}