.auth-portal-buttons {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    position: relative;
}

.auth-portal-buttons.align-left { justify-content: flex-start; }
.auth-portal-buttons.align-center { justify-content: center; }
.auth-portal-buttons.align-right { justify-content: flex-end; }

.auth-portal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
}

.auth-portal-btn-primary {
    background: linear-gradient(135deg, #0073aa, #005177);
    color: #fff;
    border: 1px solid #005177;
    box-shadow: 0 10px 30px rgba(0, 115, 170, 0.25);
}

.auth-portal-btn-ghost {
    background: rgba(0, 0, 0, 0.05);
    color: #111;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.auth-portal-inline {
    display: inline-flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* Modern Burger Menu Toggle */
.auth-portal-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    flex-direction: column;
    gap: 0;
}

.auth-portal-toggle:hover {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.auth-portal-toggle:active {
    transform: scale(0.96);
}

/* Hamburger Icon */
.auth-portal-toggle-icon {
    width: 20px;
    height: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-portal-toggle-bar {
    width: 100%;
    height: 2px;
    background: #1e293b;
    border-radius: 2px;
    transition: all 0.25s ease;
    transform-origin: center;
}

/* Animate to X when open */
.auth-portal-buttons.open .auth-portal-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.auth-portal-buttons.open .auth-portal-toggle-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.auth-portal-buttons.open .auth-portal-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.auth-portal-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Modern Dropdown Menu */
.auth-portal-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.06);
    padding: 8px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    transform-origin: top right;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.auth-portal-buttons.open .auth-portal-menu {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Menu Header */
.auth-portal-menu-header {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 6px;
}

.auth-portal-menu-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin: 0;
}

/* Menu Items */
.auth-portal-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #1e293b;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.auth-portal-menu-item:last-child {
    margin-bottom: 0;
}

.auth-portal-menu-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.auth-portal-menu-item:active {
    background: #e2e8f0;
}

/* Menu Item Icons */
.auth-portal-menu-icon {
    width: 18px;
    height: 18px;
    color: #64748b;
    flex-shrink: 0;
}

.auth-portal-menu-item:hover .auth-portal-menu-icon {
    color: #1e293b;
}

/* Menu Divider */
.auth-portal-menu-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.06);
    margin: 6px 0;
}

/* Primary Button in Menu */
.auth-portal-menu-item.primary {
    background: linear-gradient(135deg, #0073aa, #005177);
    color: #fff;
}

.auth-portal-menu-item.primary:hover {
    background: linear-gradient(135deg, #005d8a, #004060);
    color: #fff;
}

.auth-portal-menu-item.primary .auth-portal-menu-icon {
    color: rgba(255, 255, 255, 0.8);
}

/* Menu Arrow/Caret */
.auth-portal-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 18px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    transform: rotate(45deg);
    z-index: -1;
}

/* User Info in Menu (optional) */
.auth-portal-menu-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 6px;
}

.auth-portal-menu-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.auth-portal-menu-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.auth-portal-menu-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-portal-menu-user-email {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-portal-form {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.05);
    max-width: 500px;
    width: 100%;
    --auth-portal-form-bg: #fff;
    box-sizing: border-box;
}

.auth-portal-form--login,
.auth-portal-form--register {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    --auth-portal-form-bg: transparent;
    width: 100%;
    min-width: 320px;
}

.auth-portal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.auth-portal-field input {
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 15px;
    width: 100%;
    background: var(--auth-portal-form-bg);
    color: #fff;
}

.auth-portal-field input:focus {
    outline: none;
    box-shadow: none;
}

.auth-portal-form--login .auth-portal-field input,
.auth-portal-form--register .auth-portal-field input {
    padding: 22px 14px 10px;
}

.auth-portal-floating {
    position: relative;
}

.auth-portal-floating label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #6b7280;
    pointer-events: none;
    line-height: 1;
    z-index: 1;
    transition: all 0.25s ease;
    background: var(--auth-portal-form-bg);
    padding: 0 6px;
}

.auth-portal-floating input:focus + label,
.auth-portal-floating input:not(:placeholder-shown) + label {
    top: 6px;
    transform: none;
    font-size: 11px;
    color: #6b7280;
}


.auth-portal-label-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.auth-portal-login-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 22px;
    text-align: center;
}

.auth-portal-login-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    transition: opacity 0.25s ease, transform 0.25s ease;
    min-height: 28px;
}

.auth-portal-login-email {
    font-size: 12px;
    color: #6b7280;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    min-height: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-portal-form--login.has-email .auth-portal-login-email,
.auth-portal-form--register.has-email .auth-portal-login-email {
    opacity: 1;
    transform: translateY(0);
}

.auth-portal-form--login.is-switching .auth-portal-login-title,
.auth-portal-form--login.is-switching .auth-portal-login-email,
.auth-portal-form--register.is-switching .auth-portal-login-title,
.auth-portal-form--register.is-switching .auth-portal-login-email {
    opacity: 0;
    transform: translateY(-6px);
}

.auth-portal-step {
    max-height: 0;
    opacity: 0;
    transform: translateY(10px);
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.25s ease;
}

.auth-portal-step.is-active {
    max-height: 320px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.auth-portal-remember {
    flex-direction: row;
    align-items: center;
    margin-bottom: 20px;
}

.auth-portal-actions button {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 0;
    background: linear-gradient(135deg, #22c55e, #15803d);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: box-shadow 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}

.auth-portal-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    transform: none;
}

.auth-portal-actions button.is-ready {
    opacity: 1;
    box-shadow: 0 12px 35px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.auth-portal-messages {
    margin-bottom: 16px;
    display: grid;
    gap: 8px;
}

.auth-portal-message {
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
}

.auth-portal-message--error { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.auth-portal-message--info { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .auth-portal-inline {
        display: none;
    }
    .auth-portal-toggle {
        display: inline-flex;
    }
}

/* Responsive - Mobile */
@media (max-width: 640px) {
    .auth-portal-inline {
        display: none;
    }
    
    .auth-portal-toggle {
        display: inline-flex;
    }
    
    .auth-portal-buttons {
        width: auto;
    }
    
    /* Full-width menu on mobile */
    .auth-portal-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 12px 16px 24px;
        transform: translateY(100%);
        transform-origin: bottom center;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
        transition: transform 0.25s ease, opacity 0.2s ease;
    }
    
    .auth-portal-buttons.open .auth-portal-menu {
        transform: translateY(0);
    }
    
    .auth-portal-menu::before {
        display: none;
    }
    
    .auth-portal-menu-handle {
        width: 40px;
        height: 5px;
        background: #cbd5e1;
        border-radius: 999px;
        margin: 6px auto 14px;
        cursor: grab;
        touch-action: none;
    }

    .auth-portal-menu.dragging {
        transition: none;
    }

    .auth-portal-menu-item {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    /* Overlay behind mobile menu */
    .auth-portal-buttons.open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 999;
        animation: fadeIn 0.2s ease;
        pointer-events: none; /* let outside clicks reach the page so the menu can close */
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Global scroll lock when auth menu is open */
.auth-portal-locked {
    overflow: hidden;
    height: 100%;
    touch-action: none;
    overscroll-behavior: contain;
}
