/* Access Auth Login Overlay */
:root {
    --aa-primary: #2563eb;
    --aa-primary-hover: #1d4ed8;
    --aa-text: #1f2937;
    --aa-text-light: #6b7280;
    --aa-bg: #f3f4f6;
    --aa-white: #ffffff;
    --aa-border: #d1d5db;
    --aa-error: #dc2626;
    --aa-error-bg: #fef2f2;
    --aa-success: #059669;
    --aa-success-bg: #ecfdf5;
    --aa-radius: 12px;
    --aa-radius-sm: 8px;
    --aa-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    --aa-transition: 0.2s ease;
}

/* Overlay backdrop */
.access-auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.access-auth-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--aa-bg);
}

/* Modal card */
.access-auth-modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--aa-white);
    border-radius: var(--aa-radius);
    box-shadow: var(--aa-shadow);
    padding: 40px;
    animation: aaFadeIn 0.3s ease;
}

@keyframes aaFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logo */
.access-auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.access-auth-logo img {
    max-height: 60px;
    width: auto;
}

.access-auth-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--aa-text);
    margin: 0;
    line-height: 1.3;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Tabs */
.access-auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--aa-bg);
    border-radius: var(--aa-radius-sm);
    padding: 4px;
}

.access-auth-tab {
    flex: 1;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--aa-text-light);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--aa-transition);
    line-height: 1;
}

.access-auth-tab:hover {
    color: var(--aa-text);
}

.access-auth-tab.active {
    background: var(--aa-white);
    color: var(--aa-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Panels */
.access-auth-panel {
    display: none;
}

.access-auth-panel.active {
    display: block;
}

/* Override browser default hidden behavior when active class is set via JS */
.access-auth-panel.active[hidden] {
    display: block;
}

.access-auth-panel-desc {
    font-size: 14px;
    color: var(--aa-text-light);
    margin: 0 0 20px;
    line-height: 1.5;
}

/* Form fields */
.access-auth-field {
    margin-bottom: 16px;
}

.access-auth-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--aa-text);
    margin-bottom: 6px;
}

.access-auth-field input[type="text"],
.access-auth-field input[type="email"],
.access-auth-field input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--aa-border);
    border-radius: var(--aa-radius-sm);
    font-size: 15px;
    color: var(--aa-text);
    background: var(--aa-white);
    transition: border-color var(--aa-transition), box-shadow var(--aa-transition);
    box-sizing: border-box;
    outline: none;
}

.access-auth-field input:focus {
    border-color: var(--aa-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Remember me / forgot password row */
.access-auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.access-auth-remember {
    display: flex !important;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--aa-text-light);
    cursor: pointer;
}

.access-auth-remember input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.access-auth-forgot {
    font-size: 13px;
    color: var(--aa-primary);
    text-decoration: none;
}

.access-auth-forgot:hover {
    text-decoration: underline;
}

/* Error & success messages */
.access-auth-error {
    color: var(--aa-error);
    background: var(--aa-error-bg);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
    line-height: 1.4;
}

.access-auth-error.visible {
    display: block;
}

.access-auth-success {
    color: var(--aa-success);
    background: var(--aa-success-bg);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
    line-height: 1.4;
}

.access-auth-success.visible {
    display: block;
}

/* Buttons */
.access-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: var(--aa-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--aa-transition);
    text-decoration: none;
    line-height: 1;
    box-sizing: border-box;
}

.access-auth-btn-primary {
    background: var(--aa-primary);
    color: var(--aa-white);
}

.access-auth-btn-primary:hover {
    background: var(--aa-primary-hover);
}

.access-auth-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.access-auth-btn-google {
    background: var(--aa-white);
    color: var(--aa-text);
    border: 1.5px solid var(--aa-border);
    padding: 12px 20px;
}

.access-auth-btn-google:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.access-auth-btn-google svg {
    flex-shrink: 0;
}

/* Spinner on buttons */
.access-auth-btn .access-auth-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: aaSpin 0.6s linear infinite;
}

.access-auth-btn.loading .access-auth-spinner {
    display: inline-block;
}

.access-auth-btn.loading .access-auth-btn-text {
    display: none;
}

@keyframes aaSpin {
    to {
        transform: rotate(360deg);
    }
}

/* 2FA code input */
#access-auth-2fa-code {
    text-align: center;
    letter-spacing: 8px;
    font-size: 24px;
    font-weight: 600;
    padding: 14px;
}

.access-auth-recovery-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: var(--aa-primary);
    text-decoration: none;
}

.access-auth-recovery-link:hover {
    text-decoration: underline;
}

.access-auth-back-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--aa-text-light);
    text-decoration: none;
}

.access-auth-back-link:hover {
    color: var(--aa-primary);
    text-decoration: underline;
}

/* Footer */
.access-auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.access-auth-footer a {
    display: block;
    font-size: 13px;
    color: var(--aa-text-light);
    text-decoration: none;
    margin-bottom: 8px;
}

.access-auth-footer a:last-child {
    margin-bottom: 0;
}

.access-auth-register-link {
    color: var(--aa-primary) !important;
    font-weight: 600;
}

.access-auth-footer a:hover {
    color: var(--aa-text);
}

/* Responsive */
@media (max-width: 480px) {
    .access-auth-modal {
        padding: 28px 24px;
    }

    .access-auth-tabs {
        flex-direction: column;
    }
}

/* CAPTCHA container */
.access-auth-captcha-container {
    margin-bottom: 16px;
}

.access-auth-captcha-container iframe {
    display: block;
    margin: 0 auto;
}

/* Skip link / Screen reader text */
.access-auth-overlay .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Honeypot field — hidden from humans, visible to bots */
.access-auth-hp-wrap {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

/* Focus visible outlines for keyboard navigation */
.access-auth-tab:focus-visible,
.access-auth-btn:focus-visible,
.access-auth-forgot:focus-visible,
.access-auth-recovery-link:focus-visible,
.access-auth-footer a:focus-visible {
    outline: 2px solid var(--aa-primary);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .access-auth-modal {
        animation: none;
    }
    .access-auth-tab,
    .access-auth-btn,
    .access-auth-field input {
        transition: none;
    }
}

/* Hide default WP login when overlay is active */
body.login #login {
    visibility: hidden;
}

/* Additional small-screen tweaks */
@media (max-width: 360px) {
    .access-auth-modal {
        padding: 24px 18px;
    }

    .access-auth-logo h1 {
        font-size: 20px;
    }

    .access-auth-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* Ensure overlay sits above WP admin bar */
body.admin-bar .access-auth-overlay {
    top: 0;
}

/* RTL support */
html[dir="rtl"] .access-auth-row {
    flex-direction: row-reverse;
}

html[dir="rtl"] .access-auth-remember {
    flex-direction: row-reverse;
}

html[dir="rtl"] .access-auth-footer a {
    direction: rtl;
}

html[dir="rtl"] #access-auth-2fa-code {
    direction: ltr; /* Numeric codes always LTR */
}

html[dir="rtl"] .access-auth-btn-google svg {
    order: 1; /* Keep Google icon on the correct side */
}

/* Dark mode */
/* Dark mode removed — login overlay always uses light theme */
