/* Authentication Modal Styles */

#auth-modal {
    position: fixed;
    top: var(--app-header-height, 70px);
    left: 0;
    right: 0;
    width: 100%;
    bottom: var(--app-footer-height, 52px);
    height: auto;
    z-index: 1200;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    overflow-y: auto;
    box-sizing: border-box;
}

#auth-modal::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: -1;
}

#auth-modal-card {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.5rem;
    border-radius: 1.2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 320px;
    max-width: 90%;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(12px) scale(0.985);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, background 0.2s ease;
}

.auth-modal-close:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.92);
}

body.auth-active #auth-modal-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#auth-modal-card::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    background-image: url('../logo_2.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.05;
    z-index: -1;
    pointer-events: none;
}

.auth-branding-wrapper {
    margin-bottom: 1rem;
}

#auth-modal-card h2 {
    margin-top: 0;
    margin-bottom: 0px;
    letter-spacing: 0.02em;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 4px;
}

#auth-modal-card .auth-subtitle {
    margin-top: 2px;
    margin-bottom: 0;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

#auth-modal-card .brand-aquino {
    font-size: 1.8rem;
    color: #d97706;
    display: inline-block;
}

#auth-modal-card .brand-tree {
    font-size: 2.2rem;
    color: #0f172a;
    line-height: 0.9;
    font-family: 'Playfair Display', serif;
    font-style: italic;
}

.auth-icon {
    margin-bottom: 0.75rem;
    display: block;
    font-size: 24px;
    color: rgba(15, 23, 42, 0.6);
}

.auth-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0.75rem;
    width: 100%;
}

#admin-username,
#admin-password {
    width: 100%;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1e293b;
    border-radius: 0.75rem;
    box-sizing: border-box;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

#admin-username:focus,
#admin-password:focus {
    border-color: #d97706;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15);
    outline: none;
    transform: translateY(-1px);
}

#login-btn {
    width: 100%;
    height: 44px; /* Fixed stable height */
    padding: 0 12px;
    background: #1e293b;
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#login-btn:hover {
    background: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(15, 23, 42, 0.3);
}

#login-btn:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

/* Auth States */
#login-btn.btn-error {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

#login-btn.btn-success {
    background: #16a34a;
    color: white;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.auth-error-msg {
    display: none; /* Hidden as we use button feedback now */
}

.auth-error-msg.show-error {
    visibility: visible;
    opacity: 1;
}

/* Mobile Fixes */
@media (max-width: 480px) {
    #auth-modal-card {
        padding: 2rem 1.5rem;
    }
    #auth-modal {
        padding: 1rem;
    }
}

/* Header/Footer Transparency when Auth is active */
body:has(#auth-modal:not(.hidden)) {
    --header-surface: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
    --header-border-color: rgba(255, 255, 255, 0.18);
    --header-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --header-backdrop-filter: blur(18px) saturate(145%);
    --footer-surface: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
    --footer-border-color: rgba(255, 255, 255, 0.18);
    --footer-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --footer-backdrop-filter: blur(18px) saturate(145%);
}
