/* Mobile layer shared by the HIPZI login and register pages. */

.role-card {
    position: relative;
}

.role-card input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.role-card:focus-within {
    border-color: var(--primary);
    outline: 3px solid rgba(5, 150, 105, 0.16);
    outline-offset: 2px;
}

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

@media (max-width: 992px) {
    html {
        min-height: 100%;
        overflow-x: hidden;
        background: #ecfdf5;
    }

    body {
        width: 100%;
        min-height: 100dvh;
        height: auto;
        display: block;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: contain;
        background:
            radial-gradient(circle at 12% 8%, rgba(52, 211, 153, 0.2), transparent 34%),
            radial-gradient(circle at 92% 88%, rgba(251, 191, 36, 0.14), transparent 30%),
            linear-gradient(145deg, #ecfdf5 0%, #f8fafc 52%, #f0fdf4 100%);
        background-attachment: scroll;
        -webkit-overflow-scrolling: touch;
    }

    .auth-page-wrapper {
        width: 100%;
        min-height: 100dvh;
        height: auto;
        max-height: none;
        display: block;
        overflow: visible;
    }

    .auth-page-wrapper::before,
    .auth-page-wrapper::after {
        position: fixed;
        width: 260px;
        height: 260px;
        opacity: 0.7;
    }

    .auth-banner {
        display: none;
    }

    .auth-content {
        width: 100%;
        min-height: 100dvh;
        height: auto;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        box-sizing: border-box;
        padding:
            calc(76px + env(safe-area-inset-top))
            max(0.75rem, env(safe-area-inset-right))
            calc(1.5rem + env(safe-area-inset-bottom))
            max(0.75rem, env(safe-area-inset-left));
        background: transparent;
    }

    .auth-form-container {
        width: 100%;
        max-width: 480px;
        height: auto;
        min-height: 0;
        margin: 0 auto;
        padding: 1.75rem 1.4rem;
        overflow: visible;
        border: 1px solid rgba(255, 255, 255, 0.9);
        border-radius: 26px;
        background: rgba(255, 255, 255, 0.94);
        box-shadow:
            0 24px 60px rgba(15, 23, 42, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    .auth-form-inner {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
        flex-shrink: 1;
        animation: authMobileEnter 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .auth-home-btn {
        position: fixed;
        top: calc(0.75rem + env(safe-area-inset-top));
        right: auto;
        left: max(0.75rem, env(safe-area-inset-left));
        width: auto;
        min-width: 48px;
        height: 48px;
        gap: 0.5rem;
        padding: 0 0.9rem 0 0.55rem;
        box-sizing: border-box;
        border-radius: 15px;
        text-decoration: none;
        animation: authMobileEnter 440ms cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .auth-home-btn::after {
        content: "HIPZI";
        color: #047857;
        font-size: 0.9rem;
        font-weight: 800;
        letter-spacing: -0.02em;
    }

    .auth-home-btn img {
        width: 28px;
        height: 28px;
    }

    .auth-header {
        margin-bottom: 1.5rem;
        padding-right: 0;
    }

    .auth-header h1 {
        margin-bottom: 0.55rem;
        font-size: clamp(1.65rem, 7vw, 2rem);
        line-height: 1.2;
        letter-spacing: -0.035em;
        text-wrap: balance;
    }

    .auth-header p {
        font-size: 0.95rem;
        font-weight: 500;
        line-height: 1.6;
        text-wrap: pretty;
    }

    .form-group {
        margin-bottom: 1rem;
        scroll-margin-top: 84px;
    }

    .form-group label {
        margin-bottom: 0.45rem;
        font-size: 0.86rem;
    }

    .form-control {
        min-height: 52px;
        padding: 0.82rem 0.9rem;
        border-radius: 13px;
        font-size: 16px;
        line-height: 1.25;
    }

    .password-input-wrapper .form-control {
        padding-right: 3.25rem;
    }

    .password-toggle-btn {
        right: 4px;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 11px;
    }

    .password-toggle-btn:active {
        background: #ecfdf5;
    }

    .remembered-email-menu {
        max-height: min(240px, 38dvh);
        overflow-y: auto;
        border-radius: 13px;
        -webkit-overflow-scrolling: touch;
    }

    .remembered-email-value {
        min-height: 48px;
        padding-block: 0.75rem;
        font-size: 0.88rem;
    }

    .remembered-email-remove {
        width: 40px;
        height: 40px;
        margin-right: 0.35rem;
    }

    .form-options {
        gap: 0.75rem;
        margin-bottom: 1.25rem;
        font-size: 0.84rem;
    }

    .remember-me,
    .forgot-password {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .remember-me input[type="checkbox"] {
        width: 18px;
        height: 18px;
        flex: 0 0 18px;
    }

    .role-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .role-card {
        min-width: 0;
        min-height: 54px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.65rem 0.4rem;
        border-radius: 13px;
        box-sizing: border-box;
        -webkit-tap-highlight-color: transparent;
    }

    .role-card span {
        font-size: 0.8rem;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .btn {
        min-height: 52px;
        padding: 0.82rem 1rem;
        border-radius: 14px;
        font-size: 0.95rem;
        -webkit-tap-highlight-color: transparent;
    }

    .social-login-divider {
        margin: 1.2rem 0;
    }

    .btn-google {
        border-color: #cbd5e1;
    }

    .auth-footer {
        margin-top: 1.5rem;
        padding-top: 0.25rem;
        font-size: 0.88rem;
        line-height: 1.6;
    }

    .auth-footer a {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    .custom-toast-container {
        right: max(0.75rem, env(safe-area-inset-right));
        bottom: calc(0.75rem + env(safe-area-inset-bottom));
        left: max(0.75rem, env(safe-area-inset-left));
        width: auto;
    }

    .custom-toast-msg {
        width: 100%;
        max-width: 480px;
        margin-left: auto;
        padding: 0.85rem 1rem;
        box-sizing: border-box;
        font-size: 0.82rem;
        line-height: 1.45;
    }
}

@media (max-width: 430px) {
    .auth-content {
        padding-right: max(0.55rem, env(safe-area-inset-right));
        padding-left: max(0.55rem, env(safe-area-inset-left));
    }

    .auth-form-container {
        padding: 1.5rem 1rem;
        border-radius: 22px;
    }

    .auth-header {
        margin-bottom: 1.3rem;
    }

    .form-options {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .social-login-divider {
        margin-block: 1rem;
    }
}

@media (max-width: 340px) {
    .role-grid {
        grid-template-columns: 1fr;
    }

    .role-card {
        min-height: 48px;
    }

    .form-options {
        flex-direction: column;
        gap: 0.2rem;
    }
}

@media (max-width: 992px) and (max-height: 520px) and (orientation: landscape) {
    .auth-content {
        padding-top: calc(64px + env(safe-area-inset-top));
    }

    .auth-home-btn {
        top: calc(0.45rem + env(safe-area-inset-top));
        height: 44px;
    }

    .auth-form-container {
        padding-block: 1.25rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    .auth-home-btn:hover,
    .btn-primary:hover,
    .btn-google:hover {
        margin-top: 0;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-form-inner,
    .auth-home-btn {
        animation: none !important;
    }
}
